pub struct JavascriptObjects { /* private fields */ }Expand description
Ordinary-object policy composed from PropertyStore and JavascriptHeap.
Implementations§
Source§impl JavascriptObjects
impl JavascriptObjects
Sourcepub fn new(heap: JavascriptHeap) -> Self
pub fn new(heap: JavascriptHeap) -> Self
Create an object graph using the supplied shared heap.
Sourcepub fn ordinary(&mut self) -> Result<ManagedHandle, JavascriptObjectError>
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.
Sourcepub fn function(
&mut self,
function: JavascriptFunction,
lexical_this: Option<JavascriptValue>,
) -> Result<ManagedHandle, JavascriptObjectError>
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.
Sourcepub fn call_this(
&self,
function: ManagedHandle,
receiver: JavascriptValue,
) -> Result<JavascriptThis, JavascriptObjectError>
pub fn call_this( &self, function: ManagedHandle, receiver: JavascriptValue, ) -> Result<JavascriptThis, JavascriptObjectError>
Select ECMAScript this policy without constraining the callable Shape.
Sourcepub fn call<T, E>(
&self,
function: ManagedHandle,
receiver: JavascriptValue,
arguments: &[JavascriptValue],
body: impl FnOnce(ManagedHandle, JavascriptThis, &[JavascriptValue]) -> Result<T, E>,
) -> Result<T, E>where
E: From<JavascriptObjectError>,
pub fn call<T, E>(
&self,
function: ManagedHandle,
receiver: JavascriptValue,
arguments: &[JavascriptValue],
body: impl FnOnce(ManagedHandle, JavascriptThis, &[JavascriptValue]) -> Result<T, E>,
) -> Result<T, E>where
E: From<JavascriptObjectError>,
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.
Sourcepub fn construct(
&mut self,
function: ManagedHandle,
) -> Result<ManagedHandle, JavascriptObjectError>
pub fn construct( &mut self, function: ManagedHandle, ) -> Result<ManagedHandle, JavascriptObjectError>
Allocate the receiver for new and link it to the constructor prototype.
Sourcepub fn set_prototype(
&mut self,
object: ManagedHandle,
prototype: ManagedHandle,
) -> Result<(), JavascriptObjectError>
pub fn set_prototype( &mut self, object: ManagedHandle, prototype: ManagedHandle, ) -> Result<(), JavascriptObjectError>
Set an ordinary prototype, rejecting cycles.
Sourcepub fn define_data(
&mut self,
object: ManagedHandle,
key: JavascriptPropertyKey,
value: JavascriptValue,
writable: bool,
enumerable: bool,
configurable: bool,
) -> Result<(), JavascriptObjectError>
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.
Sourcepub fn define_accessor(
&mut self,
object: ManagedHandle,
key: JavascriptPropertyKey,
get: Option<JavascriptValue>,
set: bool,
enumerable: bool,
configurable: bool,
) -> Result<(), JavascriptObjectError>
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.
Sourcepub fn get(
&self,
object: ManagedHandle,
key: &JavascriptPropertyKey,
budget: usize,
) -> Result<Option<JavascriptValue>, JavascriptObjectError>
pub fn get( &self, object: ManagedHandle, key: &JavascriptPropertyKey, budget: usize, ) -> Result<Option<JavascriptValue>, JavascriptObjectError>
Read through the prototype chain with the original receiver.
Sourcepub fn set(
&mut self,
object: ManagedHandle,
key: &JavascriptPropertyKey,
value: JavascriptValue,
budget: usize,
) -> Result<bool, JavascriptObjectError>
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.
Sourcepub fn delete(
&mut self,
object: ManagedHandle,
key: &JavascriptPropertyKey,
) -> Result<bool, JavascriptObjectError>
pub fn delete( &mut self, object: ManagedHandle, key: &JavascriptPropertyKey, ) -> Result<bool, JavascriptObjectError>
Delete an own property, respecting configurability.
Sourcepub fn enumerable_keys(
&self,
object: ManagedHandle,
) -> Vec<JavascriptPropertyKey>
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.
Sourcepub fn private_key(
&self,
class: ManagedHandle,
name: &str,
) -> Result<JavascriptPropertyKey, JavascriptObjectError>
pub fn private_key( &self, class: ManagedHandle, name: &str, ) -> Result<JavascriptPropertyKey, JavascriptObjectError>
Validate a declared private name against an instance’s constructor brand.
Sourcepub fn collect(&mut self) -> Result<Option<CollectionReceipt>, CollectionError>
pub fn collect(&mut self) -> Result<Option<CollectionReceipt>, CollectionError>
Collect unreachable function/environment/prototype/accessor/array cycles.