pub struct WasmPluginLoader { /* private fields */ }Expand description
Factory for creating WasmPlugin instances with shared configuration.
§Example
use astrid_plugins::wasm::WasmPluginLoader;
use std::time::Duration;
let loader = WasmPluginLoader::new()
.with_memory_limit(32 * 1024 * 1024) // 32 MB
.with_timeout(Duration::from_secs(10));Implementations§
Source§impl WasmPluginLoader
impl WasmPluginLoader
Sourcepub fn with_security(self, gate: Arc<dyn PluginSecurityGate>) -> Self
pub fn with_security(self, gate: Arc<dyn PluginSecurityGate>) -> Self
Set the security gate for authorizing host function calls.
Sourcepub fn with_memory_limit(self, bytes: u64) -> Self
pub fn with_memory_limit(self, bytes: u64) -> Self
Set the maximum WASM linear memory in bytes.
Sourcepub fn with_timeout(self, duration: Duration) -> Self
pub fn with_timeout(self, duration: Duration) -> Self
Set the maximum execution time per WASM call.
Sourcepub fn with_require_hash(self, require: bool) -> Self
pub fn with_require_hash(self, require: bool) -> Self
Require WASM modules to have a hash in their manifest.
When enabled, plugins without a hash field in their manifest
entry point will fail to load. Recommended for production.
Sourcepub fn create_plugin(&self, manifest: PluginManifest) -> WasmPlugin
pub fn create_plugin(&self, manifest: PluginManifest) -> WasmPlugin
Create an unloaded WasmPlugin from a manifest.
The plugin must be loaded via Plugin::load()
before it can serve tools.
Sourcepub fn max_memory_bytes(&self) -> u64
pub fn max_memory_bytes(&self) -> u64
Get the configured memory limit.
Sourcepub fn max_execution_time(&self) -> Duration
pub fn max_execution_time(&self) -> Duration
Get the configured execution timeout.
Trait Implementations§
Source§impl Debug for WasmPluginLoader
impl Debug for WasmPluginLoader
Auto Trait Implementations§
impl Freeze for WasmPluginLoader
impl !RefUnwindSafe for WasmPluginLoader
impl Send for WasmPluginLoader
impl Sync for WasmPluginLoader
impl Unpin for WasmPluginLoader
impl UnsafeUnpin for WasmPluginLoader
impl !UnwindSafe for WasmPluginLoader
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
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,
Query the “status” flags for the
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,
Set the “status” flags for the
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>
Converts
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>
Converts
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