Struct PreOrderOutboard

Source
pub struct PreOrderOutboard<D = Vec<u8>> {
    pub root: Hash,
    pub tree: BaoTree,
    pub data: D,
}
Expand description

A generic outboard in pre order

All fields are public, so an outboard does not enforce any invariants. This is necessary since we want outboards to exist in an incomplete state where data does not match the root hash.

Caution: unlike the outboard implementation in the bao crate, this implementation does not assume an 8 byte size prefix.

Fields§

§root: Hash

root hash

§tree: BaoTree

tree defining the data

§data: D

hashes with length prefix

Trait Implementations§

Source§

impl<D: Clone> Clone for PreOrderOutboard<D>

Source§

fn clone(&self) -> PreOrderOutboard<D>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<W: AsyncSliceWriter> CreateOutboard for PreOrderOutboard<W>

Source§

async fn create_sized( data: impl AsyncStreamReader, size: u64, block_size: BlockSize, ) -> Result<Self>
where Self: Default + Sized,

create an outboard from a data source. This requires the outboard to have a default implementation, which is the case for the memory implementations.
Source§

async fn init_from(&mut self, data: impl AsyncStreamReader) -> Result<()>

Init the outboard from a data source. This will use the existing tree and only init the data and set the root hash. Read more
Source§

async fn create( data: impl AsyncSliceReader, block_size: BlockSize, ) -> Result<Self>
where Self: Default + Sized,

Create an outboard from a seekable data source, measuring the size first. Read more
Source§

impl<W: WriteAt> CreateOutboard for PreOrderOutboard<W>

Source§

fn create_sized( data: impl Read, size: u64, block_size: BlockSize, ) -> Result<Self>
where Self: Default + Sized,

create an outboard from a data source. This requires the outboard to have a default implementation, which is the case for the memory implementations.
Source§

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. Read more
Source§

fn create(data: impl Read + Seek, block_size: BlockSize) -> Result<Self>
where Self: Default + Sized,

Create an outboard from a data source.
Source§

impl<D: Debug> Debug for PreOrderOutboard<D>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<R: Default> Default for PreOrderOutboard<R>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<R: AsyncSliceReader> Outboard for PreOrderOutboard<R>

Source§

fn root(&self) -> Hash

The root hash
Source§

fn tree(&self) -> BaoTree

The tree. This contains the information about the size of the file and the block size.
Source§

async fn load(&mut self, node: TreeNode) -> Result<Option<(Hash, Hash)>>

load the hash pair for a node Read more
Source§

impl<R: ReadAt> Outboard for PreOrderOutboard<R>

Source§

fn root(&self) -> Hash

The root hash
Source§

fn tree(&self) -> BaoTree

The tree. This contains the information about the size of the file and the block size.
Source§

fn load(&self, node: TreeNode) -> Result<Option<(Hash, Hash)>>

load the hash pair for a node
Source§

impl<W: AsyncSliceWriter> OutboardMut for PreOrderOutboard<W>

Source§

async fn save(&mut self, node: TreeNode, hash_pair: &(Hash, Hash)) -> Result<()>

Save a hash pair for a node
Source§

async fn sync(&mut self) -> Result<()>

sync to disk
Source§

impl<W: WriteAt> OutboardMut for PreOrderOutboard<W>

Source§

fn save(&mut self, node: TreeNode, hash_pair: &(Hash, Hash)) -> Result<()>

Save a hash pair for a node
Source§

fn sync(&mut self) -> Result<()>

Sync the outboard.

Auto Trait Implementations§

§

impl<D> Freeze for PreOrderOutboard<D>
where D: Freeze,

§

impl<D> RefUnwindSafe for PreOrderOutboard<D>
where D: RefUnwindSafe,

§

impl<D> Send for PreOrderOutboard<D>
where D: Send,

§

impl<D> Sync for PreOrderOutboard<D>
where D: Sync,

§

impl<D> Unpin for PreOrderOutboard<D>
where D: Unpin,

§

impl<D> UnwindSafe for PreOrderOutboard<D>
where D: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.