pub struct StreamPressure { /* private fields */ }Expand description
Tracks protocol-level pressure counters for one application stream.
Implementations§
Source§impl StreamPressure
impl StreamPressure
Sourcepub fn new(max_in_flight: u32) -> Result<Self, ProtocolError>
pub fn new(max_in_flight: u32) -> Result<Self, ProtocolError>
Create pressure tracking for a subscription capacity declaration.
§Errors
Returns ProtocolError::CodecError when max_in_flight is zero.
Sourcepub const fn outstanding_count(&self) -> u32
pub const fn outstanding_count(&self) -> u32
Return messages delivered on this stream but not yet accepted.
Sourcepub const fn max_in_flight(&self) -> u32
pub const fn max_in_flight(&self) -> u32
Return consumer-declared in-flight capacity from the Subscribe frame.
Sourcepub const fn state(&self) -> PressureState
pub const fn state(&self) -> PressureState
Return the current pressure state for the stream.
Sourcepub fn record_delivery(
&mut self,
buffer_capacity: u32,
) -> Result<PressureState, ProtocolError>
pub fn record_delivery( &mut self, buffer_capacity: u32, ) -> Result<PressureState, ProtocolError>
Record delivery of one message and recompute state using caller capacity.
buffer_capacity is supplied by the bus/subscription layer; the protocol
state machine does not define or hardcode that threshold.
§Errors
Returns ProtocolError::CodecError when the outstanding counter or
capacity threshold overflows.
Sourcepub fn record_accept(
&mut self,
buffer_capacity: u32,
) -> Result<PressureState, ProtocolError>
pub fn record_accept( &mut self, buffer_capacity: u32, ) -> Result<PressureState, ProtocolError>
Record acceptance of one outstanding message and recompute state using caller capacity.
buffer_capacity is supplied by the bus/subscription layer; the protocol
state machine does not define or hardcode that threshold.
§Errors
Returns ProtocolError::CodecError when no messages are outstanding or
the capacity threshold overflows.
Trait Implementations§
Source§impl Clone for StreamPressure
impl Clone for StreamPressure
Source§fn clone(&self) -> StreamPressure
fn clone(&self) -> StreamPressure
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 StreamPressure
impl Debug for StreamPressure
impl Eq for StreamPressure
Source§impl PartialEq for StreamPressure
impl PartialEq for StreamPressure
Source§fn eq(&self, other: &StreamPressure) -> bool
fn eq(&self, other: &StreamPressure) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for StreamPressure
Auto Trait Implementations§
impl Freeze for StreamPressure
impl RefUnwindSafe for StreamPressure
impl Send for StreamPressure
impl Sync for StreamPressure
impl Unpin for StreamPressure
impl UnsafeUnpin for StreamPressure
impl UnwindSafe for StreamPressure
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.