pub trait TreeNode: From<Self::Model> {
type Model: Model;
type Id: ?Sized + Eq + Ord + Debug + Clone + Hash;
// Required methods
fn id(&self) -> Self::Id;
fn sequence(&self) -> i32;
fn parent_id(&self) -> Self::Id;
fn children(&self) -> &Vec<NodeRef<Self>> ⓘ;
fn children_mut(&mut self) -> &mut Vec<NodeRef<Self>> ⓘ;
// Provided method
fn sort_children(&mut self) { ... }
}Expand description
A trait for models that can be used as tree nodes.
Required Associated Types§
Required Methods§
Sourcefn children(&self) -> &Vec<NodeRef<Self>> ⓘ
fn children(&self) -> &Vec<NodeRef<Self>> ⓘ
Returns a reference to the vector containing the child references.
Sourcefn children_mut(&mut self) -> &mut Vec<NodeRef<Self>> ⓘ
fn children_mut(&mut self) -> &mut Vec<NodeRef<Self>> ⓘ
Returns a mutable reference to the vector containing the child references.
Provided Methods§
Sourcefn sort_children(&mut self)
fn sort_children(&mut self)
Sort children by position, breaking ties by their stable identifiers.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".