Skip to main content

InboundRoute

Trait InboundRoute 

Source
pub trait InboundRoute: Send + Sync {
    // Required method
    fn take<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        inbound: &'life1 ChannelInbound,
        binding: Option<&'life2 ChannelBinding>,
    ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

What a host decides about an inbound message before the gateway does (spec 3.5 §10 X12, §7.19, A-I24): a served site sends a stranger’s message to its Inbox, where it never gets a pairing code or starts a turn, and takes a paired person’s photos into its media pipeline. Set it with ChannelGatewayBuilder::route.

§Example

use adk_kernel::channels::{ChannelBinding, ChannelInbound, InboundRoute};
use async_trait::async_trait;

/// Strangers are read elsewhere; everyone else goes through the gateway.
struct Strangers;

#[async_trait]
impl InboundRoute for Strangers {
    async fn take(&self, inbound: &ChannelInbound, binding: Option<&ChannelBinding>) -> adk_kernel::Result<bool> {
        Ok(binding.is_none())
    }
}

Required Methods§

Source

fn take<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, inbound: &'life1 ChannelInbound, binding: Option<&'life2 ChannelBinding>, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Takes inbound, from the account whose active pairing is binding, or leaves it to the gateway: true when it took it and the gateway does nothing more with it.

§Errors

The route’s error, which the gateway returns.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§