pub struct TreeNode {
pub name: String,
pub description: String,
pub path: String,
pub children: Vec<TreeNode>,
}Expand description
Command tree node used by the built-in tree command.
Fields§
§name: StringCommand or group name.
description: StringOne-line command or group description.
path: StringSpace-separated display path, including the root command.
children: Vec<TreeNode>Visible child commands and groups.
Implementations§
Source§impl TreeNode
impl TreeNode
Sourcepub fn new(
name: impl Into<String>,
description: impl Into<String>,
path: impl Into<String>,
) -> Self
pub fn new( name: impl Into<String>, description: impl Into<String>, path: impl Into<String>, ) -> Self
Creates a tree node with no children.
Sourcepub fn with_child(self, child: TreeNode) -> Self
pub fn with_child(self, child: TreeNode) -> Self
Adds one child node.
Sourcepub fn with_children(self, children: impl IntoIterator<Item = TreeNode>) -> Self
pub fn with_children(self, children: impl IntoIterator<Item = TreeNode>) -> Self
Adds several child nodes.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for TreeNode
impl<'de> Deserialize<'de> for TreeNode
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for TreeNode
impl StructuralPartialEq for TreeNode
Auto Trait Implementations§
impl Freeze for TreeNode
impl RefUnwindSafe for TreeNode
impl Send for TreeNode
impl Sync for TreeNode
impl Unpin for TreeNode
impl UnsafeUnpin for TreeNode
impl UnwindSafe for TreeNode
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.