pub enum ReadLimit {
Unbounded,
Count(usize),
Bytes(usize),
CountOrBytes(CountOrBytes),
}Variants§
Implementations§
Source§impl ReadLimit
impl ReadLimit
pub fn is_unbounded(&self) -> bool
pub fn is_bounded(&self) -> bool
pub fn from_count_and_bytes(count: Option<usize>, bytes: Option<usize>) -> Self
pub fn count(&self) -> Option<usize>
pub fn bytes(&self) -> Option<usize>
pub fn into_allowance(self, max: CountOrBytes) -> CountOrBytes
pub fn allow(&self, additional_count: usize, additional_bytes: usize) -> bool
pub fn deny(&self, additional_count: usize, additional_bytes: usize) -> bool
Sourcepub fn remaining(
&self,
consumed_count: usize,
consumed_bytes: usize,
) -> EvaluatedReadLimit
pub fn remaining( &self, consumed_count: usize, consumed_bytes: usize, ) -> EvaluatedReadLimit
Given the amount of records already consumed, generate a new ReadLimit representing
the remaining limit, or none if the limit has been met.
Trait Implementations§
impl Copy for ReadLimit
impl Eq for ReadLimit
impl StructuralPartialEq for ReadLimit
Auto Trait Implementations§
impl Freeze for ReadLimit
impl RefUnwindSafe for ReadLimit
impl Send for ReadLimit
impl Sync for ReadLimit
impl Unpin for ReadLimit
impl UnwindSafe for ReadLimit
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