Struct PullBatchLimit
pub struct PullBatchLimit { /* private fields */ }Expand description
A running budget for filling one pull response.
Exists because “one round trip” is a size constraint as much as a protocol one: an adapter has to stop adding groups before it exceeds what it declared, and every adapter would otherwise write the same three comparisons slightly differently.
Implementations§
§impl PullBatchLimit
impl PullBatchLimit
pub fn admits(&self, group: &EventGroup) -> bool
pub fn admits(&self, group: &EventGroup) -> bool
Whether group still fits.
An oversized single event returns false for ever, which is correct and
is why PeerLimits::retention_floor exists: the runner has to be able
to tell “wait” from “this will never move”.
pub fn charge(&mut self, group: &EventGroup)
pub fn charge(&mut self, group: &EventGroup)
Deducts group from the budget.
Saturating rather than wrapping: a budget that underflows to usize::MAX
would admit everything after it, which is the opposite of what a limit is
for.
Trait Implementations§
§impl Clone for PullBatchLimit
impl Clone for PullBatchLimit
impl Copy for PullBatchLimit
§impl Debug for PullBatchLimit
impl Debug for PullBatchLimit
§impl From<&PeerLimits> for PullBatchLimit
impl From<&PeerLimits> for PullBatchLimit
§fn from(limits: &PeerLimits) -> Self
fn from(limits: &PeerLimits) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for PullBatchLimit
impl RefUnwindSafe for PullBatchLimit
impl Send for PullBatchLimit
impl Sync for PullBatchLimit
impl Unpin for PullBatchLimit
impl UnsafeUnpin for PullBatchLimit
impl UnwindSafe for PullBatchLimit
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