pub struct ExtensionBuilder { /* private fields */ }

Implementations§

source§

impl ExtensionBuilder

source

pub fn js(&mut self, js_files: Vec<ExtensionFileSource>) -> &mut Self

source

pub fn esm(&mut self, esm_files: Vec<ExtensionFileSource>) -> &mut Self

source

pub fn esm_entry_point(&mut self, entry_point: &'static str) -> &mut Self

source

pub fn ops(&mut self, ops: Vec<OpDecl>) -> &mut Self

source

pub fn state<F>(&mut self, opstate_fn: F) -> &mut Selfwhere F: FnOnce(&mut OpState) + 'static,

source

pub fn middleware<F>(&mut self, middleware_fn: F) -> &mut Selfwhere F: Fn(OpDecl) -> OpDecl + 'static,

source

pub fn event_loop_middleware<F>(&mut self, middleware_fn: F) -> &mut Selfwhere F: Fn(Rc<RefCell<OpState>>, &mut Context<'_>) -> bool + 'static,

source

pub fn force_op_registration(&mut self) -> &mut Self

Mark that ops from this extension should be added to Deno.core.ops unconditionally. This is useful is some ops are not available during snapshotting, as ops are not registered by default when a JsRuntime is created with an existing snapshot.

source

pub fn take(self) -> Extension

Consume the ExtensionBuilder and return an Extension.

source

pub fn build(&mut self) -> Extension

Trait Implementations§

source§

impl Default for ExtensionBuilder

source§

fn default() -> ExtensionBuilder

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

Auto Trait Implementations§

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.