pub trait Streamable {
// Required methods
fn update_digest(&self, digest: &mut Sha256);
fn stream(&self, out: &mut Vec<u8>) -> Result<(), Error>;
fn parse<const TRUSTED: bool>(
input: &mut Cursor<&[u8]>,
) -> Result<Self, Error>
where Self: Sized;
// Provided methods
fn to_bytes(&self) -> Result<Vec<u8>, Error> { ... }
fn from_bytes(bytes: &[u8]) -> Result<Self, Error>
where Self: Sized { ... }
fn from_bytes_unchecked(bytes: &[u8]) -> Result<Self, Error>
where Self: Sized { ... }
fn hash(&self) -> [u8; 32] { ... }
}Required Methods§
fn update_digest(&self, digest: &mut Sha256)
fn stream(&self, out: &mut Vec<u8>) -> Result<(), Error>
fn parse<const TRUSTED: bool>(input: &mut Cursor<&[u8]>) -> Result<Self, Error>where
Self: Sized,
Provided Methods§
fn to_bytes(&self) -> Result<Vec<u8>, Error>
fn from_bytes(bytes: &[u8]) -> Result<Self, Error>where
Self: Sized,
fn from_bytes_unchecked(bytes: &[u8]) -> Result<Self, Error>where
Self: Sized,
fn hash(&self) -> [u8; 32]
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".