#[non_exhaustive]pub struct QueueCaps {
pub max_items: usize,
pub soft_items: usize,
pub max_bytes: Option<usize>,
pub soft_bytes: Option<usize>,
}Expand description
Queue capacity and watermark configuration.
soft_* define backpressure watermarks; max_* define hard caps.
Watermark state is derived from live occupancy snapshots and drives scheduling/backpressure.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.max_items: usizeMaximum number of items permitted (hard cap).
soft_items: usizeSoft watermark for items; admission adapts between soft and hard.
max_bytes: Option<usize>Optional byte cap and soft watermark for payload sizes.
soft_bytes: Option<usize>Optional soft watermark in bytes.
Implementations§
Source§impl QueueCaps
impl QueueCaps
Sourcepub const fn new(
max_items: usize,
soft_items: usize,
max_bytes: Option<usize>,
soft_bytes: Option<usize>,
) -> Self
pub const fn new( max_items: usize, soft_items: usize, max_bytes: Option<usize>, soft_bytes: Option<usize>, ) -> Self
Construct new queue caps.
Sourcepub const fn soft_items(&self) -> &usize
pub const fn soft_items(&self) -> &usize
Borrow soft_items.
Sourcepub const fn soft_bytes(&self) -> &Option<usize>
pub const fn soft_bytes(&self) -> &Option<usize>
Borrow soft_bytes.
Sourcepub fn below_soft(&self, items: usize, bytes: usize) -> bool
pub fn below_soft(&self, items: usize, bytes: usize) -> bool
Return true if the given occupancy is below soft watermarks.
Sourcepub fn at_or_above_hard(&self, items: usize, bytes: usize) -> bool
pub fn at_or_above_hard(&self, items: usize, bytes: usize) -> bool
Return true if the occupancy is at or above hard cap.
Trait Implementations§
impl Copy for QueueCaps
impl Eq for QueueCaps
impl StructuralPartialEq for QueueCaps
Auto Trait Implementations§
impl Freeze for QueueCaps
impl RefUnwindSafe for QueueCaps
impl Send for QueueCaps
impl Sync for QueueCaps
impl Unpin for QueueCaps
impl UnsafeUnpin for QueueCaps
impl UnwindSafe for QueueCaps
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
Mutably borrows from an owned value. Read more