You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
451 B

4 years ago
use crate::*;
pub trait ByteProvider: Sized + std::fmt::Display
{
4 years ago
fn compute<T: Read + ?Sized>(input: &mut T, salt: &salt::Salt, provided: &mut usize) -> Result<Self, error::Error>;
4 years ago
fn bytes(&self) -> &[u8];
}
4 years ago
pub fn compute<T: Read + ?Sized, P: ByteProvider>(input: &mut T, salt: salt::Salt) -> Result<(usize, P), error::Error>
4 years ago
{
let mut output = 0usize;
4 years ago
let this = P::compute(input, &salt, &mut output)?;
4 years ago
Ok((output, this))
}