pub struct BudgetUsage {
pub bytes_used: usize,
pub lines_used: usize,
pub max_bytes: usize,
pub max_lines: usize,
}Expand description
Information about packet budget usage.
Fields§
§bytes_used: usizeCurrent bytes used.
lines_used: usizeCurrent lines used.
max_bytes: usizeMaximum bytes allowed.
max_lines: usizeMaximum lines allowed.
Implementations§
Source§impl BudgetUsage
impl BudgetUsage
Sourcepub const fn new(max_bytes: usize, max_lines: usize) -> BudgetUsage
pub const fn new(max_bytes: usize, max_lines: usize) -> BudgetUsage
Create a new budget tracker.
Sourcepub const fn would_exceed(&self, bytes: usize, lines: usize) -> bool
pub const fn would_exceed(&self, bytes: usize, lines: usize) -> bool
Check if adding content would exceed budget.
Sourcepub const fn add_content(&mut self, bytes: usize, lines: usize)
pub const fn add_content(&mut self, bytes: usize, lines: usize)
Add content to budget tracking.
Sourcepub const fn is_exceeded(&self) -> bool
pub const fn is_exceeded(&self) -> bool
Check if budget is exceeded.
Trait Implementations§
Source§impl Clone for BudgetUsage
impl Clone for BudgetUsage
Source§fn clone(&self) -> BudgetUsage
fn clone(&self) -> BudgetUsage
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for BudgetUsage
impl RefUnwindSafe for BudgetUsage
impl Send for BudgetUsage
impl Sync for BudgetUsage
impl Unpin for BudgetUsage
impl UnsafeUnpin for BudgetUsage
impl UnwindSafe for BudgetUsage
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