pub trait Platform: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn capabilities(&self) -> Capabilities;
fn start<'life0, 'async_trait>(
&'life0 self,
inbound: Sender<Inbound>,
) -> Pin<Box<dyn Future<Output = PlatformResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn reply<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 ReplyCtx,
msg: OutboundMessage,
) -> Pin<Box<dyn Future<Output = PlatformResult<MessageRef>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn edit<'life0, 'life1, 'async_trait>(
&'life0 self,
msg_ref: &'life1 MessageRef,
new: OutboundMessage,
) -> Pin<Box<dyn Future<Output = PlatformResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn stop<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = PlatformResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided method
fn answer_callback<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_callback_query_id: &'life1 str,
_text: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = PlatformResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
}Expand description
An IM-platform adapter. cc-connect’s proven 5-method core (start,
reply, edit, stop, plus capabilities/name) — see epic #447.
Required Methods§
Sourcefn name(&self) -> &str
fn name(&self) -> &str
Short identifier, e.g. "telegram". Matches InboundMessage::platform.
Sourcefn capabilities(&self) -> Capabilities
fn capabilities(&self) -> Capabilities
What this adapter supports.
Sourcefn start<'life0, 'async_trait>(
&'life0 self,
inbound: Sender<Inbound>,
) -> Pin<Box<dyn Future<Output = PlatformResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn start<'life0, 'async_trait>(
&'life0 self,
inbound: Sender<Inbound>,
) -> Pin<Box<dyn Future<Output = PlatformResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Start receiving inbound events (messages and/or button presses),
sending each onto inbound. Runs for the adapter’s lifetime (a
long-poll loop, a WS connection, …); returns only on an unrecoverable
error or stop().
Sourcefn reply<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 ReplyCtx,
msg: OutboundMessage,
) -> Pin<Box<dyn Future<Output = PlatformResult<MessageRef>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn reply<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 ReplyCtx,
msg: OutboundMessage,
) -> Pin<Box<dyn Future<Output = PlatformResult<MessageRef>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Send a message in reply to ctx.
Sourcefn edit<'life0, 'life1, 'async_trait>(
&'life0 self,
msg_ref: &'life1 MessageRef,
new: OutboundMessage,
) -> Pin<Box<dyn Future<Output = PlatformResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn edit<'life0, 'life1, 'async_trait>(
&'life0 self,
msg_ref: &'life1 MessageRef,
new: OutboundMessage,
) -> Pin<Box<dyn Future<Output = PlatformResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Edit a previously-sent message in place. Capability-gated on
Capabilities::edit_message; adapters that don’t support it may
return an error — callers must check the capability first.
Provided Methods§
Sourcefn answer_callback<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_callback_query_id: &'life1 str,
_text: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = PlatformResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn answer_callback<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_callback_query_id: &'life1 str,
_text: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = PlatformResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Acknowledge a callback query (capability-gated on
Capabilities::buttons — adapters without button support never
receive one to acknowledge, so the default no-op is correct for them).
Telegram requires exactly one ack per callback query, success or not;
text, when Some, is shown as a brief toast (e.g. an “expired”
notice for a stale/forged nonce).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".