pub trait ConversationResource: Debug + Send {
// Required methods
fn message(&self, envelope: &MessageEnvelope) -> Result<(), ServerError>;
fn participant_pids(&self) -> Vec<u64>;
fn has_detected_crash(&self) -> bool;
fn await_crash(&self, timeout: Duration) -> Option<Instant>;
fn receive_reply(
&self,
timeout: Duration,
) -> Result<MessageEnvelope, ServerError>;
fn close(self: Box<Self>) -> Result<(), ServerError>;
}Expand description
Marker for library conversation state owned by a single connection process.
Required Methods§
Sourcefn message(&self, envelope: &MessageEnvelope) -> Result<(), ServerError>
fn message(&self, envelope: &MessageEnvelope) -> Result<(), ServerError>
Delegates one conversation message to the library resource.
§Errors
Returns ServerError when the liminal library rejects the conversation message.
Sourcefn participant_pids(&self) -> Vec<u64>
fn participant_pids(&self) -> Vec<u64>
Returns the participant PIDs linked to the supervised conversation, if any.
A trace-only conversation has no participant process and returns an empty slice; a real supervised conversation returns the linked participant PIDs.
Sourcefn has_detected_crash(&self) -> bool
fn has_detected_crash(&self) -> bool
Returns true if the conversation has structurally detected a participant crash via the trapped linked-EXIT path (never by polling/sleeping).
This is non-blocking: it observes whether the actor’s exit notifier has
already fired (the link-EXIT event landed) and falls back to the actor’s
structurally-set Failed phase. It does not sample liveness.
Sourcefn await_crash(&self, timeout: Duration) -> Option<Instant>
fn await_crash(&self, timeout: Duration) -> Option<Instant>
Blocks up to timeout waiting for a structural linked-EXIT crash signal,
returning the Instant the EXIT was observed inside the actor’s link
handler, or None if no crash is detected within the bound.
The wait is event-driven (parks on the exit notifier and is woken by the EXIT handler), not a poll loop. Used by tests to prove real detection.
Sourcefn receive_reply(
&self,
timeout: Duration,
) -> Result<MessageEnvelope, ServerError>
fn receive_reply( &self, timeout: Duration, ) -> Result<MessageEnvelope, ServerError>
Receives the next reply the participant produced for this conversation,
bounded by timeout.
A real participant processes each forwarded message and delivers a reply back through the conversation; this drains that reply. A trace-only or non-replying resource times out.
§Errors
Returns ServerError when no reply arrives within timeout, the
participant crashed, or the conversation is unavailable.
Sourcefn close(self: Box<Self>) -> Result<(), ServerError>
fn close(self: Box<Self>) -> Result<(), ServerError>
Releases or finishes the library conversation resource.
§Errors
Returns ServerError when the liminal library reports a close failure.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".