pub trait CreateOutboard {
// Required methods
fn create_sized(
data: impl AsyncStreamReader,
size: u64,
block_size: BlockSize,
) -> impl Future<Output = Result<Self>>
where Self: Default + Sized;
fn init_from(
&mut self,
data: impl AsyncStreamReader,
) -> impl Future<Output = Result<()>>;
// Provided method
async fn create(
data: impl AsyncSliceReader,
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 AsyncStreamReader,
size: u64,
block_size: BlockSize,
) -> impl Future<Output = Result<Self>>
fn create_sized( data: impl AsyncStreamReader, size: u64, block_size: BlockSize, ) -> impl Future<Output = 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 AsyncStreamReader,
) -> impl Future<Output = Result<()>>
fn init_from( &mut self, data: impl AsyncStreamReader, ) -> impl Future<Output = 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§
Sourceasync fn create(
data: impl AsyncSliceReader,
block_size: BlockSize,
) -> Result<Self>
async fn create( data: impl AsyncSliceReader, block_size: BlockSize, ) -> Result<Self>
Create an outboard from a seekable data source, measuring the size first.
This requires the outboard to have a default implementation, which is the case for the memory implementations.
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.