Struct HashedSequence

Source
pub struct HashedSequence<Hasher>
where Hasher: RollingHasher + ?Sized,
{ /* private fields */ }

Implementations§

Source§

impl<Hasher> HashedSequence<Hasher>
where Hasher: RollingHasher + ?Sized,

Source

pub fn len(&self) -> usize

Examples found in repository?
crates/competitive/src/string/rolling_hash.rs (line 49)
48    pub fn is_empty(&self) -> bool {
49        self.len() == 0
50    }
51    pub fn range<R>(&self, range: R) -> HashedRange<'_, Hasher>
52    where
53        R: RangeBounds<usize>,
54    {
55        HashedRange::new(&self.hashed[to_range(range, self.len())])
56    }
Source

pub fn is_empty(&self) -> bool

Source

pub fn range<R>(&self, range: R) -> HashedRange<'_, Hasher>
where R: RangeBounds<usize>,

Examples found in repository?
crates/competitive/src/string/rolling_hash.rs (line 61)
57    pub fn hash_range<R>(&self, range: R) -> Hashed<Hasher>
58    where
59        R: RangeBounds<usize>,
60    {
61        self.range(range).hash()
62    }
More examples
Hide additional examples
crates/library_checker/src/string/zalgorithm.rs (line 21)
15pub fn zalgorithm_rolling_hash(reader: impl Read, mut writer: impl Write) {
16    let s = read_all_unchecked(reader);
17    let mut scanner = Scanner::new(&s);
18    scan!(scanner, s: Bytes);
19    Mersenne61x1::init(s.len());
20    let h = Mersenne61x1::hash_sequence(s.iter().map(|&c| c as _));
21    let ans = (0..s.len()).map(|i| h.range(..).longest_common_prefix(&h.range(i..)));
22    iter_print!(writer, @it ans);
23}
Source

pub fn hash_range<R>(&self, range: R) -> Hashed<Hasher>
where R: RangeBounds<usize>,

Trait Implementations§

Source§

impl<Hasher> Debug for HashedSequence<Hasher>
where Hasher: RollingHasher + ?Sized + Debug, Hasher::Hash: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<Hasher> Freeze for HashedSequence<Hasher>
where Hasher: ?Sized,

§

impl<Hasher> RefUnwindSafe for HashedSequence<Hasher>
where <Hasher as RollingHasher>::Hash: RefUnwindSafe, Hasher: ?Sized,

§

impl<Hasher> Send for HashedSequence<Hasher>
where <Hasher as RollingHasher>::Hash: Send, Hasher: ?Sized,

§

impl<Hasher> Sync for HashedSequence<Hasher>
where <Hasher as RollingHasher>::Hash: Sync, Hasher: ?Sized,

§

impl<Hasher> Unpin for HashedSequence<Hasher>
where <Hasher as RollingHasher>::Hash: Unpin, Hasher: ?Sized,

§

impl<Hasher> UnwindSafe for HashedSequence<Hasher>
where <Hasher as RollingHasher>::Hash: UnwindSafe, Hasher: ?Sized,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.