pub struct RollingChecksum { /* private fields */ }Expand description
Rolling weak checksum over a fixed-length window.
Construct from a window with RollingChecksum::new, read the current value
with RollingChecksum::value, and slide forward one byte at a time with
RollingChecksum::roll.
Implementations§
Source§impl RollingChecksum
impl RollingChecksum
Sourcepub fn new(window: &[u8]) -> Self
pub fn new(window: &[u8]) -> Self
Compute the checksum freshly over window.
The window length is fixed for the life of this value; roll keeps it
constant.
Sourcepub fn roll(&mut self, out_byte: u8, in_byte: u8)
pub fn roll(&mut self, out_byte: u8, in_byte: u8)
Slide the window one byte to the right.
out_byte is the byte leaving the window on the left; in_byte is the
byte entering on the right. The window length is preserved.
Sourcepub fn window_len(&self) -> u32
pub fn window_len(&self) -> u32
The fixed window length this checksum tracks.
Trait Implementations§
Source§impl Clone for RollingChecksum
impl Clone for RollingChecksum
Source§fn clone(&self) -> RollingChecksum
fn clone(&self) -> RollingChecksum
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for RollingChecksum
Auto Trait Implementations§
impl Freeze for RollingChecksum
impl RefUnwindSafe for RollingChecksum
impl Send for RollingChecksum
impl Sync for RollingChecksum
impl Unpin for RollingChecksum
impl UnsafeUnpin for RollingChecksum
impl UnwindSafe for RollingChecksum
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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