Struct twilight_command_parser::config::CommandParserConfig [−][src]
pub struct CommandParserConfig<'a> { /* fields omitted */ }
use interactions via twilight-http
or twilight-gateway
Expand description
Configuration for a Parser
.
Implementations
👎 Deprecated since 0.8.1: use interactions via twilight-http
or twilight-gateway
use interactions via twilight-http
or twilight-gateway
Creates a fresh default configuration with no commands or prefixes.
👎 Deprecated since 0.8.1: use interactions via twilight-http
or twilight-gateway
use interactions via twilight-http
or twilight-gateway
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);
👎 Deprecated since 0.8.1: use interactions via twilight-http
or twilight-gateway
pub fn commands_mut(&mut self) -> CommandsMut<'_>ⓘNotable traits for CommandsMut<'a>impl<'a> Iterator for CommandsMut<'a> type Item = (&'a mut str, bool);
impl<'a> Iterator for CommandsMut<'a> type Item = (&'a mut str, bool);
use interactions via twilight-http
or twilight-gateway
Returns an iterator of mutable references to the commands.
Use the add_command
and remove_command
methods for an easier way to
manage commands.
👎 Deprecated since 0.8.1: use interactions via twilight-http
or twilight-gateway
use interactions via twilight-http
or twilight-gateway
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>;
👎 Deprecated since 0.8.1: use interactions via twilight-http
or twilight-gateway
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>;
impl<'a> Iterator for PrefixesMut<'a> type Item = &'a mut Cow<'a, str>;
use interactions via twilight-http
or twilight-gateway
Returns an iterator of mutable references to the prefixes.
👎 Deprecated since 0.8.1: use interactions via twilight-http
or twilight-gateway
use interactions via twilight-http
or twilight-gateway
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());
👎 Deprecated since 0.8.1: use interactions via twilight-http
or twilight-gateway
use interactions via twilight-http
or twilight-gateway
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);
👎 Deprecated since 0.8.1: use interactions via twilight-http
or twilight-gateway
use interactions via twilight-http
or twilight-gateway
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());
👎 Deprecated since 0.8.1: use interactions via twilight-http
or twilight-gateway
use interactions via twilight-http
or twilight-gateway
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