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>
impl<'s, T> FunctionBuilder<'s, T>
sourcepub fn new(callback: impl MapFnTo<FunctionCallback>) -> Self
pub fn new(callback: impl MapFnTo<FunctionCallback>) -> Self
Create a new FunctionBuilder.
pub fn new_raw(callback: FunctionCallback) -> Self
sourcepub fn data(self, data: Local<'s, Value>) -> Self
pub fn data(self, data: Local<'s, Value>) -> Self
Set the associated data. The default is no associated data.
sourcepub fn constructor_behavior(
self,
constructor_behavior: ConstructorBehavior
) -> Self
pub fn constructor_behavior( self, constructor_behavior: ConstructorBehavior ) -> Self
Set the constructor behavior. The default is ConstructorBehavior::Allow.
sourcepub fn side_effect_type(self, side_effect_type: SideEffectType) -> Self
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>
impl<'s> FunctionBuilder<'s, Function>
source§impl<'s> FunctionBuilder<'s, FunctionTemplate>
impl<'s> FunctionBuilder<'s, FunctionTemplate>
sourcepub fn signature(self, signature: Local<'s, Signature>) -> Self
pub fn signature(self, signature: Local<'s, Signature>) -> Self
Set the function call signature. The default is no signature.
sourcepub fn build(
self,
scope: &mut HandleScope<'s, ()>
) -> Local<'s, FunctionTemplate>
pub fn build( self, scope: &mut HandleScope<'s, ()> ) -> Local<'s, FunctionTemplate>
Creates the function template.
sourcepub 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>
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more