pub struct RhaiRuntime { /* private fields */ }Expand description
Rhai plugin runtime.
Implementations§
Source§impl RhaiRuntime
impl RhaiRuntime
Sourcepub fn new() -> PluginResult<Self>
pub fn new() -> PluginResult<Self>
Create a new Rhai runtime.
Trait Implementations§
Source§impl Default for RhaiRuntime
impl Default for RhaiRuntime
Source§impl PluginRuntime for RhaiRuntime
impl PluginRuntime for RhaiRuntime
Source§fn file_extensions(&self) -> &'static [&'static str]
fn file_extensions(&self) -> &'static [&'static str]
Get the file extensions this runtime handles (e.g., [“.lua”]).
Source§fn init(&mut self, config: &PluginConfig) -> PluginResult<()>
fn init(&mut self, config: &PluginConfig) -> PluginResult<()>
Initialize the runtime with configuration.
Source§fn load_plugin(&mut self, id: &str, source: &Path) -> PluginResult<PluginHandle>
fn load_plugin(&mut self, id: &str, source: &Path) -> PluginResult<PluginHandle>
Load a plugin from a file path. Read more
Source§fn unload_plugin(&mut self, handle: PluginHandle) -> PluginResult<()>
fn unload_plugin(&mut self, handle: PluginHandle) -> PluginResult<()>
Unload a previously loaded plugin.
Source§fn get_metadata(&self, handle: PluginHandle) -> Option<&PluginMetadata>
fn get_metadata(&self, handle: PluginHandle) -> Option<&PluginMetadata>
Get metadata about a loaded plugin.
Source§fn has_hook(&self, handle: PluginHandle, hook_name: &str) -> bool
fn has_hook(&self, handle: PluginHandle, hook_name: &str) -> bool
Check if a plugin implements a specific hook.
Source§fn call_hook_sync(
&self,
handle: PluginHandle,
hook: &Hook,
_ctx: &HookContext,
) -> PluginResult<HookResult>
fn call_hook_sync( &self, handle: PluginHandle, hook: &Hook, _ctx: &HookContext, ) -> PluginResult<HookResult>
Call a hook on a plugin synchronously. Read more
Source§fn call_hook_async<'a>(
&'a self,
handle: PluginHandle,
hook: &'a Hook,
ctx: &'a HookContext,
) -> Pin<Box<dyn Future<Output = PluginResult<HookResult>> + Send + 'a>>
fn call_hook_async<'a>( &'a self, handle: PluginHandle, hook: &'a Hook, ctx: &'a HookContext, ) -> Pin<Box<dyn Future<Output = PluginResult<HookResult>> + Send + 'a>>
Call a hook on a plugin asynchronously. Read more
Source§fn call_method<'a>(
&'a self,
handle: PluginHandle,
method: &'a str,
args: Vec<Value>,
) -> Pin<Box<dyn Future<Output = PluginResult<Value>> + Send + 'a>>
fn call_method<'a>( &'a self, handle: PluginHandle, method: &'a str, args: Vec<Value>, ) -> Pin<Box<dyn Future<Output = PluginResult<Value>> + Send + 'a>>
Call an arbitrary method on a plugin.
Source§fn create_isolated_context(
&self,
sandbox: &SandboxConfig,
) -> PluginResult<Box<dyn IsolatedContext>>
fn create_isolated_context( &self, sandbox: &SandboxConfig, ) -> PluginResult<Box<dyn IsolatedContext>>
Create an isolated context for running async plugin code. Read more
Source§fn loaded_plugins(&self) -> Vec<PluginHandle>
fn loaded_plugins(&self) -> Vec<PluginHandle>
Get the list of loaded plugin handles.
Source§fn shutdown(&mut self) -> PluginResult<()>
fn shutdown(&mut self) -> PluginResult<()>
Shutdown the runtime and cleanup resources.
Auto Trait Implementations§
impl !Freeze for RhaiRuntime
impl !RefUnwindSafe for RhaiRuntime
impl Send for RhaiRuntime
impl Sync for RhaiRuntime
impl Unpin for RhaiRuntime
impl !UnwindSafe for RhaiRuntime
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> 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