pub enum Args {
None,
Char(char),
String(String),
Bytes(Vec<u8>),
List(Vec<ArgValue>),
}Expand description
The concrete argument values carried by a CommandInvocation. See the
module docs for when each shape is used.
§Examples
use lattice_grammar::{ArgKind, ArgValue, Args};
// `fx` -- a motion that takes one char.
let f = Args::Char('x');
assert!(!f.is_none());
assert!(f.as_list().is_none());
// A structured ex-command: positional values in `args_schema` order.
let s = Args::List(vec![
ArgValue::Pattern("foo".into()),
ArgValue::String("bar".into()),
ArgValue::Bool(true),
]);
let list = s.as_list().unwrap();
assert_eq!(list[0].kind(), ArgKind::Pattern);
assert_eq!(list[0].as_str(), Some("foo"));
assert_eq!(list[2].as_bool(), Some(true));
assert!(Args::default().is_none());Variants§
None
No arguments – most motions and operators.
Char(char)
A single char: f<c>, t<c>, r<c>, m<c>, '<c>.
String(String)
A single free-form string (:set <opt>, :e <path>).
Bytes(Vec<u8>)
Opaque plugin-defined payload; see the module docs.
List(Vec<ArgValue>)
Multi-arg form. Values appear in the order declared by the
command’s args_schema.
Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Args
impl<'de> Deserialize<'de> for Args
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Args
Auto Trait Implementations§
impl Freeze for Args
impl RefUnwindSafe for Args
impl Send for Args
impl Sync for Args
impl Unpin for Args
impl UnsafeUnpin for Args
impl UnwindSafe for Args
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