Skip to main content

ConversationHandle

Trait ConversationHandle 

Source
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§

Source

type ReceiveFuture<'a, M>: Future<Output = Result<M, SdkError>> + 'a where Self: 'a, M: DeserializeOwned + 'a

Future returned by receive for message type M.

Source

type LifecycleStream: Stream<Item = ConversationEvent>

Stream returned by lifecycle.

Required Methods§

Source

fn send<M>(&self, message: M) -> Result<(), SdkError>
where M: Serialize,

Sends a typed message within this conversation.

§Errors

Returns SdkError when the concrete conversation implementation cannot serialize or transmit the message in the conversation context.

Source

fn receive<M>(&self) -> Self::ReceiveFuture<'_, M>

Receives the next typed message from this conversation.

The message type is owned after deserialization so callers never borrow buffers managed by an SDK implementation.

§Errors

The returned future resolves to SdkError when the concrete implementation cannot receive or deserialize the next message.

Source

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".

Implementors§