Struct extism_runtime::Context
source · pub struct Context {
pub plugins: BTreeMap<PluginIndex, Plugin>,
pub error: Option<CString>,
/* private fields */
}
Expand description
A Context
is used to store and manage plugins
Fields§
§plugins: BTreeMap<PluginIndex, Plugin>
Plugin registry
error: Option<CString>
Error message
Implementations§
source§impl Context
impl Context
sourcepub fn next_id(&mut self) -> Result<PluginIndex, Error>
pub fn next_id(&mut self) -> Result<PluginIndex, Error>
Get the next valid plugin ID
pub fn insert(&mut self, plugin: Plugin) -> PluginIndex
pub fn new_plugin<'a>( &mut self, data: impl AsRef<[u8]>, imports: impl IntoIterator<Item = &'a Function>, with_wasi: bool ) -> PluginIndex
sourcepub fn error<T>(&mut self, e: impl Debug, x: T) -> T
pub fn error<T>(&mut self, e: impl Debug, x: T) -> T
Convenience function to set error and return the value passed as the final parameter
pub fn plugin_exists(&mut self, id: PluginIndex) -> bool
sourcepub fn remove(&mut self, id: PluginIndex)
pub fn remove(&mut self, id: PluginIndex)
Remove a plugin from the context
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Context
impl !Send for Context
impl !Sync for Context
impl Unpin for Context
impl !UnwindSafe for Context
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
§impl<T> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
§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.