pub struct PluginBuilder<'a> { /* private fields */ }Expand description
PluginBuilder is used to configure and create Plugin instances
Implementations§
Source§impl<'a> PluginBuilder<'a>
impl<'a> PluginBuilder<'a>
Sourcepub fn new(plugin: impl Into<WasmInput<'a>>) -> Self
pub fn new(plugin: impl Into<WasmInput<'a>>) -> Self
Create a new PluginBuilder from a Manifest or raw Wasm bytes
Sourcepub fn with_function<T: 'static, F>(
self,
name: impl Into<String>,
args: impl IntoIterator<Item = ValType>,
returns: impl IntoIterator<Item = ValType>,
user_data: UserData<T>,
f: F,
) -> Self
pub fn with_function<T: 'static, F>( self, name: impl Into<String>, args: impl IntoIterator<Item = ValType>, returns: impl IntoIterator<Item = ValType>, user_data: UserData<T>, f: F, ) -> Self
Add a single host function
Sourcepub fn with_function_in_namespace<T: 'static, F>(
self,
namespace: impl Into<String>,
name: impl Into<String>,
args: impl IntoIterator<Item = ValType>,
returns: impl IntoIterator<Item = ValType>,
user_data: UserData<T>,
f: F,
) -> Self
pub fn with_function_in_namespace<T: 'static, F>( self, namespace: impl Into<String>, name: impl Into<String>, args: impl IntoIterator<Item = ValType>, returns: impl IntoIterator<Item = ValType>, user_data: UserData<T>, f: F, ) -> Self
Add a single host function in a specific namespace
Sourcepub fn with_functions(self, f: impl IntoIterator<Item = Function>) -> Self
pub fn with_functions(self, f: impl IntoIterator<Item = Function>) -> Self
Add multiple host functions
Sourcepub fn with_profiling_strategy(self, p: ProfilingStrategy) -> Self
pub fn with_profiling_strategy(self, p: ProfilingStrategy) -> Self
Set profiling strategy
Sourcepub fn with_coredump(self, path: impl Into<PathBuf>) -> Self
pub fn with_coredump(self, path: impl Into<PathBuf>) -> Self
Enable Wasmtime coredump on trap
Sourcepub fn with_memdump(self, path: impl Into<PathBuf>) -> Self
pub fn with_memdump(self, path: impl Into<PathBuf>) -> Self
Enable Extism memory dump when plugin calls return an error
Sourcepub fn with_debug_info(self) -> Self
pub fn with_debug_info(self) -> Self
Compile with debug info
Sourcepub fn with_debug_options(self, options: DebugOptions) -> Self
pub fn with_debug_options(self, options: DebugOptions) -> Self
Configure debug options
Sourcepub fn with_cache_config(self, dir: impl Into<PathBuf>) -> Self
pub fn with_cache_config(self, dir: impl Into<PathBuf>) -> Self
Set wasmtime compilation cache config path
Sourcepub fn with_cache_disabled(self) -> Self
pub fn with_cache_disabled(self) -> Self
Turn wasmtime compilation caching off
Sourcepub fn with_fuel_limit(self, fuel: u64) -> Self
pub fn with_fuel_limit(self, fuel: u64) -> Self
Limit the number of instructions that can be executed
Sourcepub fn with_wasmtime_config(self, config: Config) -> Self
pub fn with_wasmtime_config(self, config: Config) -> Self
Configure an initial wasmtime config to be passed to the plugin
Warning: some values might be overwritten by the Extism runtime. In particular:
- async_support
- epoch_interruption
- debug_info
- coredump_on_trap
- profiler
- wasm_tail_call
- wasm_function_references
- wasm_gc
See the implementation details of PluginBuilder::build and [Plugin::build_new] to verify which values are overwritten.
Sourcepub fn with_http_response_headers(self, allow: bool) -> Self
pub fn with_http_response_headers(self, allow: bool) -> Self
Enables http_response_headers, which allows for plugins to access response headers when using extism:host/env::http_request
Sourcepub fn compile(self) -> Result<CompiledPlugin, Error>
pub fn compile(self) -> Result<CompiledPlugin, Error>
Build new CompiledPlugin
Trait Implementations§
Source§impl<'a> Clone for PluginBuilder<'a>
impl<'a> Clone for PluginBuilder<'a>
Source§fn clone(&self) -> PluginBuilder<'a>
fn clone(&self) -> PluginBuilder<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl<'a> Freeze for PluginBuilder<'a>
impl<'a> !RefUnwindSafe for PluginBuilder<'a>
impl<'a> Send for PluginBuilder<'a>
impl<'a> Sync for PluginBuilder<'a>
impl<'a> Unpin for PluginBuilder<'a>
impl<'a> UnsafeUnpin for PluginBuilder<'a>
impl<'a> !UnwindSafe for PluginBuilder<'a>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
Source§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
self file descriptor.Source§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
Source§fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
self file descriptor. Read moreSource§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more