pub struct Node<BackendT, ContextT, ErrorT, IdT, DataT> {
pub depth: usize,
pub kind: NodeKind,
pub id: IdT,
pub representation: Representation,
pub representation_size: XY<usize>,
pub branch_state: BranchState,
pub children: Option<NodeList<BackendT, ContextT, ErrorT, IdT, DataT>>,
pub data: Option<DataT>,
/* private fields */
}Expand description
Tree node.
Fields§
§depth: usizeDepth.
kind: NodeKindKind.
id: IdTID.
representation: RepresentationRepresentation.
representation_size: XY<usize>Representation size.
Cached so we only have to calculate it once.
branch_state: BranchStateState for Branch node.
children: Option<NodeList<BackendT, ContextT, ErrorT, IdT, DataT>>Children for Branch node.
data: Option<DataT>Data.
Implementations§
Source§impl<BackendT, ContextT, ErrorT, IdT, DataT> Node<BackendT, ContextT, ErrorT, IdT, DataT>where
BackendT: TreeBackend<ContextT, ErrorT, IdT, DataT>,
impl<BackendT, ContextT, ErrorT, IdT, DataT> Node<BackendT, ContextT, ErrorT, IdT, DataT>where
BackendT: TreeBackend<ContextT, ErrorT, IdT, DataT>,
Sourcepub fn new(
depth: usize,
kind: NodeKind,
id: IdT,
representation: Representation,
) -> Self
pub fn new( depth: usize, kind: NodeKind, id: IdT, representation: Representation, ) -> Self
Constructor.
Sourcepub fn at_path_mut(&mut self, path: NodePath) -> Option<&mut Self>
pub fn at_path_mut(&mut self, path: NodePath) -> Option<&mut Self>
Get node at path.
Sourcepub fn fill_path(&self, path: &mut NodePath, node: &Self) -> bool
pub fn fill_path(&self, path: &mut NodePath, node: &Self) -> bool
Fill path to node.
Returns true if found.
Sourcepub fn populate(
&mut self,
depth: Option<usize>,
context: ContextT,
) -> Result<(), ErrorT>where
ContextT: Clone,
pub fn populate(
&mut self,
depth: Option<usize>,
context: ContextT,
) -> Result<(), ErrorT>where
ContextT: Clone,
Sourcepub fn add_child(
&mut self,
kind: NodeKind,
id: IdT,
representation: Representation,
)
pub fn add_child( &mut self, kind: NodeKind, id: IdT, representation: Representation, )
Add a child node.
Sourcepub fn insert_child(
&mut self,
index: usize,
kind: NodeKind,
id: IdT,
representation: Representation,
)
pub fn insert_child( &mut self, index: usize, kind: NodeKind, id: IdT, representation: Representation, )
Inserts a child node.
Sourcepub fn expand_branch(&mut self, context: ContextT) -> Result<bool, ErrorT>where
ContextT: Clone,
pub fn expand_branch(&mut self, context: ContextT) -> Result<bool, ErrorT>where
ContextT: Clone,
Expand the branch.
Will return false if not a Branch or already expanded.
Sourcepub fn collapse_branch(&mut self) -> bool
pub fn collapse_branch(&mut self) -> bool
Collapse the branch.
Will return false if not a Branch or already collapsed.
Trait Implementations§
Source§impl<BackendT, ContextT, ErrorT, IdT, DataT> FromIterator<Node<BackendT, ContextT, ErrorT, IdT, DataT>> for NodeList<BackendT, ContextT, ErrorT, IdT, DataT>
impl<BackendT, ContextT, ErrorT, IdT, DataT> FromIterator<Node<BackendT, ContextT, ErrorT, IdT, DataT>> for NodeList<BackendT, ContextT, ErrorT, IdT, DataT>
Auto Trait Implementations§
impl<BackendT, ContextT, ErrorT, IdT, DataT> Freeze for Node<BackendT, ContextT, ErrorT, IdT, DataT>
impl<BackendT, ContextT, ErrorT, IdT, DataT> RefUnwindSafe for Node<BackendT, ContextT, ErrorT, IdT, DataT>where
IdT: RefUnwindSafe,
DataT: RefUnwindSafe,
BackendT: RefUnwindSafe,
ContextT: RefUnwindSafe,
ErrorT: RefUnwindSafe,
impl<BackendT, ContextT, ErrorT, IdT, DataT> Send for Node<BackendT, ContextT, ErrorT, IdT, DataT>
impl<BackendT, ContextT, ErrorT, IdT, DataT> Sync for Node<BackendT, ContextT, ErrorT, IdT, DataT>
impl<BackendT, ContextT, ErrorT, IdT, DataT> Unpin for Node<BackendT, ContextT, ErrorT, IdT, DataT>
impl<BackendT, ContextT, ErrorT, IdT, DataT> UnsafeUnpin for Node<BackendT, ContextT, ErrorT, IdT, DataT>where
IdT: UnsafeUnpin,
DataT: UnsafeUnpin,
impl<BackendT, ContextT, ErrorT, IdT, DataT> UnwindSafe for Node<BackendT, ContextT, ErrorT, IdT, DataT>where
IdT: UnwindSafe,
DataT: UnwindSafe,
BackendT: UnwindSafe,
ContextT: UnwindSafe,
ErrorT: 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