pub trait Gateway: Send + Sync {
// Required methods
fn name(&self) -> &'static str;
fn send<'life0, 'async_trait>(
&'life0 self,
msg: MessageEvent,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn start<'life0, 'async_trait>(
&'life0 self,
db: DatabaseConnection,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
A Gateway bridges the sensorium loop with an external communication channel (Slack, HTTP webhook, chat TUI, etc).
Required Methods§
Sourcefn name(&self) -> &'static str
fn name(&self) -> &'static str
Unique, stable identifier for this gateway (e.g. “slack”, “tui”).
Used as the key in process_event_deliveries to track per-gateway delivery state.
Sourcefn send<'life0, 'async_trait>(
&'life0 self,
msg: MessageEvent,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send<'life0, 'async_trait>(
&'life0 self,
msg: MessageEvent,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Deliver a message to the external system (called for each ProcessEvent).
Sourcefn start<'life0, 'async_trait>(
&'life0 self,
db: DatabaseConnection,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn start<'life0, 'async_trait>(
&'life0 self,
db: DatabaseConnection,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Start listening for inbound messages, writing them directly to the conversations table.
This is expected to run until the gateway shuts down.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".