[−][src]Enum ellidri_tokens::Command
The list of known commands.
Unknown commands and replies are supported by Message
directly, this enum just
contains the supported commands.
Variants
Reply(&'static str)
Methods
impl Command
[src]
pub fn parse(s: &str) -> Option<Self>
[src]
From a given command string, returns the corresponding command, or None
otherwise.
It ignores the case of its argument.
Example
let join = Command::parse("join"); let join2 = Command::parse("JOIN"); let not_join = Command::parse("not_join"); assert_eq!(join, Some(Command::Join)); assert_eq!(join2, Some(Command::Join)); assert_eq!(not_join, None);
pub fn required_params(&self) -> usize
[src]
Returns the number of required arguments for the command.
The command may accept more arguments.
Example
let privmsg = Command::parse("Privmsg").unwrap(); let topic = Command::parse("TOPIC").unwrap(); assert_eq!(privmsg.required_params(), 2); assert_eq!(topic.required_params(), 1);
pub fn as_str(&self) -> &'static str
[src]
Returns the command string. It is not the string that have been parsed.
Example
let quit = Command::parse("Quit").unwrap(); assert_eq!(quit.as_str(), "QUIT");
Trait Implementations
impl Clone for Command
[src]
impl Copy for Command
[src]
impl Debug for Command
[src]
impl Display for Command
[src]
impl From<&'static str> for Command
[src]
fn from(reply: &'static str) -> Self
[src]
&'static str
s are converted to the Command::Reply
variant.
This trait is used by Buffer
to accept both Command
and Reply
when
building messages.
impl PartialEq<Command> for Command
[src]
impl StructuralPartialEq for Command
[src]
Auto Trait Implementations
impl RefUnwindSafe for Command
impl Send for Command
impl Sync for Command
impl Unpin for Command
impl UnwindSafe for Command
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> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
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>,