pub struct ObjectWorld { /* private fields */ }Expand description
The scripting-side runtime container. Lives on the MMS worker thread.
Holds the lexical scope chain (a stack of frames) and the MMS-side heap.
Communication with the engine goes through intent channels owned by the
evaluator — ObjectWorld itself never sends intents directly.
See docs/meow_meow/spec/env-heap-object-world.md for the full design and
docs/meow_meow/task/frame-stack-object-world.md for the migration plan.
Implementations§
Source§impl ObjectWorld
impl ObjectWorld
pub fn with_heap(heap: HeapHandle) -> Self
pub fn push_frame(&mut self, kind: FrameKind)
Sourcepub fn push_function_frame(&mut self, captured: Arc<HashMap<String, Value>>)
pub fn push_function_frame(&mut self, captured: Arc<HashMap<String, Value>>)
Push a function frame seeded with the closure’s captured environment. This is a hard barrier: lookups inside the function will not see past it.
pub fn pop_frame(&mut self)
pub fn frame_depth(&self) -> usize
pub fn request_reset(&mut self)
pub fn take_reset_requested(&mut self) -> bool
Sourcepub fn bind(&mut self, name: impl Into<String>, value: Value)
pub fn bind(&mut self, name: impl Into<String>, value: Value)
Bind a name in the top (innermost) frame. Shadows outer bindings.
Sourcepub fn lookup(&self, name: &str) -> Option<&Value>
pub fn lookup(&self, name: &str) -> Option<&Value>
Look up a name. Walks frames from innermost outward; stops at a
Function barrier (function bodies cannot see the caller’s locals).
Sourcepub fn has(&self, name: &str) -> bool
pub fn has(&self, name: &str) -> bool
Whether name is reachable from the current scope (same walk as lookup).
Sourcepub fn reassign(&mut self, name: &str, value: Value) -> Result<(), String>
pub fn reassign(&mut self, name: &str, value: Value) -> Result<(), String>
Reassign an existing binding. Walks frames inward-to-outward looking for
the declaring frame; stops at a Function barrier.
Errors:
- name not declared anywhere reachable
- name declared only beyond the function barrier (caller’s locals)
Sourcepub fn snapshot_visible(&self) -> HashMap<String, Value>
pub fn snapshot_visible(&self) -> HashMap<String, Value>
Flatten all frames visible from the current point into a single map for
closure capture. Walks innermost outward, including the first
Function barrier’s frame (so a closure created inside a function sees
that function’s captured snapshot), then stops. Inner names shadow outer.
pub fn heap(&self) -> &HeapHandle
pub fn alloc_object(&self, object: Object) -> ObjectId
Trait Implementations§
Source§impl Debug for ObjectWorld
impl Debug for ObjectWorld
Auto Trait Implementations§
impl Freeze for ObjectWorld
impl RefUnwindSafe for ObjectWorld
impl Send for ObjectWorld
impl Sync for ObjectWorld
impl Unpin for ObjectWorld
impl UnsafeUnpin for ObjectWorld
impl UnwindSafe for ObjectWorld
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.