#[non_exhaustive]pub struct Macro {
pub input: Cow<'static, str>,
pub arguments: Option<usize>,
}Expand description
A struct representing a runnable macro
It is intended to add more/change the variables, but the constructors should produce instances with the same behaviour through any change.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.input: Cow<'static, str>Input to simulate
Should be a string of newline separated commands. Execution is equivalent to if this input was given on STDIN while the editor is running.
arguments: Option<usize>The number of arguments the macro accepts
None means there is no specific number, disabling validation of correct nr of given arguments before execution.
Implementations§
source§impl Macro
impl Macro
sourcepub fn new<T: Into<Cow<'static, str>>>(input: T, arguments: usize) -> Self
pub fn new<T: Into<Cow<'static, str>>>(input: T, arguments: usize) -> Self
Construct a macro
Creates a macro with the given text as command input and the given nr of allowed arguments
sourcepub fn without_arg_validation<T: Into<Cow<'static, str>>>(input: T) -> Self
pub fn without_arg_validation<T: Into<Cow<'static, str>>>(input: T) -> Self
Construct a macro that takes any number of commands
Creates a macro with the given text as command input and disables validation of nr of arguments to the macro. This is intended for macros using the “all arguments” substitutor instead of numbered argument substitutors.