pub struct CommandEntry<'a> {
pub path: Vec<String>,
pub command: &'a Command,
}Expand description
A command paired with its canonical path from the registry root.
Produced by Registry::iter_all_recursive.
Fields§
§path: Vec<String>Canonical names from root to this command, e.g. ["remote", "add"].
command: &'a CommandThe command at this path.
Implementations§
Source§impl<'a> CommandEntry<'a>
impl<'a> CommandEntry<'a>
Sourcepub fn name(&self) -> &str
pub fn name(&self) -> &str
The canonical name of this command (last element of path).
§Examples
let registry = Registry::new(vec![
Command::builder("remote")
.subcommand(Command::builder("add").build().unwrap())
.build()
.unwrap(),
]);
let entries = registry.iter_all_recursive();
assert_eq!(entries[0].name(), "remote");
assert_eq!(entries[1].name(), "add");Sourcepub fn path_str(&self) -> String
pub fn path_str(&self) -> String
The full dotted path string, e.g. "remote.add".
§Examples
let registry = Registry::new(vec![
Command::builder("remote")
.subcommand(Command::builder("add").build().unwrap())
.build()
.unwrap(),
]);
let entries = registry.iter_all_recursive();
assert_eq!(entries[0].path_str(), "remote");
assert_eq!(entries[1].path_str(), "remote.add");Trait Implementations§
Source§impl<'a> Clone for CommandEntry<'a>
impl<'a> Clone for CommandEntry<'a>
Source§fn clone(&self) -> CommandEntry<'a>
fn clone(&self) -> CommandEntry<'a>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<'a> Freeze for CommandEntry<'a>
impl<'a> !RefUnwindSafe for CommandEntry<'a>
impl<'a> Send for CommandEntry<'a>
impl<'a> Sync for CommandEntry<'a>
impl<'a> Unpin for CommandEntry<'a>
impl<'a> UnsafeUnpin for CommandEntry<'a>
impl<'a> !UnwindSafe for CommandEntry<'a>
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