Skip to main content

Args

Trait Args 

Source
pub trait Args {
    // Required methods
    fn len(&self) -> usize;
    fn get(&mut self, index: usize) -> Result<Value>;
    fn name(&self, index: usize) -> Option<&str>;
    fn set(&mut self, index: usize, value: &Value) -> Result<()>;

    // Provided methods
    fn is_empty(&self) -> bool { ... }
    fn get_named(&mut self, name: &str) -> Option<Result<Value>> { ... }
}
Expand description

Trait for lazy argument evaluation - ZERO ALLOCATION at runtime! Arguments are evaluated only when requested by the callback.

Required Methods§

Source

fn len(&self) -> usize

Number of arguments

Source

fn get(&mut self, index: usize) -> Result<Value>

Get argument value by index (lazy evaluation - NO ALLOCATION)

Source

fn name(&self, index: usize) -> Option<&str>

Get argument name by index (for named arguments)

Source

fn set(&mut self, index: usize, value: &Value) -> Result<()>

Set value at argument path by index. The argument at index must be a path expression. This calls PathAccessor::set on the resolved path.

Provided Methods§

Source

fn is_empty(&self) -> bool

Check if empty

Source

fn get_named(&mut self, name: &str) -> Option<Result<Value>>

Get named argument value (searches by name, lazy evaluation)

Implementors§