Trait penumbra_tct::internal::interface::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.

Object Safety§

This trait is not object safe.

Implementors§

source§

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

§

type Item = <Child as Frontier>::Item

source§

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

§

type Item = Item