[][src]Struct boa::property::Property

pub struct Property {
    pub value: Option<Value>,
    pub get: Option<Value>,
    pub set: Option<Value>,
    // some fields omitted
}

This represents a Javascript Property AKA The Property Descriptor.

Property descriptors present in objects come in two main flavors:

  • data descriptors
  • accessor descriptors

A data descriptor is a property that has a value, which may or may not be writable. An accessor descriptor is a property described by a getter-setter pair of functions. A descriptor must be one of these two flavors; it cannot be both.

Any field in a JavaScript Property may be present or absent.

More information:

Fields

value: Option<Value>

The value associated with the property

get: Option<Value>

The function serving as getter

set: Option<Value>

The function serving as setter

Implementations

impl Property[src]

pub fn new() -> Self[src]

Make a new property with the given value The difference between New and Default:

New: zeros everything to make an empty object Default: Defaults according to the spec

pub fn empty() -> Self[src]

pub fn data_descriptor(value: Value, attribute: Attribute) -> Self[src]

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

Get the

pub fn set_configurable(&mut self, configurable: bool)[src]

pub fn configurable_or(&self, value: bool) -> bool[src]

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

Set enumerable

pub fn enumerable_or(&self, value: bool) -> bool[src]

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

Set writable

pub fn writable_or(&self, value: bool) -> bool[src]

pub fn value(self, value: Value) -> Self[src]

Set value

pub fn get(self, get: Value) -> Self[src]

Set get

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

pub fn set(self, set: Value) -> Self[src]

Set set

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

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

Is this an empty Property?

true if all fields are set to none

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

An accessor Property Descriptor is one that includes any fields named either [[Get]] or [[Set]].

More information:

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

A data Property Descriptor is one that includes any fields named either [Value] or [[Writable]].

More information:

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

Check if a property is generic descriptor.

More information:

Trait Implementations

impl Clone for Property[src]

impl Debug for Property[src]

impl Default for Property[src]

fn default() -> Self[src]

Make a default property

More information:

impl Drop for Property[src]

impl Finalize for Property[src]

impl<'_> From<&'_ Property> for Value[src]

impl<'a> From<&'a Value> for Property[src]

fn from(value: &Value) -> Self[src]

Attempt to fetch values "configurable", "enumerable", "writable" from the value, if they're not there default to false

impl Trace for Property[src]

Auto Trait Implementations

impl !RefUnwindSafe for Property

impl !Send for Property

impl !Sync for Property

impl Unpin for Property

impl !UnwindSafe for Property

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