[−][src]Struct ogma::vm::Context
Virtual machine context
Fields
globals: BTreeMap<String, Box<dyn Any + 'static>>
The global variables queryable by name
Implementations
impl Context
[src]
pub fn new() -> Context
[src]
Create an empty context
pub fn set_global<K, V>(&mut self, key: K, value: V) where
K: ToString,
V: Any,
[src]
K: ToString,
V: Any,
Set a global variable
pub fn replace_global<K, V, R>(
&mut self,
key: K,
value: V
) -> Result<Option<Box<R>>, Trap> where
K: ToString,
R: Any,
V: Any,
[src]
&mut self,
key: K,
value: V
) -> Result<Option<Box<R>>, Trap> where
K: ToString,
R: Any,
V: Any,
This does the same thing as set_global
but attempts to return the variable which was replaced
pub fn get_global<K, V>(&self, key: K) -> Result<Option<&V>, Trap> where
K: AsRef<str>,
V: Any,
[src]
K: AsRef<str>,
V: Any,
Get a global variable
pub fn get_global_mut<K, V>(&mut self, key: K) -> Result<Option<&mut V>, Trap> where
K: AsRef<str>,
V: Any,
[src]
K: AsRef<str>,
V: Any,
Get a mutable reference to a global variable
pub fn delete_global<K>(&mut self, key: K) where
K: AsRef<str>,
[src]
K: AsRef<str>,
Delete a global variable
pub fn remove_global<K, R>(&mut self, key: K) -> Result<Option<Box<R>>, Trap> where
K: AsRef<str>,
R: Any,
[src]
K: AsRef<str>,
R: Any,
Does the same thing as delete_global
but attempts to return the removed variable
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Context
impl !Send for Context
impl !Sync for Context
impl Unpin for Context
impl !UnwindSafe for Context
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>,