Skip to main content

ObjectData

Struct ObjectData 

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

An object: a payload and the prototype that gives it its type. Behind the Rc a Value::Object carries, so an object is one payload word and a clone is one refcount bump.

proto holds exactly what a Value::Module holds — the Module terminal that is the instance — so a prototype is code plus the environment that code runs in, and a method dispatched on an object runs in the same environment M.name would give it. It is also the same handle a Value::Iota’s home is, so an object and an iota answer the nominal question (as <Module>, __proto x) identically.

data is one slot holding any value. Records with named fields are a later feature; a map payload is the v0 idiom for several fields. It is reachable only from the module’s own code, through __value — so a module may change its representation without changing its interface. See docs/done/2026-08-15_elly-objects-v0.md.

Implementations§

Source§

impl ObjectData

Source

pub fn proto(&self) -> Value

The object’s prototype, as the module value it is.

Source

pub fn data(&self) -> &Value

The object’s payload. Public to Rust because a debugger and an embedding host sit outside the language’s module scope; no builtin hands it out, so Elly code cannot reach it except through its own module’s __value.

Trait Implementations§

Source§

impl Debug for ObjectData

Source§

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

Formats the value using the given formatter. Read more

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.