Skip to main content

Ctx

Struct Ctx 

Source
pub struct Ctx { /* private fields */ }
Expand description

Evaluation context threaded through the tree-walker: includes the unique-id source for closure identities and the builtin module cache. It does not hold a module registry or loader; imports are resolved before evaluation (crate::load_module), and loaded modules are Rc-held values.

Implementations§

Source§

impl Ctx

Source

pub fn new() -> Self

A context with a fresh id source. Used by crate::eval::eval and crate::eval::apply.

Source

pub fn with_ids(ids: u64) -> Self

A context resuming an id source at ids so identities continue from an earlier context. This is required when a host builds a fresh Ctx per call but shares values between them (e.g., Python bindings). Without this, a module’s reserved id block and subsequent closure IDs could alias, causing __eq to incorrectly identify them as equal. The counter is carried by value to avoid a pointer chase during closure minting.

Source

pub fn ids_used(&self) -> u64

Returns the current id source value to seed a successor context (see with_ids).

Trait Implementations§

Source§

impl Default for Ctx

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Drop for Ctx

Frees the cells iteratively: dropping the list whole would recurse once per cell.

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl !Freeze for Ctx

§

impl !RefUnwindSafe for Ctx

§

impl !Send for Ctx

§

impl !Sync for Ctx

§

impl !UnwindSafe for Ctx

§

impl Unpin for Ctx

§

impl UnsafeUnpin for Ctx

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.