Skip to main content

JavascriptObjects

Struct JavascriptObjects 

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

Ordinary-object policy composed from PropertyStore and JavascriptHeap.

Implementations§

Source§

impl JavascriptObjects

Source

pub fn new(heap: JavascriptHeap) -> Self

Create an object graph using the supplied shared heap.

Source

pub fn ordinary(&mut self) -> Result<ManagedHandle, JavascriptObjectError>

Allocate an ordinary object or array. Arrays use the same object and descriptor mechanics; only key ordering differs.

Source

pub fn function( &mut self, function: JavascriptFunction, lexical_this: Option<JavascriptValue>, ) -> Result<ManagedHandle, JavascriptObjectError>

Allocate a closure/function object and connect it to its environment.

Source

pub fn call_this( &self, function: ManagedHandle, receiver: JavascriptValue, ) -> Result<JavascriptThis, JavascriptObjectError>

Select ECMAScript this policy without constraining the callable Shape.

Source

pub fn call<T, E>( &self, function: ManagedHandle, receiver: JavascriptValue, arguments: &[JavascriptValue], body: impl FnOnce(ManagedHandle, JavascriptThis, &[JavascriptValue]) -> Result<T, E>, ) -> Result<T, E>

Invoke a codec-lowered body with the captured environment, selected receiver, and call arguments. The caller supplies evaluation, keeping executable behavior in the direct evaluator rather than this policy.

Source

pub fn construct( &mut self, function: ManagedHandle, ) -> Result<ManagedHandle, JavascriptObjectError>

Allocate the receiver for new and link it to the constructor prototype.

Source

pub fn set_prototype( &mut self, object: ManagedHandle, prototype: ManagedHandle, ) -> Result<(), JavascriptObjectError>

Set an ordinary prototype, rejecting cycles.

Source

pub fn define_data( &mut self, object: ManagedHandle, key: JavascriptPropertyKey, value: JavascriptValue, writable: bool, enumerable: bool, configurable: bool, ) -> Result<(), JavascriptObjectError>

Define an ordinary data property.

Source

pub fn define_accessor( &mut self, object: ManagedHandle, key: JavascriptPropertyKey, get: Option<JavascriptValue>, set: bool, enumerable: bool, configurable: bool, ) -> Result<(), JavascriptObjectError>

Define a bounded accessor property.

Source

pub fn get( &self, object: ManagedHandle, key: &JavascriptPropertyKey, budget: usize, ) -> Result<Option<JavascriptValue>, JavascriptObjectError>

Read through the prototype chain with the original receiver.

Source

pub fn set( &mut self, object: ManagedHandle, key: &JavascriptPropertyKey, value: JavascriptValue, budget: usize, ) -> Result<bool, JavascriptObjectError>

Assign through the first descriptor in the prototype chain. Setter hooks retain the original receiver and share the traversal budget.

Source

pub fn delete( &mut self, object: ManagedHandle, key: &JavascriptPropertyKey, ) -> Result<bool, JavascriptObjectError>

Delete an own property, respecting configurability.

Source

pub fn enumerable_keys( &self, object: ManagedHandle, ) -> Vec<JavascriptPropertyKey>

ECMAScript ordinary enumeration order: array-index strings ascending, then other strings in definition order, then symbols. Private names are hidden.

Source

pub fn private_key( &self, class: ManagedHandle, name: &str, ) -> Result<JavascriptPropertyKey, JavascriptObjectError>

Validate a declared private name against an instance’s constructor brand.

Source

pub fn collect(&mut self) -> Result<Option<CollectionReceipt>, CollectionError>

Collect unreachable function/environment/prototype/accessor/array cycles.

Source

pub fn live_len(&self) -> usize

Number of live managed identities.

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.