pub struct RuntimeDispatcher { /* private fields */ }Expand description
Dispatcher that maps runtime names to adapters.
Implementations§
Source§impl RuntimeDispatcher
impl RuntimeDispatcher
Sourcepub fn with_defaults() -> Self
pub fn with_defaults() -> Self
Create a dispatcher pre-populated with all available adapters for the current target.
Populates built-in adapters (echo, noop, math) and native subprocess adapters.
Sourcepub fn register(&mut self, runtime: &str, adapter: Box<dyn RuntimeAdapter>)
pub fn register(&mut self, runtime: &str, adapter: Box<dyn RuntimeAdapter>)
Register an adapter under a runtime name.
Sourcepub fn dispatch(
&self,
runtime: &str,
script: &str,
input: &Value,
) -> Result<Value, String>
pub fn dispatch( &self, runtime: &str, script: &str, input: &Value, ) -> Result<Value, String>
Dispatch execution to the named runtime.
Returns an error if the runtime is not registered.
Sourcepub fn list_runtimes(&self) -> Vec<&str>
pub fn list_runtimes(&self) -> Vec<&str>
List all registered runtime names.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for RuntimeDispatcher
impl !UnwindSafe for RuntimeDispatcher
impl Forget for RuntimeDispatcher
impl Freeze for RuntimeDispatcher
impl Send for RuntimeDispatcher
impl Sync for RuntimeDispatcher
impl Unpin for RuntimeDispatcher
impl UnsafeUnpin for RuntimeDispatcher
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