[][src]Struct ssri::IntegrityChecker

pub struct IntegrityChecker { /* fields omitted */ }

Check data against an Integrity.

Examples

let data = b"hello world";
let sri = Integrity::from(&data);
let checker = IntegrityChecker::new(sri).chain(&data);
assert_eq!(checker.result().unwrap(), Algorithm::Sha256);

Methods

impl IntegrityChecker[src]

pub fn new(sri: Integrity) -> IntegrityChecker[src]

Creates a new IntegrityChecker builder. Use this to verify chunked data.

pub fn input<B: AsRef<[u8]>>(&mut self, data: B)[src]

Add some data to the running checker.

pub fn chain<B: AsRef<[u8]>>(self, data: B) -> Self[src]

Same as IntegrityChecker::input, but allows chained calls.

pub fn result(self) -> Result<Algorithm, Error>[src]

Returns the matching algorithm if the inputted data matches the input Integrity.

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self