[][src]Struct boa::object::GcObject

pub struct GcObject(_);

Garbage collected Object.

Implementations

impl GcObject[src]

pub fn new(object: Object) -> Self[src]

Create a new GcObject from a Object.

pub fn borrow(&self) -> Ref<'_, Object>[src]

Immutably borrows the Object.

The borrow lasts until the returned Ref exits scope. Multiple immutable borrows can be taken out at the same time.

Panics

Panics if the object is currently mutably borrowed.

pub fn borrow_mut(&self) -> RefMut<'_, Object>[src]

Mutably borrows the Object.

The borrow lasts until the returned RefMut exits scope. The object cannot be borrowed while this borrow is active.

Panics

Panics if the object is currently borrowed.

pub fn try_borrow(&self) -> StdResult<Ref<'_, Object>, BorrowError>[src]

Immutably borrows the Object, returning an error if the value is currently mutably borrowed.

The borrow lasts until the returned GcCellRef exits scope. Multiple immutable borrows can be taken out at the same time.

This is the non-panicking variant of borrow.

pub fn try_borrow_mut(&self) -> StdResult<RefMut<'_, Object>, BorrowMutError>[src]

Mutably borrows the object, returning an error if the value is currently borrowed.

The borrow lasts until the returned GcCellRefMut exits scope. The object be borrowed while this borrow is active.

This is the non-panicking variant of borrow_mut.

pub fn equals(lhs: &Self, rhs: &Self) -> bool[src]

Checks if the garbage collected memory is the same.

pub fn call(
    &self,
    this: &Value,
    args: &[Value],
    context: &mut Context
) -> Result<Value>
[src]

Call this object.

Panics

Panics if the object is currently mutably borrowed.

pub fn construct(
    &self,
    args: &[Value],
    new_target: Value,
    context: &mut Context
) -> Result<Value>
[src]

Construct an instance of this object with the specified arguments.

Panics

Panics if the object is currently mutably borrowed.

pub fn to_property_descriptor(
    &self,
    context: &mut Context
) -> Result<PropertyDescriptor>
[src]

Convert the object to a PropertyDescritptor

Panics

Panics if the object is currently mutably borrowed.

pub fn is<T>(&self) -> bool where
    T: NativeObject
[src]

Reeturn true if it is a native object and the native type is T.

Panics

Panics if the object is currently mutably borrowed.

pub fn downcast_ref<T>(&self) -> Option<Ref<'_, T>> where
    T: NativeObject
[src]

Downcast a reference to the object, if the object is type native object type T.

Panics

Panics if the object is currently mutably borrowed.

pub fn downcast_mut<T>(&mut self) -> Option<RefMut<'_, T>> where
    T: NativeObject
[src]

Downcast a mutable reference to the object, if the object is type native object type T.

Panics

Panics if the object is currently borrowed.

pub fn prototype_instance(&self) -> Value[src]

Get the prototype of the object.

Panics

Panics if the object is currently mutably borrowed.

pub fn set_prototype_instance(&mut self, prototype: Value) -> bool[src]

Set the prototype of the object.

Panics

Panics if the object is currently mutably borrowed or if th prototype is not an object or undefined.

pub fn is_array(&self) -> bool[src]

Checks if it an Array object.

Panics

Panics if the object is currently mutably borrowed.

pub fn is_array_iterator(&self) -> bool[src]

Checks if it is an ArrayIterator object.

Panics

Panics if the object is currently mutably borrowed.

pub fn is_map(&self) -> bool[src]

Checks if it is a Map object.pub

Panics

Panics if the object is currently mutably borrowed.

pub fn is_string(&self) -> bool[src]

Checks if it a String object.

Panics

Panics if the object is currently mutably borrowed.

pub fn is_function(&self) -> bool[src]

Checks if it a Function object.

Panics

Panics if the object is currently mutably borrowed.

pub fn is_symbol(&self) -> bool[src]

Checks if it a Symbol object.

Panics

Panics if the object is currently mutably borrowed.

pub fn is_error(&self) -> bool[src]

Checks if it an Error object.

Panics

Panics if the object is currently mutably borrowed.

pub fn is_boolean(&self) -> bool[src]

Checks if it a Boolean object.

Panics

Panics if the object is currently mutably borrowed.

pub fn is_number(&self) -> bool[src]

Checks if it a Number object.

Panics

Panics if the object is currently mutably borrowed.

pub fn is_bigint(&self) -> bool[src]

Checks if it a BigInt object.

Panics

Panics if the object is currently mutably borrowed.

pub fn is_regexp(&self) -> bool[src]

Checks if it a RegExp object.

Panics

Panics if the object is currently mutably borrowed.

pub fn is_ordinary(&self) -> bool[src]

Checks if it an ordinary object.

Panics

Panics if the object is currently mutably borrowed.

pub fn is_native_object(&self) -> bool[src]

Returns true if it holds an Rust type that implements NativeObject.

Panics

Panics if the object is currently mutably borrowed.

pub fn get_method<K>(
    &self,
    context: &mut Context,
    key: K
) -> Result<Option<GcObject>> where
    K: Into<PropertyKey>, 
[src]

Retrieves value of specific property, when the value of the property is expected to be a function.

More information:

pub fn has_own_property<K>(&self, key: K) -> bool where
    K: Into<PropertyKey>, 
[src]

impl GcObject[src]

pub fn has_property(&self, key: &PropertyKey) -> bool[src]

Check if object has property.

More information:

pub fn is_extensible(&self) -> bool[src]

Check if it is extensible.

More information:

pub fn prevent_extensions(&mut self) -> bool[src]

Disable extensibility.

More information:

pub fn delete(&mut self, key: &PropertyKey) -> bool[src]

Delete property.

pub fn get(
    &self,
    key: &PropertyKey,
    receiver: Value,
    context: &mut Context
) -> Result<Value>
[src]

pub fn set(
    &mut self,
    key: PropertyKey,
    val: Value,
    receiver: Value,
    context: &mut Context
) -> Result<bool>
[src]

pub fn define_own_property<K>(
    &mut self,
    key: K,
    desc: PropertyDescriptor,
    context: &mut Context
) -> Result<bool> where
    K: Into<PropertyKey>, 
[src]

Define an own property.

More information:

pub fn ordinary_define_own_property<K>(
    &mut self,
    key: K,
    desc: PropertyDescriptor
) -> bool where
    K: Into<PropertyKey>, 
[src]

Define an own property for an ordinary object.

More information:

pub fn get_own_property(&self, key: &PropertyKey) -> Option<PropertyDescriptor>[src]

The specification returns a Property Descriptor or Undefined.

These are 2 separate types and we can't do that here.

More information:

pub fn own_property_keys(&self) -> Vec<PropertyKey>[src]

Essential internal method OwnPropertyKeys

More information:

pub fn define_properties(
    &mut self,
    props: Value,
    context: &mut Context
) -> Result<()>
[src]

The abstract operation ObjectDefineProperties

More information:

pub fn set_prototype_of(&mut self, val: Value) -> bool[src]

Object.setPropertyOf(obj, prototype)

This method sets the prototype (i.e., the internal [[Prototype]] property) of a specified object to another object or null.

More information:

pub fn get_prototype_of(&self) -> Value[src]

Returns either the prototype or null

More information:

pub fn is_callable(&self) -> bool[src]

It determines if Object is a callable function with a [[Call]] internal method.

More information:

pub fn is_constructable(&self) -> bool[src]

It determines if Object is a function object with a [[Construct]] internal method.

More information:

pub fn is_global(&self) -> bool[src]

Returns true if the GcObject is the global for a Realm

Trait Implementations

impl AsRef<GcCell<Object>> for GcObject[src]

impl Clone for GcObject[src]

impl Debug for GcObject[src]

impl Default for GcObject[src]

impl Drop for GcObject[src]

impl Finalize for GcObject[src]

impl From<GcObject> for Value[src]

impl Trace for GcObject[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> NativeObject for T where
    T: Any + Debug + Trace
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,