Gear

Struct Gear 

Source
pub struct Gear { /* private fields */ }

Implementations§

Source§

impl Gear

Source

pub fn new() -> Self

Create new Gear engine with default chunking settings

Source

pub fn new_with_chunk_bits(chunk_bits: u32) -> Self

Create new Gear engine with custom chunking settings

chunk_bits is number of bits that need to match in the edge condition. CHUNK_BITS constant is the default.

Source

pub fn find_chunk_edge(&mut self, buf: &[u8]) -> Option<(usize, u64)>

Find chunk edge using Gear defaults.

See Engine::find_chunk_edge_cond.

Trait Implementations§

Source§

impl Default for Gear

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Engine for Gear

Source§

type Digest = u64

Source§

fn roll_byte(&mut self, b: u8)

Roll over one byte
Source§

fn digest(&self) -> u64

Return current rolling sum digest
Source§

fn reset(&mut self)

Resets the internal state
Source§

fn roll(&mut self, buf: &[u8])

Roll over a slice of bytes
Source§

fn find_chunk_edge_cond<F>( &mut self, buf: &[u8], cond: F, ) -> Option<(usize, Self::Digest)>
where F: Fn(&Self) -> bool,

Find the end of the chunk. Read more

Auto Trait Implementations§

§

impl Freeze for Gear

§

impl RefUnwindSafe for Gear

§

impl Send for Gear

§

impl Sync for Gear

§

impl Unpin for Gear

§

impl UnwindSafe for Gear

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.