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
impl CommandArgument
sourcepub fn filenames<W>(&self) -> Result<Vec<OpenTarget<W>>, CommandError>where
W: ApplicationWindowId,
pub fn filenames<W>(&self) -> Result<Vec<OpenTarget<W>>, CommandError>where
W: ApplicationWindowId,
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:
- turn lone
#
characters into OpenTarget::Alternate - turn lone
%
characters into OpenTarget::Current
These values can be escaped. For example, \#
will become OpenTarget::Name("#")
.
sourcepub fn strings(&self) -> Result<Vec<String>, CommandError>
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”)
sourcepub fn options(&self) -> Result<Vec<OptionType>, CommandError>
pub fn options(&self) -> Result<Vec<OptionType>, CommandError>
Interpret the argument text as a series of positional arguments and flags starting with
++
.
sourcepub fn range(&self) -> Result<RangeSpec, CommandError>
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
impl Debug for CommandArgument
source§impl PartialEq for CommandArgument
impl PartialEq for CommandArgument
source§fn eq(&self, other: &CommandArgument) -> bool
fn eq(&self, other: &CommandArgument) -> bool
self
and other
values to be equal, and is used
by ==
.impl Eq for CommandArgument
impl StructuralPartialEq for CommandArgument
Auto Trait Implementations§
impl Freeze for CommandArgument
impl RefUnwindSafe for CommandArgument
impl Send for CommandArgument
impl Sync for CommandArgument
impl Unpin for CommandArgument
impl UnwindSafe for CommandArgument
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
source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.