pub trait ConversationHandle:
Debug
+ Send
+ Sync {
type ReceiveFuture<'a, M>: Future<Output = Result<M, SdkError>> + 'a
where Self: 'a,
M: DeserializeOwned + 'a;
type LifecycleStream: Stream<Item = ConversationEvent>;
// Required methods
fn send<M>(&self, message: M) -> Result<(), SdkError>
where M: Serialize;
fn receive<M>(&self) -> Self::ReceiveFuture<'_, M>
where M: DeserializeOwned;
fn lifecycle(&self) -> Self::LifecycleStream;
}Expand description
Application-facing typed conversation API.
A conversation is the fundamental messaging unit in liminal. The handle lets callers send typed messages, receive typed messages, and observe lifecycle events without handling transport details or supervised runtime process IDs.
Required Associated Types§
Sourcetype ReceiveFuture<'a, M>: Future<Output = Result<M, SdkError>> + 'a
where
Self: 'a,
M: DeserializeOwned + 'a
type ReceiveFuture<'a, M>: Future<Output = Result<M, SdkError>> + 'a where Self: 'a, M: DeserializeOwned + 'a
Future returned by receive for message type M.
Sourcetype LifecycleStream: Stream<Item = ConversationEvent>
type LifecycleStream: Stream<Item = ConversationEvent>
Stream returned by lifecycle.
Required Methods§
Sourcefn receive<M>(&self) -> Self::ReceiveFuture<'_, M>where
M: DeserializeOwned,
fn receive<M>(&self) -> Self::ReceiveFuture<'_, M>where
M: DeserializeOwned,
Sourcefn lifecycle(&self) -> Self::LifecycleStream
fn lifecycle(&self) -> Self::LifecycleStream
Observes lifecycle events for this conversation.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".