pub struct Context { /* private fields */ }Expand description
The variables and methods one evaluation sees.
Variables are plain values — scalars, lists and objects (Value::Map) —
and functions are Value::Functions, registered under the name they are
called by. A function is called with its arguments as f(x), or as a
method with its receiver first, x.f(); a function stored inside an
object is called that way through the object (step1.normalize()), which
is how an injected object carries its own methods.
Implementations§
Source§impl Context
impl Context
pub fn new() -> Context
Sourcepub fn set(
&mut self,
name: impl Into<Arc<str>>,
value: impl Into<Value>,
) -> &mut Context
pub fn set( &mut self, name: impl Into<Arc<str>>, value: impl Into<Value>, ) -> &mut Context
Bind a name, replacing whatever it held. Chainable.
pub fn get(&self, name: &str) -> Option<&Value>
pub fn contains(&self, name: &str) -> bool
pub fn remove(&mut self, name: &str) -> Option<Value>
pub fn clear(&mut self)
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Context
impl !UnwindSafe for Context
impl Forget for Context
impl Freeze for Context
impl Move for Context
impl Send for Context
impl Sync for Context
impl Unpin for Context
impl UnsafeUnpin for Context
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more