pub struct Tree {
pub root: Option<NodeIdx>,
/* private fields */
}Expand description
Arena-allocated tree of TreeNodes.
Nodes are stored in a Vec and referenced by their index.
This avoids Rc<RefCell<>> while still allowing safe mutation
during bottom-up merging and top-down embedding phases.
Fields§
§root: Option<NodeIdx>Index of the root node, if the tree has been built.
Implementations§
Source§impl Tree
impl Tree
Sourcepub fn get(&self, idx: NodeIdx) -> &TreeNode
pub fn get(&self, idx: NodeIdx) -> &TreeNode
Returns a shared reference to the node at the given index.
Sourcepub fn get_mut(&mut self, idx: NodeIdx) -> &mut TreeNode
pub fn get_mut(&mut self, idx: NodeIdx) -> &mut TreeNode
Returns a mutable reference to the node at the given index.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Tree
impl RefUnwindSafe for Tree
impl Send for Tree
impl Sync for Tree
impl Unpin for Tree
impl UnsafeUnpin for Tree
impl UnwindSafe for Tree
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