penumbra_tct::internal::frontier

Trait Frontier

Source
pub trait Frontier: Focus + Sized {
    type Item;

    // Required methods
    fn new(item: Self::Item) -> Self;
    fn insert_owned(self, item: Self::Item) -> Result<Self, Full<Self>>;
    fn update<T>(&mut self, f: impl FnOnce(&mut Self::Item) -> T) -> Option<T>;
    fn focus(&self) -> Option<&Self::Item>;
    fn is_full(&self) -> bool;
}
Available on crate feature internal only.
Expand description

A frontier of a tree supporting the insertion of new elements and the updating of the most-recently-inserted element.

Required Associated Types§

Source

type Item

The type of item to persist in each witnessed leaf of the frontier.

Required Methods§

Source

fn new(item: Self::Item) -> Self

Make a new Frontier containing a single Hash or Self::Item.

Source

fn insert_owned(self, item: Self::Item) -> Result<Self, Full<Self>>

Insert a new Hash or Self::Item into this Frontier, returning either Self with the thing inserted, or the un-inserted thing and the Complete of this Frontier.

Source

fn update<T>(&mut self, f: impl FnOnce(&mut Self::Item) -> T) -> Option<T>

Update the currently focused Insert<Self::Item> (i.e. the most-recently insert one), returning the result of the function.

Source

fn focus(&self) -> Option<&Self::Item>

Get a reference to the focused Insert<Self::Item> (i.e. the most-recently insert one).

Source

fn is_full(&self) -> bool

Check whether this frontier is full.

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.

Implementors§

Source§

impl<Child> Frontier for Node<Child>
where Child: Focus + Frontier + GetHash + Clone, Child::Complete: Clone,

Source§

type Item = <Child as Frontier>::Item

Source§

impl<Item: Focus> Frontier for Leaf<Item>

Source§

type Item = Item