Skip to main content

Command

Trait Command 

Source
pub trait Command: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn execute(&self, aaml: &mut AAML, args: &str) -> Result<(), AamlError>;
}
Expand description

Trait implemented by every AAML directive handler.

Commands are registered by name and invoked automatically when @<name> <args> is encountered during parsing.

Required Methods§

Source

fn name(&self) -> &str

The directive name without the leading @ (e.g. "import", "schema").

Source

fn execute(&self, aaml: &mut AAML, args: &str) -> Result<(), AamlError>

Executes the directive with the given argument string.

args contains everything after the directive name on the same line, with leading whitespace preserved.

§Errors

Returns an error if the directive is malformed, references are invalid, or execution would violate schema constraints or circular dependency rules.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§