Trait VariableMap

Source
pub trait VariableMap<'a, T> {
    // Required method
    fn get_variable(&self, name: &str) -> Option<Value<'a, T>>;

    // Provided method
    fn compile_module<Id, G>(
        &self,
        id: Id,
        block: &Block<'a, G>,
    ) -> Result<ExecutableModule<'a, T>, Error<'a>>
       where Id: ModuleId,
             G: Grammar<'a, Lit = T>,
             T: Clone + Debug { ... }
}
Expand description

Encapsulates read access to named variables.

Required Methods§

Source

fn get_variable(&self, name: &str) -> Option<Value<'a, T>>

Returns value of the named variable, or None if it is not defined.

Provided Methods§

Source

fn compile_module<Id, G>( &self, id: Id, block: &Block<'a, G>, ) -> Result<ExecutableModule<'a, T>, Error<'a>>
where Id: ModuleId, G: Grammar<'a, Lit = T>, T: Clone + Debug,

Creates a module based on imports solely from this map.

The default implementation is reasonable for most cases.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<'a, T> VariableMap<'a, T> for Comparisons

Source§

impl<'a, T: Clone> VariableMap<'a, T> for Environment<'a, T>

Source§

impl<'a, T: Clone> VariableMap<'a, T> for ModuleImports<'a, T>

Source§

impl<'a, T: Clone> VariableMap<'a, T> for Prelude

Source§

impl<'a, T: Display> VariableMap<'a, T> for Assertions