Skip to main content

MessageSink

Trait MessageSink 

Source
pub trait MessageSink: Send + Sync {
    // Required methods
    fn channels<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Vec<String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn send<'life0, 'life1, 'async_trait>(
        &'life0 self,
        msg: &'life1 OutboundMessage,
    ) -> Pin<Box<dyn Future<Output = Result<MessageReceipt, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

The host-supplied outbound transport the runtime dispatches messaging.send to.

Mirrors the crate::ToolExecutor arrangement: the runtime owns the governance (validation, policy, rate limiting, logging) and the caller owns the wire. One sink fronts every channel — routing among channels is the sink’s job, because only the sink knows which adapters it has.

Required Methods§

Source

fn channels<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Vec<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Channel names this sink can deliver to.

Advisory — used to build actionable error messages (“unknown channel ‘slak’; registered: imessage”) and for host introspection. It is NOT a pre-flight gate: Self::send remains the authority, since a sink’s set of channels can change between the two calls.

Source

fn send<'life0, 'life1, 'async_trait>( &'life0 self, msg: &'life1 OutboundMessage, ) -> Pin<Box<dyn Future<Output = Result<MessageReceipt, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Deliver one message, or explain why it was not delivered.

Err carries a human-readable reason that reaches the model as the tool’s error, so it should say what would make the send work (pair the handle, use a direct recipient, name a registered channel).

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§