Struct cvar::Action
[−]
[src]
pub struct Action<N, D, F> where
N: Borrow<str>,
D: Borrow<str>,
F: OnInvoke, { /* fields omitted */ }
Action instance.
The N
ame and D
escription 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]
N: Borrow<str>,
D: Borrow<str>,
fn new<F>(name: N, desc: D, f: F) -> Action<N, D, F> where
F: Fn(&mut Context) -> BoxResult<()>,
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]
N: Borrow<str>,
D: Borrow<str>,
F: OnInvoke,
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]
N: Borrow<str>,
D: Borrow<str>,
F: OnInvoke,
fn invoke(&self, ctx: &mut Context) -> Result<(), InnerError>
Invoke the callback associated with the Action.