pub struct DescriptorMethodBuilder<T: FromJsArgs, R: NapiValueT> {
    pub utf8name: Option<String>,
    pub name: napi_value,
    pub method: Option<Box<dyn FnMut(JsObject, T) -> NapiResult<R> + 'static>>,
    pub attributes: NapiPropertyAttributes,
}
Expand description

The DescriptorBuild for method. NB: there seems no way to reclaim the napi_property_descriptor.data, so it is leaked.

Fields

utf8name: Option<String>name: napi_valuemethod: Option<Box<dyn FnMut(JsObject, T) -> NapiResult<R> + 'static>>attributes: NapiPropertyAttributes

Implementations

Optional string describing the key for the property, encoded as UTF8. One of utf8name or name must be provided for the property.

Optional napi_value that points to a JavaScript string or symbol to be used as the key for the property. One of utf8name or name must be provided for the property.

Set this to make the property descriptor object’s value property to be a JavaScript function represented by method. If this is passed in, set value, getter and setter to NULL (since these members won’t be used). napi_callback provides more details.

The attributes associated with the particular property. See napi_property_attributes.

build finale NapiPropertyDescriptor

Trait Implementations

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.