pub struct Command {
pub name: &'static str,
pub aliases: &'static [&'static str],
pub args: Args,
pub help: &'static str,
pub fronts: &'static [Front],
}Fields§
§name: &'static strThe canonical word, with its slash: /new.
aliases: &'static [&'static str]Other words that run the same command; /resume is also /sessions.
args: ArgsWhether an argument is accepted, and whether the table spells it. See Args.
help: &'static strOne line, no trailing full stop.
fronts: &'static [Front]Every front end that has it, widest first. A list rather than a “both” shorthand: with three
fronts the shorthand would mean “not the web”, which is a reading nobody would guess and a
bug waiting for the next front end. The order is only ever read by
Command::unavailable_in’s sentence — /help and completion walk COMMANDS.
Implementations§
Source§impl Command
impl Command
Sourcepub fn label(&self) -> String
pub fn label(&self) -> String
/set <key> <value>: the name and its argument, as /help and the menu show it. A command
whose arguments are Unshown is just its name — the table does not teach that syntax.
Sourcepub fn spelling(&self, prefix: &str) -> &'static str
pub fn spelling(&self, prefix: &str) -> &'static str
The word to put in the line for someone who has typed prefix: the name, unless only
an alias starts with it — /qu completes to /quit, not to a command they did not type.
Sourcepub fn fill(&self, prefix: &str) -> String
pub fn fill(&self, prefix: &str) -> String
What completing prefix to this command leaves in the line. A command that takes an
argument gets a space after it, so the next key is the argument.
Why this command does nothing in here, for the front end that was asked for it.
Names every front that does have it, because a command can live in two of the three and naming one of them would send a person looking in the wrong place. The “how” half is the nearest way in: what to type after they have read it.
Trait Implementations§
impl Eq for Command
impl StructuralPartialEq for Command
Auto Trait Implementations§
impl Forget for Command
impl Freeze for Command
impl Move for Command
impl RefUnwindSafe for Command
impl Send for Command
impl Sync for Command
impl Unpin for Command
impl UnsafeUnpin for Commandwhere
&'static str: UnsafeUnpin,
&'static [&'static str]: UnsafeUnpin,
&'static [Front]: UnsafeUnpin,
impl UnwindSafe for Command
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
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
key and return true if they are equal.