pub struct Executor { /* private fields */ }Implementations§
Source§impl Executor
impl Executor
pub fn new(config: RuntimeConfig) -> Self
pub async fn register_handler(&self, handler: Arc<dyn Handler>)
pub async fn execute( &self, handler_name: &str, payload: Value, ) -> Result<HandlerResult>
pub async fn execute_with_params( &self, handler_name: &str, payload: Value, query_params: HashMap<String, String>, ) -> Result<HandlerResult>
pub async fn execute_with_context( &self, context: HandlerContext, ) -> Result<HandlerResult>
pub async fn list_handlers(&self) -> Vec<String>
pub async fn reload_python_module(&self, module_name: &str) -> Result<()>
pub async fn reload_node_module(&self, module_name: &str) -> Result<()>
pub async fn clear_handler_cache(&self) -> Result<()>
Sourcepub fn rust_runtime(&self) -> &Arc<RustRuntime>
pub fn rust_runtime(&self) -> &Arc<RustRuntime>
Get a reference to the Rust runtime for direct handler registration.
This allows static handler registration:
use rohas_runtime::{Executor, RuntimeConfig, HandlerContext, HandlerResult};
let executor = Executor::new(RuntimeConfig::default());
async fn my_handler_fn(ctx: HandlerContext) -> rohas_runtime::error::Result<HandlerResult> {
Ok(HandlerResult::success(serde_json::json!({}), 0))
}
executor.rust_runtime().register_handler("my_handler".to_string(), my_handler_fn).await;Auto Trait Implementations§
impl Freeze for Executor
impl !RefUnwindSafe for Executor
impl Send for Executor
impl Sync for Executor
impl Unpin for Executor
impl !UnwindSafe for Executor
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