pub struct Env {
pub root: Val,
pub current: Val,
/* private fields */
}Fields§
§root: Val§current: ValImplementations§
Source§impl Env
impl Env
pub fn new_with_registry(root: Val, registry: Arc<MethodRegistry>) -> Self
Sourcepub fn new_with_raw(
root: Val,
registry: Arc<MethodRegistry>,
raw_bytes: Arc<[u8]>,
) -> Self
pub fn new_with_raw( root: Val, registry: Arc<MethodRegistry>, raw_bytes: Arc<[u8]>, ) -> Self
Build an Env that carries the original JSON source bytes so that
SIMD byte-scan can short-circuit deep-descendant queries.
pub fn with_current(&self, current: Val) -> Self
Sourcepub fn swap_current(&mut self, new: Val) -> Val
pub fn swap_current(&mut self, new: Val) -> Val
In-place swap of current — returns previous. Paired with
restore_current this lets hot loops avoid cloning vars/root
per iteration.
pub fn restore_current(&mut self, old: Val)
pub fn get_var(&self, name: &str) -> Option<&Val>
pub fn has_var(&self, name: &str) -> bool
pub fn with_var(&self, name: &str, val: Val) -> Self
Sourcepub fn push_lam(&mut self, name: Option<&str>, val: Val) -> LamFrame
pub fn push_lam(&mut self, name: Option<&str>, val: Val) -> LamFrame
Hot-loop helper: bind name → val and swap current, returning
the previous state. If name was already bound we remember the
previous value; otherwise we remember that the slot was freshly
pushed so pop_lam can truncate it off again.
pub fn pop_lam(&mut self, frame: LamFrame)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Env
impl !RefUnwindSafe for Env
impl Send for Env
impl Sync for Env
impl Unpin for Env
impl UnsafeUnpin for Env
impl !UnwindSafe for Env
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