pub trait UnreliablePolicy: Sized {
type Overflow: Overflow<Self>;
// Required method
fn handle(overflow: &mut Self::Overflow, message: Self) -> bool;
}Expand description
Overflow behavior for actor messages that can be rejected when an inbox is full.
Required Associated Types§
Required Methods§
Sourcefn handle(overflow: &mut Self::Overflow, message: Self) -> bool
fn handle(overflow: &mut Self::Overflow, message: Self) -> bool
Unreliably handle message when it cannot enter the bounded ready queue immediately.
Returns true when the policy considered the message’s effects. This includes retaining
the message, coalescing it with retained work, replacing older retained work, or deliberately
doing no work because the message is already satisfied, superseded, or no longer needed.
Returns false only when the policy rejects the message under backpressure without
retaining, coalescing, replacing, or otherwise handling it. This is the unreliable case: the
submitted work was not semantically handled, and callers that care should retry or treat the
submission as failed.
§Warning
Do not enqueue into the same mailbox from this method or from destructors triggered by
editing overflow. This method runs while the mailbox holds its overflow lock, so same
mailbox re-entry can deadlock.
This method should not unwind after mutating overflow. A panic, including one from a
destructor triggered while editing overflow, can leave retained overflow data stranded in
the mailbox.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".