pub struct Tree { /* private fields */ }Expand description
The arena holding one document’s nodes, with the document at
Tree::root.
Implementations§
Source§impl Tree
impl Tree
Sourcepub fn new(root_type: NodeType) -> Self
pub fn new(root_type: NodeType) -> Self
A tree holding only a fresh node of root_type, which becomes the
root.
Sourcepub fn add(&mut self, node: MdNode) -> NodeId
pub fn add(&mut self, node: MdNode) -> NodeId
Add an unlinked node to the arena and return its id.
Sourcepub fn new_node(&mut self, node_type: NodeType) -> NodeId
pub fn new_node(&mut self, node_type: NodeType) -> NodeId
Add an open, unlinked node of node_type.
pub fn get(&self, id: NodeId) -> &MdNode
pub fn get_mut(&mut self, id: NodeId) -> &mut MdNode
pub fn is_empty(&self) -> bool
Sourcepub fn append_child(&mut self, parent: NodeId, child: NodeId)
pub fn append_child(&mut self, parent: NodeId, child: NodeId)
Add child as the last child of parent, detaching it first.
Sourcepub fn prepend_child(&mut self, parent: NodeId, child: NodeId)
pub fn prepend_child(&mut self, parent: NodeId, child: NodeId)
Add child as the first child of parent, detaching it first.
Sourcepub fn insert_after(&mut self, node: NodeId, sibling: NodeId)
pub fn insert_after(&mut self, node: NodeId, sibling: NodeId)
Place sibling directly after node.
Sourcepub fn insert_before(&mut self, node: NodeId, sibling: NodeId)
pub fn insert_before(&mut self, node: NodeId, sibling: NodeId)
Place sibling directly before node.
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