[−][src]Struct twilight_command_parser::CommandBuilder
A builder struct for building commands.
The add
method needs to be called for the command to be added to the CommandParserConfig
.
Note: Commands are not case sensitive by default. Use case_sensitive
to enable this.
Examples
use twilight_command_parser::CommandParserConfig; let mut config = CommandParserConfig::new(); // Adds a case sensitive command to the config. config.command("ping").case_sensitive().add(); assert_eq!(1, config.commands().len());
Implementations
impl<'a, 'b> CommandBuilder<'a, 'b>
[src]
pub fn add(self)
[src]
Adds the command to the CommandParserConfig
.
pub fn case_sensitive(self) -> Self
[src]
Makes the command only match if the case is the same.
Examples
use twilight_command_parser::{CommandParserConfig, Parser}; let mut config = CommandParserConfig::new(); config.add_prefix("!"); config.command("ping").case_sensitive().add(); let parser = Parser::new(config); assert!(parser.parse("!ping should work").is_some()); assert!(parser.parse("!PiNg shouldn't work").is_none());
pub fn case_insensitive(self) -> Self
[src]
Makes the command match regardless of case. This is set by default.
Examples
use twilight_command_parser::{CommandParserConfig, Parser}; let mut config = CommandParserConfig::new(); config.add_prefix("!"); config.command("ping").case_insensitive().add(); let parser = Parser::new(config); assert!(parser.parse("!ping should work").is_some()); assert!(parser.parse("!PiNg should also work").is_some());
Auto Trait Implementations
impl<'a, 'b> RefUnwindSafe for CommandBuilder<'a, 'b>
impl<'a, 'b> Send for CommandBuilder<'a, 'b>
impl<'a, 'b> Sync for CommandBuilder<'a, 'b>
impl<'a, 'b> Unpin for CommandBuilder<'a, 'b> where
'b: 'a,
'b: 'a,
impl<'a, 'b> !UnwindSafe for CommandBuilder<'a, 'b>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,