pub struct Tree<T> { /* private fields */ }
Expand description
Vec-backed ID-tree.
Always contains at least a root node.
Implementations§
source§impl<T> Tree<T>
impl<T> Tree<T>
sourcepub fn with_capacity(root: T, capacity: usize) -> Self
pub fn with_capacity(root: T, capacity: usize) -> Self
Creates a tree with a root node and the specified capacity.
sourcepub fn get(&self, id: NodeId) -> Option<NodeRef<'_, T>>
pub fn get(&self, id: NodeId) -> Option<NodeRef<'_, T>>
Returns a reference to the specified node.
sourcepub fn get_mut(&mut self, id: NodeId) -> Option<NodeMut<'_, T>>
pub fn get_mut(&mut self, id: NodeId) -> Option<NodeMut<'_, T>>
Returns a mutator of the specified node.
sourcepub unsafe fn get_unchecked(&self, id: NodeId) -> NodeRef<'_, T>
pub unsafe fn get_unchecked(&self, id: NodeId) -> NodeRef<'_, T>
Returns a reference to the specified node.
§Safety
The caller must ensure that id
is a valid node ID.
sourcepub unsafe fn get_unchecked_mut(&mut self, id: NodeId) -> NodeMut<'_, T>
pub unsafe fn get_unchecked_mut(&mut self, id: NodeId) -> NodeMut<'_, T>
Trait Implementations§
source§impl<T> IntoIterator for Tree<T>
impl<T> IntoIterator for Tree<T>
impl<T: Eq> Eq for Tree<T>
impl<T> StructuralPartialEq for Tree<T>
Auto Trait Implementations§
impl<T> Freeze for Tree<T>
impl<T> RefUnwindSafe for Tree<T>where
T: RefUnwindSafe,
impl<T> Send for Tree<T>where
T: Send,
impl<T> Sync for Tree<T>where
T: Sync,
impl<T> Unpin for Tree<T>where
T: Unpin,
impl<T> UnwindSafe for Tree<T>where
T: UnwindSafe,
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)