pub struct CapacityTracker { /* private fields */ }Expand description
Per-consumer tracker for current in-flight and buffered message counts.
Implementations§
Source§impl CapacityTracker
impl CapacityTracker
Sourcepub const fn new(capacity: ConsumerCapacity) -> Self
pub const fn new(capacity: ConsumerCapacity) -> Self
Creates a tracker for an explicitly declared consumer capacity.
Sourcepub const fn capacity(&self) -> &ConsumerCapacity
pub const fn capacity(&self) -> &ConsumerCapacity
Returns the consumer capacity declaration this tracker follows.
Sourcepub const fn current_in_flight(&self) -> usize
pub const fn current_in_flight(&self) -> usize
Returns the number of messages currently being processed by the consumer.
Sourcepub const fn current_buffer_depth(&self) -> usize
pub const fn current_buffer_depth(&self) -> usize
Returns the number of messages currently buffered for the consumer.
Sourcepub const fn record_delivery(&mut self)
pub const fn record_delivery(&mut self)
Records that a message was delivered and processing began.
Sourcepub const fn record_completion(&mut self) -> Result<(), CapacityError>
pub const fn record_completion(&mut self) -> Result<(), CapacityError>
Records that processing completed for one in-flight message.
§Errors
Returns CapacityError::InFlightUnderflow if no message is currently in flight.
Sourcepub const fn record_buffered(&mut self)
pub const fn record_buffered(&mut self)
Records that a message was buffered pending consumer capacity.
Sourcepub const fn record_buffer_drained(&mut self) -> Result<(), CapacityError>
pub const fn record_buffer_drained(&mut self) -> Result<(), CapacityError>
Records that one buffered message left the buffer.
§Errors
Returns CapacityError::BufferUnderflow if no message is currently buffered.
Sourcepub const fn pressure_signal(&self) -> PressureSignal
pub const fn pressure_signal(&self) -> PressureSignal
Determines the pressure signal for the next message without mutating counters.
Trait Implementations§
Source§impl Clone for CapacityTracker
impl Clone for CapacityTracker
Source§fn clone(&self) -> CapacityTracker
fn clone(&self) -> CapacityTracker
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CapacityTracker
impl Debug for CapacityTracker
impl Eq for CapacityTracker
Source§impl PartialEq for CapacityTracker
impl PartialEq for CapacityTracker
Source§fn eq(&self, other: &CapacityTracker) -> bool
fn eq(&self, other: &CapacityTracker) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for CapacityTracker
Auto Trait Implementations§
impl Freeze for CapacityTracker
impl RefUnwindSafe for CapacityTracker
impl Send for CapacityTracker
impl Sync for CapacityTracker
impl Unpin for CapacityTracker
impl UnsafeUnpin for CapacityTracker
impl UnwindSafe for CapacityTracker
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.