[][src]Struct rusty_v8::FunctionTemplate

#[repr(C)]
pub struct FunctionTemplate(_);

A FunctionTemplate is used to create functions at runtime. There can only be one function created from a FunctionTemplate in a context. The lifetime of the created function is equal to the lifetime of the context. So in case the embedder needs to create temporary functions that can be collected using Scripts is preferred.

Any modification of a FunctionTemplate after first instantiation will trigger a crash.

A FunctionTemplate can have properties, these properties are added to the function object when it is created.

A FunctionTemplate has a corresponding instance template which is used to create object instances when the function is used as a constructor. Properties added to the instance template are added to each object instance.

A FunctionTemplate can have a prototype template. The prototype template is used to create the prototype object of the function.

Methods

impl FunctionTemplate[src]

pub fn new<'sc>(
    scope: &mut impl ToLocal<'sc>,
    callback: extern "C" fn(_: &FunctionCallbackInfo)
) -> Local<'sc, FunctionTemplate>
[src]

Creates a function template.

pub fn get_function<'sc>(
    &mut self,
    scope: &mut impl ToLocal<'sc>,
    context: Local<Context>
) -> Option<Local<'sc, Function>>
[src]

Returns the unique function instance in the current execution context.

Auto Trait Implementations

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.