pub struct InlineBudget {
pub total_budget: u64,
pub consumed: u64,
pub reserved_always: u64,
pub per_fn_limit: HashMap<String, u64>,
pub per_fn_spent: HashMap<String, u64>,
}Fields§
§total_budget: u64§consumed: u64§reserved_always: u64§per_fn_limit: HashMap<String, u64>§per_fn_spent: HashMap<String, u64>Implementations§
Source§impl InlineBudget
impl InlineBudget
pub fn new(total_budget: u64) -> Self
pub fn set_fn_limit(&mut self, fn_name: impl Into<String>, limit: u64)
pub fn try_spend(&mut self, caller: &str, cost: u64) -> bool
pub fn remaining(&self) -> u64
pub fn is_exhausted(&self) -> bool
pub fn fraction_consumed(&self) -> f64
pub fn reset_per_fn(&mut self)
pub fn heavy_spenders(&self, threshold: u64) -> Vec<(&str, u64)>
Trait Implementations§
Source§impl Clone for InlineBudget
impl Clone for InlineBudget
Source§fn clone(&self) -> InlineBudget
fn clone(&self) -> InlineBudget
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 InlineBudget
impl RefUnwindSafe for InlineBudget
impl Send for InlineBudget
impl Sync for InlineBudget
impl Unpin for InlineBudget
impl UnsafeUnpin for InlineBudget
impl UnwindSafe for InlineBudget
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