[][src]Struct boa::object::ConstructorBuilder

pub struct ConstructorBuilder<'context> { /* fields omitted */ }

Builder for creating constructors objects, like Array.

Implementations

impl<'context> ConstructorBuilder<'context>[src]

pub fn new(context: &'context mut Context, constructor: NativeFunction) -> Self[src]

Create a new ConstructorBuilder.

pub fn method<B>(
    &mut self,
    function: NativeFunction,
    binding: B,
    length: usize
) -> &mut Self where
    B: Into<FunctionBinding>, 
[src]

Add new method to the constructors prototype.

pub fn static_method<B>(
    &mut self,
    function: NativeFunction,
    binding: B,
    length: usize
) -> &mut Self where
    B: Into<FunctionBinding>, 
[src]

Add new static method to the constructors object itself.

pub fn property<K, V>(
    &mut self,
    key: K,
    value: V,
    attribute: Attribute
) -> &mut Self where
    K: Into<PropertyKey>,
    V: Into<Value>, 
[src]

Add new property to the constructors prototype.

pub fn static_property<K, V>(
    &mut self,
    key: K,
    value: V,
    attribute: Attribute
) -> &mut Self where
    K: Into<PropertyKey>,
    V: Into<Value>, 
[src]

Add new static property to the constructors object itself.

pub fn length(&mut self, length: usize) -> &mut Self[src]

Specify how many arguments the constructor function takes.

Default is 0.

pub fn name<N>(&mut self, name: N) -> &mut Self where
    N: AsRef<str>, 
[src]

Specify the name of the constructor function.

Default is "[object]"

pub fn callable(&mut self, callable: bool) -> &mut Self[src]

Specify whether the constructor function can be called.

Default is true

pub fn constructable(&mut self, constructable: bool) -> &mut Self[src]

Specify whether the constructor function can be called with new keyword.

Default is true

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

Specify the prototype this constructor object inherits from.

Default is Object.prototype

pub fn context(&mut self) -> &mut Context[src]

Return the current context.

pub fn build(&mut self) -> GcObject[src]

Build the constructor function object.

Trait Implementations

impl Debug for ConstructorBuilder<'_>[src]

Auto Trait Implementations

impl<'context> !RefUnwindSafe for ConstructorBuilder<'context>[src]

impl<'context> !Send for ConstructorBuilder<'context>[src]

impl<'context> !Sync for ConstructorBuilder<'context>[src]

impl<'context> Unpin for ConstructorBuilder<'context>[src]

impl<'context> !UnwindSafe for ConstructorBuilder<'context>[src]

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