Struct v8::FunctionBuilder

source ·
pub struct FunctionBuilder<'s, T> { /* private fields */ }
Expand description

A builder to construct the properties of a Function or FunctionTemplate.

Implementations§

source§

impl<'s, T> FunctionBuilder<'s, T>

source

pub fn new(callback: impl MapFnTo<FunctionCallback>) -> Self

Create a new FunctionBuilder.

source

pub fn new_raw(callback: FunctionCallback) -> Self

source

pub fn data(self, data: Local<'s, Value>) -> Self

Set the associated data. The default is no associated data.

source

pub fn length(self, length: i32) -> Self

Set the function length. The default is 0.

source

pub fn constructor_behavior( self, constructor_behavior: ConstructorBehavior ) -> Self

Set the constructor behavior. The default is ConstructorBehavior::Allow.

source

pub fn side_effect_type(self, side_effect_type: SideEffectType) -> Self

Set the side effect type. The default is SideEffectType::HasSideEffect.

source§

impl<'s> FunctionBuilder<'s, Function>

source

pub fn build(self, scope: &mut HandleScope<'s>) -> Option<Local<'s, Function>>

Create the function in the current execution context.

source§

impl<'s> FunctionBuilder<'s, FunctionTemplate>

source

pub fn signature(self, signature: Local<'s, Signature>) -> Self

Set the function call signature. The default is no signature.

source

pub fn build( self, scope: &mut HandleScope<'s, ()> ) -> Local<'s, FunctionTemplate>

Creates the function template.

source

pub fn build_fast( self, scope: &mut HandleScope<'s, ()>, overload1: &FastFunction, c_fn_info1: Option<*const CFunctionInfo>, overload2: Option<&FastFunction>, c_fn_info2: Option<*const CFunctionInfo> ) -> Local<'s, FunctionTemplate>

It’s not required to provide CFunctionInfo for the overloads - if they are omitted, then they will be automatically created. In some cases it is useful to pass them explicitly - eg. when you are snapshotting you’d provide the overloads and CFunctionInfo that would be placed in the external references array.

Auto Trait Implementations§

§

impl<'s, T> RefUnwindSafe for FunctionBuilder<'s, T>where T: RefUnwindSafe,

§

impl<'s, T> !Send for FunctionBuilder<'s, T>

§

impl<'s, T> !Sync for FunctionBuilder<'s, T>

§

impl<'s, T> Unpin for FunctionBuilder<'s, T>where T: Unpin,

§

impl<'s, T> UnwindSafe for FunctionBuilder<'s, T>where T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.