Module dust_lib::tools

source ·
Expand description

Dust’s built-in commands.

When a tool in invoked in Dust, the input is checked against the inputs listed in its ToolInfo. The input should then be double-checked by Tool::check_input when you implement run. The purpose of the second check is to weed out mistakes in how the inputs were described in the ToolInfo. The errors from the second check should only come up during development and should not //! be seen by the user.

Writing macros

  • Snake case identifier, this is enforced by a test
  • The description should be brief, it will display in the shell
  • Recycle code that is already written and tested
  • Write non-trivial tests, do not write tests just for the sake of writing them

Usage

Commands can be used in Rust by passing a Value to the run method.

let value = Value::List(vec![
    Value::Integer(1),
    Value::Integer(2),
    Value::Integer(3),
]);
let count = Count
    .run(&value)
    .unwrap()
    .as_int()
    .unwrap();

assert_eq!(count, 3);

Modules

Structs

  • Information needed for each macro.

Constants

Traits

  • A whale macro function.