Struct PreOrderMemOutboard

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

A pre order outboard that is optimized for memory storage.

The traits are implemented for fixed size slices or mutable slices, so you must make sure that the data is already the right size.

Fields§

§root: Hash

root hash

§tree: BaoTree

tree defining the data

§data: T

hashes with length prefix

Implementations§

Source§

impl PreOrderMemOutboard

Source

pub fn into_inner_with_prefix(self) -> Vec<u8>

returns the outboard data, with the length prefix added.

Source

pub fn create(data: impl AsRef<[u8]>, block_size: BlockSize) -> Self

Create a new outboard from data and a block_size.

This will hash the data and create an outboard

Source§

impl<T> PreOrderMemOutboard<T>

Source

pub fn map_data<F, U>(self, f: F) -> PreOrderMemOutboard<U>
where F: FnOnce(T) -> U, U: AsRef<[u8]>,

Map the outboard data to a new type.

Source

pub fn flip(&self) -> PostOrderMemOutboard
where T: AsRef<[u8]>,

Flip the outboard to a post order outboard.

Trait Implementations§

Source§

impl<T: Clone> Clone for PreOrderMemOutboard<T>

Source§

fn clone(&self) -> PreOrderMemOutboard<T>

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<T: Debug> Debug for PreOrderMemOutboard<T>

Source§

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

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

impl<T: Default> Default for PreOrderMemOutboard<T>

Source§

fn default() -> Self

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

impl<T: AsRef<[u8]>> Outboard for PreOrderMemOutboard<T>

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<T: AsRef<[u8]>> Outboard for PreOrderMemOutboard<T>

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<T: AsMut<[u8]>> OutboardMut for PreOrderMemOutboard<T>

Source§

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

Save a hash pair for a node
Source§

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

Sync the outboard.
Source§

impl<T: AsMut<[u8]>> OutboardMut for PreOrderMemOutboard<T>

Source§

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

Save a hash pair for a node
Source§

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

sync to disk
Source§

impl<T: PartialEq> PartialEq for PreOrderMemOutboard<T>

Source§

fn eq(&self, other: &PreOrderMemOutboard<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: Eq> Eq for PreOrderMemOutboard<T>

Source§

impl<T> StructuralPartialEq for PreOrderMemOutboard<T>

Auto Trait Implementations§

§

impl<T> Freeze for PreOrderMemOutboard<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for PreOrderMemOutboard<T>
where T: RefUnwindSafe,

§

impl<T> Send for PreOrderMemOutboard<T>
where T: Send,

§

impl<T> Sync for PreOrderMemOutboard<T>
where T: Sync,

§

impl<T> Unpin for PreOrderMemOutboard<T>
where T: Unpin,

§

impl<T> UnwindSafe for PreOrderMemOutboard<T>
where T: 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.