Skip to main content

ModuleData

Struct ModuleData 

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

A loaded module containing an immutable, name-sorted table of unevaluated item bodies. Built by crate::compile_module and stored in an Rc. Sibling references are compiled to Expr::ModItem and resolved via the home module in the environment (crate::eval_env::EnvNode::Module), ensuring the value heap remains acyclic. See docs/done/2026-08-07_elly-modules-v0.md.

Sibling references use a direct slice index; outside M.name accesses use binary search.

Implementations§

Source§

impl ModuleData

Source

pub fn item_names(&self) -> impl Iterator<Item = &Text>

Sorted list of public item names accessible via outside M.name access.

Source

pub fn local_names(&self) -> Vec<&Text>

Sorted list of names declared with local. Locals are unreachable via M.name from outside; this method is provided for host introspection (e.g., debuggers).

Source

pub fn iota_names(&self) -> &[Text]

Sorted list of names declared with const. Private iotas are unreachable via M.name from outside.

Source

pub fn frame_names(&self) -> &[Text]

Names of frame slots in order. Defines the requirements for instantiate. Empty if no frame exists.

Source

pub fn imports(&self) -> &[ImportSpec]

Import specifications in slot order. Provides a static, auditable record of reachable modules without requiring execution.

Source

pub fn body(&self) -> Option<&Expr>

Returns the module’s body (a recur group’s body or a source’s __main). Evaluated by runners in the instance environment (see crate::eval_main); remains inert during imports.

Source

pub fn name(&self) -> Option<&ModuleName>

The canonical name assigned by the host. Used by __Mod.name and the const stage for instance deduplication. None if unnamed.

Trait Implementations§

Source§

impl Debug for ModuleData

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for ModuleData

Source§

impl PartialEq for ModuleData

Source§

fn eq(&self, other: &ModuleData) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for ModuleData

Auto Trait Implementations§

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.