Struct CommandArgument

Source
pub struct CommandArgument {
    pub untrimmed: String,
    pub text: String,
}
Expand description

Argument text following a command name.

Fields§

§untrimmed: String

Original text of the command argument.

§text: String

Argument to the command with leading spaces stripped.

Implementations§

Source§

impl CommandArgument

Source

pub fn filenames<W>(&self) -> Result<Vec<OpenTarget<W>>, CommandError>

Interpret the argument text as a collection of filenames.

This is similar to CommandArgument::strings, but in addition to processing escaped spaces and quoted strings, this will:

These values can be escaped. For example, \# will become OpenTarget::Name("#").

Source

pub fn strings(&self) -> Result<Vec<String>, CommandError>

Interpret the argument text as a collection of strings.

Values containing spaces can either be quoted, or escaped with a backslash. (For example, My\ File.txt or `“My File.txt”)

Source

pub fn options(&self) -> Result<Vec<OptionType>, CommandError>

Interpret the argument text as a series of positional arguments and flags starting with ++.

Source

pub fn range(&self) -> Result<RangeSpec, CommandError>

Interpret the argument text as a range specification.

This can be used to create commands that take a range specification either before or after the command name.

Trait Implementations§

Source§

impl Debug for CommandArgument

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for CommandArgument

Source§

fn eq(&self, other: &CommandArgument) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

const fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for CommandArgument

Source§

impl StructuralPartialEq for CommandArgument

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Any for T
where T: Any,