Skip to main content

AccountTree

Struct AccountTree 

Source
pub struct AccountTree<'arena> { /* private fields */ }
Expand description

Represents the tree structure of the accounts, stored in the [AccountStore].

Implementations§

Source§

impl<'arena> AccountTree<'arena>

Source

pub fn new(arena: &'arena Bump) -> Self

Creates a new instance.

This constructs only a plain empty tree, and the actual work is done in Self::construct() because we want to retain the prefixes lifetime aligned with [AccountStore].

Source

pub fn construct(&mut self, accounts: &AccountStore<'arena>)

Constructs the tree state from the given [AccountStore].

Source

pub fn resolve_ancestor(&self, label: &str) -> Option<AccountAncestor<'arena>>

Resolves the [AccountAncestor] corresponding to the given label. Returns None if not found. Note that this would also return None if the given label is Account. See super::ReportContext::account_aggregate(), that is more convenient.

Source

pub fn parent<T: Into<AccountAggregate<'arena>>>( &self, account: T, ) -> Option<AccountTreeKey<'arena>>

Returns the parent of the given node. None if the given account is not found in the tree.

Source

pub fn children<T: Into<AccountTreeKey<'arena>>>( &self, key: T, ) -> Option<&[AccountAggregate<'arena>]>

Returns the children of the given node. None if the given key is not found, and empty slice for the leaf account.

Auto Trait Implementations§

§

impl<'arena> !RefUnwindSafe for AccountTree<'arena>

§

impl<'arena> !Send for AccountTree<'arena>

§

impl<'arena> !Sync for AccountTree<'arena>

§

impl<'arena> !UnwindSafe for AccountTree<'arena>

§

impl<'arena> Freeze for AccountTree<'arena>

§

impl<'arena> Unpin for AccountTree<'arena>

§

impl<'arena> UnsafeUnpin for AccountTree<'arena>

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.