pub trait CreateOutboard {
// Required methods
fn create_sized(
data: impl Read,
size: u64,
block_size: BlockSize,
) -> Result<Self>
where Self: Default + Sized;
fn init_from(&mut self, data: impl Read) -> Result<()>;
// Provided method
fn create(data: impl Read + Seek, block_size: BlockSize) -> Result<Self>
where Self: Default + Sized { ... }
}
Expand description
Convenience trait to initialize an outboard from a data source.
In complex real applications, you might want to do this manually.
Required Methods§
Sourcefn create_sized(
data: impl Read,
size: u64,
block_size: BlockSize,
) -> Result<Self>
fn create_sized( data: impl Read, size: u64, block_size: BlockSize, ) -> Result<Self>
create an outboard from a data source. This requires the outboard to have a default implementation, which is the case for the memory implementations.
Sourcefn init_from(&mut self, data: impl Read) -> Result<()>
fn init_from(&mut self, data: impl Read) -> Result<()>
Init the outboard from a data source. This will use the existing tree and only init the data and set the root hash.
So this can be used to initialize an outboard that does not have a default, such as a file based one.
It will only include data up the the current tree size.
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.