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§
Sourcefn get_variable(&self, name: &str) -> Option<Value<'a, T>>
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§
Sourcefn compile_module<Id, G>(
&self,
id: Id,
block: &Block<'a, G>,
) -> Result<ExecutableModule<'a, T>, Error<'a>>
fn compile_module<Id, G>( &self, id: Id, block: &Block<'a, G>, ) -> Result<ExecutableModule<'a, T>, Error<'a>>
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.