Struct whistlinoak::Tree
source · [−]Expand description
An annotated tree structure with an arity of 2N
, backed by an arbitrary
memory.
Each leaf contained in the tree is decorated by an Annotation
, computed
on the push
of said leaf. The change is then propagated up through the
tree, recursively combining the annotations of filled subtrees until the
root
itself is computed.
Leaves can also be pop
ped from tree, and annotations will be kept
updated.
The Memory
trait allows for different ways of storing the tree in
memory. Currently, an implementation on Vec<u8>
is provided through the
new
function, and on FileMemory
through with_file
. One can also
use with_memory
to supply their own implementation.
Safety
Using an N
of 0 will result in a panic when trying to perform any
operation.
Implementations
sourceimpl<L, A, const N: usize> Tree<L, A, N, FileMemory> where
A: Annotation<L>,
impl<L, A, const N: usize> Tree<L, A, N, FileMemory> where
A: Annotation<L>,
sourceimpl<L, A, const N: usize, M> Tree<L, A, N, M> where
A: Annotation<L>,
M: Memory,
impl<L, A, const N: usize, M> Tree<L, A, N, M> where
A: Annotation<L>,
M: Memory,
sourcepub fn with_memory(memory: M) -> Result<Self, M::Error>
pub fn with_memory(memory: M) -> Result<Self, M::Error>
Creates a new tree, backed by a custom implementation of Memory
.
Trait Implementations
Auto Trait Implementations
impl<L, A, const N: usize, M> RefUnwindSafe for Tree<L, A, N, M> where
A: RefUnwindSafe,
L: RefUnwindSafe,
M: RefUnwindSafe,
impl<L, A = (), const N: usize = 1, M = Vec<u8, Global>> !Send for Tree<L, A, N, M>
impl<L, A = (), const N: usize = 1, M = Vec<u8, Global>> !Sync for Tree<L, A, N, M>
impl<L, A, const N: usize, M> Unpin for Tree<L, A, N, M> where
M: Unpin,
impl<L, A, const N: usize, M> UnwindSafe for Tree<L, A, N, M> where
A: RefUnwindSafe,
L: RefUnwindSafe,
M: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more