[][src]Struct boa::object::Object

pub struct Object {
    pub data: ObjectData,
    // some fields omitted
}

The internal representation of an JavaScript object.

Fields

data: ObjectData

The type of the object.

Implementations

impl Object[src]

pub fn has_property(&self, property_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, property_key: &PropertyKey) -> bool[src]

Delete property.

pub fn get(&self, property_key: &PropertyKey) -> Value[src]

[[Get]] https://tc39.es/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots-get-p-receiver

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

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

Define an own property.

More information:

pub fn get_own_property(&self, key: &PropertyKey) -> Property[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 get_prototype_of(&self) -> Value[src]

Returns either the prototype or null

More information:

impl Object[src]

pub fn iter(&self) -> Iter<'_>

Notable traits for Iter<'a>

impl<'a> Iterator for Iter<'a> type Item = (PropertyKey, &'a Property);
[src]

An iterator visiting all key-value pairs in arbitrary order. The iterator element type is (PropertyKey, &'a Property).

This iterator does not recurse down the prototype chain.

pub fn keys(&self) -> Keys<'_>

Notable traits for Keys<'a>

impl<'a> Iterator for Keys<'a> type Item = PropertyKey;
[src]

An iterator visiting all keys in arbitrary order. The iterator element type is PropertyKey.

This iterator does not recurse down the prototype chain.

pub fn values(&self) -> Values<'_>

Notable traits for Values<'a>

impl<'a> Iterator for Values<'a> type Item = &'a Property;
[src]

An iterator visiting all values in arbitrary order. The iterator element type is &'a Property.

This iterator does not recurse down the prototype chain.

pub fn symbol_properties(&self) -> SymbolProperties<'_>

Notable traits for SymbolProperties<'a>

impl<'a> Iterator for SymbolProperties<'a> type Item = (&'a RcSymbol, &'a Property);
[src]

An iterator visiting all symbol key-value pairs in arbitrary order. The iterator element type is (&'a RcSymbol, &'a Property).

This iterator does not recurse down the prototype chain.

pub fn symbol_property_keys(&self) -> SymbolPropertyKeys<'_>

Notable traits for SymbolPropertyKeys<'a>

impl<'a> Iterator for SymbolPropertyKeys<'a> type Item = &'a RcSymbol;
[src]

An iterator visiting all symbol keys in arbitrary order. The iterator element type is &'a RcSymbol.

This iterator does not recurse down the prototype chain.

pub fn symbol_property_values(&self) -> SymbolPropertyValues<'_>

Notable traits for SymbolPropertyValues<'a>

impl<'a> Iterator for SymbolPropertyValues<'a> type Item = &'a Property;
[src]

An iterator visiting all symbol values in arbitrary order. The iterator element type is &'a Property.

This iterator does not recurse down the prototype chain.

pub fn index_properties(&self) -> IndexProperties<'_>

Notable traits for IndexProperties<'a>

impl<'a> Iterator for IndexProperties<'a> type Item = (&'a u32, &'a Property);
[src]

An iterator visiting all indexed key-value pairs in arbitrary order. The iterator element type is (&'a u32, &'a Property).

This iterator does not recurse down the prototype chain.

pub fn index_property_keys(&self) -> IndexPropertyKeys<'_>

Notable traits for IndexPropertyKeys<'a>

impl<'a> Iterator for IndexPropertyKeys<'a> type Item = &'a u32;
[src]

An iterator visiting all index keys in arbitrary order. The iterator element type is &'a u32.

This iterator does not recurse down the prototype chain.

pub fn index_property_values(&self) -> IndexPropertyValues<'_>

Notable traits for IndexPropertyValues<'a>

impl<'a> Iterator for IndexPropertyValues<'a> type Item = &'a Property;
[src]

An iterator visiting all index values in arbitrary order. The iterator element type is &'a Property.

This iterator does not recurse down the prototype chain.

pub fn string_properties(&self) -> StringProperties<'_>

Notable traits for StringProperties<'a>

impl<'a> Iterator for StringProperties<'a> type Item = (&'a RcString, &'a Property);
[src]

An iterator visiting all string key-value pairs in arbitrary order. The iterator element type is (&'a RcString, &'a Property).

This iterator does not recurse down the prototype chain.

pub fn string_property_keys(&self) -> StringPropertyKeys<'_>

Notable traits for StringPropertyKeys<'a>

impl<'a> Iterator for StringPropertyKeys<'a> type Item = &'a RcString;
[src]

An iterator visiting all string keys in arbitrary order. The iterator element type is &'a RcString.

This iterator does not recurse down the prototype chain.

pub fn string_property_values(&self) -> StringPropertyValues<'_>

Notable traits for StringPropertyValues<'a>

impl<'a> Iterator for StringPropertyValues<'a> type Item = &'a Property;
[src]

An iterator visiting all string values in arbitrary order. The iterator element type is &'a Property.

This iterator does not recurse down the prototype chain.

impl Object[src]

pub fn new() -> Self[src]

pub fn function(function: Function, prototype: Value) -> Self[src]

Return a new ObjectData struct, with kind set to Ordinary

pub fn create(proto: Value) -> Self[src]

ObjectCreate is used to specify the runtime creation of new ordinary objects.

More information:

pub fn boolean(value: bool) -> Self[src]

Return a new Boolean object whose [[BooleanData]] internal slot is set to argument.

pub fn number(value: f64) -> Self[src]

Return a new Number object whose [[NumberData]] internal slot is set to argument.

pub fn string<S>(value: S) -> Self where
    S: Into<RcString>, 
[src]

Return a new String object whose [[StringData]] internal slot is set to argument.

pub fn bigint(value: RcBigInt) -> Self[src]

Return a new BigInt object whose [[BigIntData]] internal slot is set to argument.

pub fn native_object<T>(value: T) -> Self where
    T: NativeObject
[src]

Create a new native object of type T.

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_array(&self) -> bool[src]

Checks if it an Array object.

pub fn as_array(&self) -> Option<()>[src]

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

Checks if it is a Map object.pub

pub fn as_map_ref(&self) -> Option<&OrderedMap<Value, Value>>[src]

pub fn as_map_mut(&mut self) -> Option<&mut OrderedMap<Value, Value>>[src]

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

Checks if it a String object.

pub fn as_string(&self) -> Option<RcString>[src]

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

Checks if it a Function object.

pub fn as_function(&self) -> Option<&Function>[src]

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

Checks if it a Symbol object.

pub fn as_symbol(&self) -> Option<RcSymbol>[src]

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

Checks if it an Error object.

pub fn as_error(&self) -> Option<()>[src]

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

Checks if it a Boolean object.

pub fn as_boolean(&self) -> Option<bool>[src]

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

Checks if it a Number object.

pub fn as_number(&self) -> Option<f64>[src]

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

Checks if it a BigInt object.

pub fn as_bigint(&self) -> Option<&BigInt>[src]

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

Checks if it a RegExp object.

pub fn as_regexp(&self) -> Option<&RegExp>[src]

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

Checks if it an ordinary object.

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

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

pub fn with_prototype(proto: Value, data: ObjectData) -> Object[src]

Similar to Value::new_object, but you can pass a prototype to create from, plus a kind

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

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

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

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

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

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

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

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

Trait Implementations

impl Debug for Object[src]

impl Default for Object[src]

fn default() -> Self[src]

Return a new ObjectData struct, with kind set to Ordinary

impl Drop for Object[src]

impl Finalize for Object[src]

impl From<Object> for Value[src]

impl Trace for Object[src]

Auto Trait Implementations

impl !RefUnwindSafe for Object

impl !Send for Object

impl !Sync for Object

impl Unpin for Object

impl !UnwindSafe for Object

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, 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>,