Struct twilight_command_parser::config::CommandParserConfig [−][src]
pub struct CommandParserConfig<'a> { /* fields omitted */ }
Expand description
Configuration for a Parser
.
Implementations
Returns an iterator of immutable references to the commands.
pub fn commands_mut(&mut self) -> CommandsMut<'_>ⓘNotable traits for CommandsMut<'a>
impl<'a> Iterator for CommandsMut<'a> type Item = (&'a mut str, bool);
[src]
pub fn commands_mut(&mut self) -> CommandsMut<'_>ⓘNotable traits for CommandsMut<'a>
impl<'a> Iterator for CommandsMut<'a> type Item = (&'a mut str, bool);
[src]Returns an iterator of mutable references to the commands.
Use the add_command
and remove_command
methods for an easier way to
manage commands.
Returns an iterator of immutable references to the prefixes.
Use the add_prefix
and remove_prefix
methods for an easier way
to manage prefixes.
pub fn prefixes_mut(&'a mut self) -> PrefixesMut<'a>ⓘNotable traits for PrefixesMut<'a>
impl<'a> Iterator for PrefixesMut<'a> type Item = &'a mut Cow<'a, str>;
[src]
pub fn prefixes_mut(&'a mut self) -> PrefixesMut<'a>ⓘNotable traits for PrefixesMut<'a>
impl<'a> Iterator for PrefixesMut<'a> type Item = &'a mut Cow<'a, str>;
[src]Returns an iterator of mutable references to the prefixes.
Add a command to the list of commands.
Examples
Add a case-sensitive “ping” command:
use twilight_command_parser::CommandParserConfig; let mut config = CommandParserConfig::new(); config.add_command("ping", true); assert_eq!(1, config.commands().len());
Removes a command from the list of commands.
Any commands that would match the command provided are removed.
Examples
use twilight_command_parser::CommandParserConfig; let mut config = CommandParserConfig::new(); config.add_command("ping", true); config.add_command("PING", false); assert_eq!(2, config.commands().len()); // Now remove it and verify that there are no commands. config.remove_command("ping"); assert_eq!(config.commands().len(), 0);
Adds a prefix to the list of prefixes.
Examples
use twilight_command_parser::CommandParserConfig; let mut config = CommandParserConfig::new(); config.add_prefix("!"); assert_eq!(1, config.prefixes().len());
Removes a prefix from the list of prefixes.
Returns whether a prefix with the name was removed.
Examples
use twilight_command_parser::CommandParserConfig; let mut config = CommandParserConfig::new(); config.add_prefix("!"); config.add_prefix("~"); assert_eq!(2, config.prefixes().len()); // Now remove one and verify that there is only 1 prefix. config.remove_prefix("!"); assert_eq!(1, config.prefixes().len());
Trait Implementations
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl<'a> RefUnwindSafe for CommandParserConfig<'a>
impl<'a> Send for CommandParserConfig<'a>
impl<'a> Sync for CommandParserConfig<'a>
impl<'a> Unpin for CommandParserConfig<'a>
impl<'a> UnwindSafe for CommandParserConfig<'a>
Blanket Implementations
Mutably borrows from an owned value. Read more