[][src]Struct comma::Command

pub struct Command {
    pub name: String,
    pub arguments: Vec<String>,
}

Contains the result of a parsed command. See [Command::from_str] documentation for details on available command syntax.

Fields

name: String

The name of the command being run (i.e. the first argument)

arguments: Vec<String>

All arguments being passed

Trait Implementations

impl Clone for Command[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for Command[src]

impl FromStr for Command[src]

type Err = EmptyCommandError

The associated error which can be returned from parsing.

fn from_str(s: &str) -> Result<Self, Self::Err>[src]

Parse a command from the commandline. Commands consist of separate 'tokens' separated by whitespace.

Multiple whitespace characters are permitted between tokens, including at the beginning and end of the command string. All extra whitespace is stripped unless explicitly escaped using quotation marks or backslash escaping.

Preceding a character with a backslash (\) will cause any special meaning for the character to be ignored. To convey a real backslash in a command it must be prefixed with another backslash, such as: (\\).

Quotation marks surrounding a portion of text will also cause the text to be included verbatim, including whitespace. However, backslashes retain their special meaning, to allow for escaped quotes (\") inside a quoted string.

from_str will only fail if zero tokens are provided (i.e. there is no command name). In this case it will provide an EmptyCommandError.

Auto Trait Implementations

impl Sync for Command

impl Send for Command

impl Unpin for Command

impl RefUnwindSafe for Command

impl UnwindSafe for Command

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]