pub trait Condition<S: HasComponent<Component>> {
    const DOC: Option<&'static str> = None;

    // Required method
    fn evaluate(input: &mut ExpansionInput<S>) -> Result<bool, Box<Error>>;

    // Provided method
    fn build_if_command() -> BuiltIn<S> { ... }
}
Expand description

Logical condition used to build if conditional commands.

This trait can be used to build new conditional commands outside of this module. To do this, just create a new type (generally a ZST) and implement the evaluate method of the trait for the type. A conditional command that uses the condition can then be obtained using the build_if_command method.

Provided Associated Constants§

source

const DOC: Option<&'static str> = None

Optional documentation for the command built using this condition.

Required Methods§

source

fn evaluate(input: &mut ExpansionInput<S>) -> Result<bool, Box<Error>>

Evaluate the condition.

Returns true if the condition is true, false if it is false, and an error otherwise.

Provided Methods§

source

fn build_if_command() -> BuiltIn<S>

Build an if conditional command that uses this condition.

Implementors§