pub enum Command {
Show 29 variants
Admin,
Authenticate,
Cap,
Info,
Invite,
Join,
Kick,
List,
Lusers,
Mode,
Motd,
Names,
Nick,
Notice,
Oper,
Part,
Pass,
Ping,
Pong,
PrivMsg,
Quit,
TagMsg,
Time,
Topic,
User,
Version,
Who,
Whois,
Reply(Reply),
}
Expand description
The list of commands, generated by commands!
.
Unknown commands and replies are supported by Message
directly, this enum just
contains the supported commands.
Variants§
Admin
Authenticate
Cap
Info
Invite
Join
Kick
List
Lusers
Mode
Motd
Names
Nick
Notice
Oper
Part
Pass
Ping
Pong
PrivMsg
Quit
TagMsg
Time
Topic
User
Version
Who
Whois
Reply(Reply)
Implementations§
Source§impl Command
impl Command
Sourcepub fn parse(s: &str) -> Option<Self>
pub fn parse(s: &str) -> Option<Self>
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("jjoin");
assert_eq!(join, Some(Command::Join));
assert_eq!(join2, Some(Command::Join));
assert_eq!(not_join, None);
Sourcepub fn required_params(&self) -> usize
pub fn required_params(&self) -> usize
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);
Trait Implementations§
impl Copy for Command
impl StructuralPartialEq for Command
Auto Trait Implementations§
impl Freeze for Command
impl RefUnwindSafe for Command
impl Send for Command
impl Sync for Command
impl Unpin for Command
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
Mutably borrows from an owned value. Read more