Trait oy::Function[][src]

pub trait Function {
    fn eval(&self, args: &str, f: &mut dyn FnMut(Result<'_, &dyn Debug>));
fn function_name(&self) -> &'static str; }

A trait that allows to interactively evaluate a function and pass its result to the given closure.

This trait gets implemented automatically when you use the Function attribute. See its documentation for more information.

Required methods

fn eval(&self, args: &str, f: &mut dyn FnMut(Result<'_, &dyn Debug>))[src]

Parses the args string into the expected arguments of the method, executes the method and passes the result as a Ok(&dyn Debug) to the given closure.

On error an Err(InteractiveError) is passed to the closure instead.

fn function_name(&self) -> &'static str[src]

Returns the functions name.

Can be used to drive auto-completion in a CLI.

Loading content...

Trait Implementations

impl Collect for &'static dyn Function[src]

Implementors

Loading content...