pub struct RollingHash { /* private fields */ }Expand description
Rabin-Karp rolling hash for efficient substring comparison
Uses a rolling window to compute hashes of code blocks. Allows for efficient duplicate detection in O(n) time.
Implementations§
Source§impl RollingHash
impl RollingHash
Sourcepub fn new(window_size: usize) -> Self
pub fn new(window_size: usize) -> Self
Creates a new RollingHash with the specified window size
§Arguments
window_size- Number of tokens in the rolling window (default: 50)
Sourcepub fn current_hash(&self) -> Option<u64>
pub fn current_hash(&self) -> Option<u64>
Returns the current hash value (if window is full)
Sourcepub fn window_size(&self) -> usize
pub fn window_size(&self) -> usize
Returns the current window size
Trait Implementations§
Source§impl Clone for RollingHash
impl Clone for RollingHash
Source§fn clone(&self) -> RollingHash
fn clone(&self) -> RollingHash
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 moreAuto Trait Implementations§
impl Freeze for RollingHash
impl RefUnwindSafe for RollingHash
impl Send for RollingHash
impl Sync for RollingHash
impl Unpin for RollingHash
impl UnwindSafe for RollingHash
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more