[−][src]Struct gameshell::evaluator::Evaluator
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]
&mut self,
spec: Spec<'_, 'a, Type, String, C>
) -> Result<(), RegError>
Register a handler function for a command.
pub fn register_many(
&mut self,
spec: &[Spec<'_, 'a, Type, String, C>]
) -> Result<(), RegError>
[src]
&mut self,
spec: &[Spec<'_, 'a, Type, String, C>]
) -> Result<(), RegError>
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]
fn evaluate(&mut self, commands: &[Data]) -> Feedback
[src]
fn interpret_single(&mut self, statement: &str) -> Result<T, ParseError>
[src]
fn interpret_multiple(&mut self, code: &str) -> Result<T, ParseError>
[src]
Auto Trait Implementations
impl<'a, C> RefUnwindSafe for Evaluator<'a, C> where
C: RefUnwindSafe,
C: RefUnwindSafe,
impl<'a, C> Send for Evaluator<'a, C> where
C: Send,
C: Send,
impl<'a, C> Sync for Evaluator<'a, C> where
C: Sync,
C: Sync,
impl<'a, C> Unpin for Evaluator<'a, C> where
C: Unpin,
C: Unpin,
impl<'a, C> UnwindSafe for Evaluator<'a, C> where
C: UnwindSafe,
C: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,