[][src]Struct gameshell::evaluator::Evaluator

pub struct Evaluator<'a, C> { /* fields omitted */ }

The virtual machine that runs commands

The virtual machine interprets strings and provides an output. It operates on the strings according to the specified mapping table, which can be manipulated via Evaluator::register and Evaluator::register_many.

Builting commands are autocomplete, which tries to look ahead by 1 query, and ? which lists all possible queries.

Methods

impl<'a, C> Evaluator<'a, C>[src]

pub fn new(context: C) -> Self[src]

Create a new VM which owns a context. The context is used in handler functions and can be mutated.

pub fn set_recursion_limit(&mut self, limit: usize)[src]

Set the recursion limit of nested calls

pub fn context(&self) -> &C[src]

Get a reference to this machine's context

pub fn context_mut(&mut self) -> &mut C[src]

Get a mutable reference to this machine's context

pub fn register(
    &mut self,
    spec: Spec<'_, 'a, Type, String, C>
) -> Result<(), RegError>
[src]

Register a handler function for a command

pub fn register_many(
    &mut self,
    spec: &[Spec<'_, 'a, Type, String, C>]
) -> Result<(), RegError>
[src]

Register an array of handler functions for a command, see Evaluator::register

Trait Implementations

impl<'a, C> Evaluate<Result<String, String>> for Evaluator<'a, C>[src]

Auto Trait Implementations

impl<'a, C> Send for Evaluator<'a, C> where
    C: Send

impl<'a, C> Unpin for Evaluator<'a, C> where
    C: Unpin

impl<'a, C> Sync for Evaluator<'a, C> where
    C: Sync

impl<'a, C> UnwindSafe for Evaluator<'a, C> where
    C: UnwindSafe

impl<'a, C> RefUnwindSafe for Evaluator<'a, C> where
    C: RefUnwindSafe

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]