[][src]Struct yamakan::Budget

pub struct Budget {
    pub amount: u64,
    pub consumption: u64,
}

Budget.

Fields

amount: u64

The amount of this budget.

consumption: u64

The consumption of this budget.

Note that this value can exceed the budget amount.

Methods

impl Budget[src]

pub const fn new(amount: u64) -> Self[src]

Makes a new Budget instance which has the given amount of budget.

pub fn remaining(&self) -> Result<u64, u64>[src]

Returns the remaining amount of this budget.

Errors

If the consumption of the budget exceeded the budget amount, Err(excess amount) will be returned.

pub fn is_consumed(&self) -> bool[src]

Returns true if the consumption has exceeded the budget amount, otherwise false.

Trait Implementations

impl Clone for Budget[src]

impl Copy for Budget[src]

impl Debug for Budget[src]

Auto Trait Implementations

impl RefUnwindSafe for Budget

impl Send for Budget

impl Sync for Budget

impl Unpin for Budget

impl UnwindSafe for Budget

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,