Skip to main content

ChildRouter

Trait ChildRouter 

Source
pub trait ChildRouter: Send + Sync {
    // Required methods
    fn router_namespace(&self) -> &str;
    fn router_call<'life0, 'life1, 'async_trait>(
        &'life0 self,
        method: &'life1 str,
        params: Value,
    ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = PlexusStreamItem> + Send>>, PlexusError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn get_child<'life0, 'life1, 'async_trait>(
        &'life0 self,
        name: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Option<Box<dyn ChildRouter>>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
}
Expand description

Trait for activations that can route to child activations

Hub activations implement this to support nested method routing. When a method like “mercury.info” is called on a solar activation, this trait enables routing to the mercury child.

This trait is separate from Activation to avoid associated type issues with dynamic dispatch.

Required Methods§

Source

fn router_namespace(&self) -> &str

Get the namespace of this router (for error messages)

Source

fn router_call<'life0, 'life1, 'async_trait>( &'life0 self, method: &'life1 str, params: Value, ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = PlexusStreamItem> + Send>>, PlexusError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Call a method on this router

Source

fn get_child<'life0, 'life1, 'async_trait>( &'life0 self, name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Option<Box<dyn ChildRouter>>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Get a child activation instance by name for nested routing

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl ChildRouter for DynamicHub

ChildRouter implementation for DynamicHub

This enables nested routing through registered activations. e.g., hub.call(“solar.mercury.info”) routes to solar → mercury → info