pub struct PriorityQueue<A: Address, T, P, TargetRoute: DeliveryRoute<Protocol: Protocol<Addr = A, Msg = T>>, ReplyRoute: DeliveryRoute<Protocol: Protocol<Addr = A, Msg = PriorityQueueOutcome<T, P>>>> { /* private fields */ }Expand description
Bounded stable immutable-priority queue behavior.
Greater priorities release first and equal priorities preserve FIFO by an
explicit insertion token. Full and token-exhausted offers return ownership.
Token exhaustion is a distinct admission phase and never wraps; retained
values remain releasable. Release emits one value and one factual outcome;
empty release emits only Empty. Initialization is empty, no actors are
created, and the host never terminates by policy. Capacity, priority order,
and FIFO ties are Bombay policy; mailbox priority and backpressure remain
Communication concerns. The implementation uses BinaryHeap because
accepted priorities are immutable; it does not need priority-queue.
No transition has a semantic panic condition.
Implementations§
Source§impl<A, T, P, TargetRoute, ReplyRoute> PriorityQueue<A, T, P, TargetRoute, ReplyRoute>where
A: Address,
P: Ord,
TargetRoute: DeliveryRoute<Protocol: Protocol<Addr = A, Msg = T>>,
ReplyRoute: DeliveryRoute<Protocol: Protocol<Addr = A, Msg = PriorityQueueOutcome<T, P>>>,
impl<A, T, P, TargetRoute, ReplyRoute> PriorityQueue<A, T, P, TargetRoute, ReplyRoute>where
A: Address,
P: Ord,
TargetRoute: DeliveryRoute<Protocol: Protocol<Addr = A, Msg = T>>,
ReplyRoute: DeliveryRoute<Protocol: Protocol<Addr = A, Msg = PriorityQueueOutcome<T, P>>>,
Sourcepub fn new(capacity: usize) -> Result<Self, PriorityQueueConfigError>
pub fn new(capacity: usize) -> Result<Self, PriorityQueueConfigError>
Construct an empty positive-capacity queue.
§Errors
Returns PriorityQueueConfigError::ZeroCapacity for zero capacity.
Sourcepub fn state(&self) -> PriorityQueueState
pub fn state(&self) -> PriorityQueueState
Return the complete admission phase and depth.