pub struct RollingHash<const BASE: u64> { /* private fields */ }Expand description
Rolling Hash です。O(文字列長) の前計算をしたうえで、部分文字列のハッシュ値を O(1) で計算します。
Implementations§
Source§impl<const BASE: u64> RollingHash<BASE>
impl<const BASE: u64> RollingHash<BASE>
pub fn new(xs: &[u64]) -> Self
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn base(&self) -> u64
pub fn at(&self, i: usize) -> u64
pub fn substring(&self, range: Range<usize>) -> Substring<BASE>
pub fn position(&self, sub: &Substring<BASE>) -> Option<usize>
Trait Implementations§
Source§impl<const BASE: u64> Clone for RollingHash<BASE>
impl<const BASE: u64> Clone for RollingHash<BASE>
Source§fn clone(&self) -> RollingHash<BASE>
fn clone(&self) -> RollingHash<BASE>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<const BASE: u64> Debug for RollingHash<BASE>
impl<const BASE: u64> Debug for RollingHash<BASE>
Source§impl<T> FromIterator<T> for RollingHash<DEFAULT_BASE>
impl<T> FromIterator<T> for RollingHash<DEFAULT_BASE>
Source§fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
Creates a value from an iterator. Read more
Auto Trait Implementations§
impl<const BASE: u64> Freeze for RollingHash<BASE>
impl<const BASE: u64> RefUnwindSafe for RollingHash<BASE>
impl<const BASE: u64> Send for RollingHash<BASE>
impl<const BASE: u64> Sync for RollingHash<BASE>
impl<const BASE: u64> Unpin for RollingHash<BASE>
impl<const BASE: u64> UnwindSafe for RollingHash<BASE>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more