Skip to main content

Dispatcher

Trait Dispatcher 

Source
pub trait Dispatcher: Send + Sync {
    // Required method
    fn dispatch(&self, req: Request) -> Response;

    // Provided methods
    fn config_value(&self, _key: &str) -> Option<ConfigValue> { ... }
    fn resolve_any(
        &self,
        _type_name: &'static str,
    ) -> Result<Arc<dyn Any + Send + Sync>, RivetError> { ... }
}
Expand description

Runtime dispatch boundary used by adapters.

Adapters translate transport-specific requests to Request, call this method, then translate the resulting Response back to their transport.

Required Methods§

Source

fn dispatch(&self, req: Request) -> Response

Dispatch one request through routing and middleware.

Provided Methods§

Source

fn config_value(&self, _key: &str) -> Option<ConfigValue>

Read a config value when available (default: unsupported).

Source

fn resolve_any( &self, _type_name: &'static str, ) -> Result<Arc<dyn Any + Send + Sync>, RivetError>

Resolve a typed service by type name from the underlying app container.

Implementors§