pub struct Macro {
pub v: u32,
pub name: String,
pub description: String,
pub shortcut: Option<String>,
pub inputs: Vec<NamedInput>,
pub steps: Vec<Step>,
pub output: OutputRule,
pub permissions: Vec<String>,
}Expand description
A recorded or hand-made macro: a list of typed steps that runs as one undo step. Most steps run
a GridCraft command; Repeat, If and Stop add bounded control flow. References in step
parameters can be tokens ("Input.col(2)") that are resolved against the declared inputs when
the macro runs, so a macro recorded on one block of data works on another.
Fields§
§v: u32Format version (MACRO_VERSION).
name: String§description: String§shortcut: Option<String>Keyboard shortcut (Ctrl+Shift+M) for a user interface to offer; the engine only stores it.
inputs: Vec<NamedInput>The ranges the macro works on, checked before it runs.
steps: Vec<Step>§output: OutputRuleWhere results go and what to do when they would land on existing data.
permissions: Vec<String>Commands that need permission (reading or writing files) which the macro may run.
Implementations§
Source§impl Macro
impl Macro
Sourcepub fn step_count(&self) -> usize
pub fn step_count(&self) -> usize
Steps in the macro, counting those inside Repeat and If.
Sourcepub fn check_limits(&self) -> Result<(), String>
pub fn check_limits(&self) -> Result<(), String>
Checks every field a file can set: the format version (check_version); the lengths of
the name, description, shortcut, notes, messages, references and command ids; the counts of
steps (MAX_MACRO_STEPS), inputs, permissions and column types; the nesting depth
(MAX_MACRO_DEPTH); and each input’s declaration. Command parameters are bounded only by
the size of the whole macro, which MAX_MACRO_STEPS and the workbook’s item limit cap.
Every struct is taken apart field by field, so a field added later doesn’t compile here
until someone decides its limit.