Struct cvar::Action [] [src]

pub struct Action<N, D, F> where N: Borrow<str>, D: Borrow<str>, F: OnInvoke {
    // some fields omitted
}

Action instance.

The Name and Description types allow abstracting over &'static str, &'a str and String. This supports dynamic cvars while only paying for what you need.

F is the callable type called when the action is invoked.

Methods

impl<N, D> Action<N, D, Pass> where N: Borrow<str>, D: Borrow<str>
[src]

fn new<F>(name: N, desc: D, f: F) -> Action<N, D, F> where F: Fn(&mut Context) -> BoxResult<()>

Creates a new Action.

Given a name, description and a callback to be invoked.

Trait Implementations

impl<N, D, F> INode for Action<N, D, F> where N: Borrow<str>, D: Borrow<str>, F: OnInvoke
[src]

fn name(&self) -> &str

Returns the node name.

fn description(&self) -> &str

Returns the node description.

impl<N, D, F> IAction for Action<N, D, F> where N: Borrow<str>, D: Borrow<str>, F: OnInvoke
[src]

fn invoke(&self, ctx: &mut Context) -> Result<()InnerError>

Invoke the callback associated with the Action.