pub struct IndexedTree<'a, C = Vec<usize>>{ /* private fields */ }Expand description
A validated zero-copy adapter over an indexed adjacency list.
Implementations§
Source§impl<'a, C> IndexedTree<'a, C>
impl<'a, C> IndexedTree<'a, C>
Sourcepub fn new(
roots: impl IntoIterator<Item = usize>,
children: &'a [C],
revision: TreeRevision,
) -> Result<Self, IndexedTreeError>
pub fn new( roots: impl IntoIterator<Item = usize>, children: &'a [C], revision: TreeRevision, ) -> Result<Self, IndexedTreeError>
Checks bounds, unique parents, and the absence of cycles.
§Errors
Returns IndexedTreeError when a root or child is invalid, a node has multiple
parents, the root set is incomplete, or the graph contains a cycle.
Trait Implementations§
Source§impl<C> TreeModel for IndexedTree<'_, C>
impl<C> TreeModel for IndexedTree<'_, C>
Source§fn roots(&self) -> impl Iterator<Item = Self::Id> + '_
fn roots(&self) -> impl Iterator<Item = Self::Id> + '_
Returns forest roots in deterministic order.
Source§fn children(&self, id: Self::Id) -> TreeChildren<'_, Self::Id>
fn children(&self, id: Self::Id) -> TreeChildren<'_, Self::Id>
Returns the node’s child state and loaded children.
Source§fn revision(&self) -> TreeRevision
fn revision(&self) -> TreeRevision
Returns the revision of the model structure and display data.
Auto Trait Implementations§
impl<'a, C> Freeze for IndexedTree<'a, C>
impl<'a, C> RefUnwindSafe for IndexedTree<'a, C>where
C: RefUnwindSafe,
impl<'a, C> Send for IndexedTree<'a, C>where
C: Sync,
impl<'a, C> Sync for IndexedTree<'a, C>where
C: Sync,
impl<'a, C> Unpin for IndexedTree<'a, C>
impl<'a, C> UnsafeUnpin for IndexedTree<'a, C>
impl<'a, C> UnwindSafe for IndexedTree<'a, C>where
C: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more