Struct simd_adler32::Adler32

source ·
pub struct Adler32 {
    pub(crate) a: u16,
    pub(crate) b: u16,
    pub(crate) update: Adler32Imp,
}
Expand description

An adler32 hash generator type.

Fields§

§a: u16§b: u16§update: Adler32Imp

Implementations§

source§

impl Adler32

source

pub fn new() -> Self

Constructs a new Adler32.

Potential overhead here due to runtime feature detection although in testing on 100k and 10k random byte arrays it was not really noticeable.

§Examples
use simd_adler32::Adler32;

let mut adler = Adler32::new();
source

pub fn from_checksum(checksum: u32) -> Self

Constructs a new Adler32 using existing checksum.

Potential overhead here due to runtime feature detection although in testing on 100k and 10k random byte arrays it was not really noticeable.

§Examples
use simd_adler32::Adler32;

let mut adler = Adler32::from_checksum(0xdeadbeaf);
source

pub fn write(&mut self, data: &[u8])

Computes hash for supplied data and stores results in internal state.

source

pub fn finish(&self) -> u32

Returns the hash value for the values written so far.

Despite its name, the method does not reset the hasher’s internal state. Additional writes will continue from the current value. If you need to start a fresh hash value, you will have to use reset.

source

pub fn reset(&mut self)

Resets the internal state.

Trait Implementations§

source§

impl Clone for Adler32

source§

fn clone(&self) -> Adler32

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Default for Adler32

source§

fn default() -> Self

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

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.