Skip to main content

IntegrityCheck

Trait IntegrityCheck 

Source
pub trait IntegrityCheck: Send {
    // Required methods
    fn update(&mut self, chunk: &[u8]);
    fn finalize(self: Box<Self>, total: u64) -> Result<(), String>;
}
Expand description

A check fed the raw bytes of an object body as they stream past, and asked to validate once the underlying reader reaches EOF.

Required Methods§

Source

fn update(&mut self, chunk: &[u8])

Observe a chunk of body bytes. Called zero or more times, in order, before finalize.

Source

fn finalize(self: Box<Self>, total: u64) -> Result<(), String>

Validate at EOF. total is the number of bytes observed across every update call. Return Err(reason) to fail the read; the reason is surfaced as an io::Error of kind InvalidData.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§