pub struct CostEstimate(/* private fields */);Expand description
Estimated cost of some usage: the charge of metered usage and the API equivalent of plan-billed usage, kept apart so an API equivalent is never summed into a charge. An estimate always holds at least one of them; usage with no price has no estimate. Provider bills stay authoritative.
Implementations§
Source§impl CostEstimate
impl CostEstimate
Sourcepub fn new(basis: CostBasis, micro_usd: u64) -> Self
pub fn new(basis: CostBasis, micro_usd: u64) -> Self
Returns an exact charge of micro_usd priced on basis.
Sourcepub fn charged(cost: PricedCost) -> Self
pub fn charged(cost: PricedCost) -> Self
Returns the estimate of metered usage charged cost.
Sourcepub fn plan_billed(equivalent: ApiEquivalentCost) -> Self
pub fn plan_billed(equivalent: ApiEquivalentCost) -> Self
Returns the estimate of plan-billed usage whose API equivalent is
equivalent.
Sourcepub fn charge(self) -> Option<PricedCost>
pub fn charge(self) -> Option<PricedCost>
Returns the estimated charge of the metered usage, or None when
none was metered.
Sourcepub fn api_equivalent(self) -> Option<ApiEquivalentCost>
pub fn api_equivalent(self) -> Option<ApiEquivalentCost>
Returns the API equivalent of the plan-billed usage, or None when
none was plan-billed.
Sourcepub fn billed_to(self, login: PlanLogin) -> Self
pub fn billed_to(self, login: PlanLogin) -> Self
Returns this estimate as plan-billed usage of login: every amount
becomes its API equivalent.
Sourcepub fn saturating_add(self, other: Self) -> Self
pub fn saturating_add(self, other: Self) -> Self
Adds other, saturating, part by part: charges to charges and API
equivalents to API equivalents. API equivalents of different logins
sum to an equivalent of no single login.
Trait Implementations§
Source§impl Clone for CostEstimate
impl Clone for CostEstimate
impl Copy for CostEstimate
Source§impl Debug for CostEstimate
impl Debug for CostEstimate
impl Eq for CostEstimate
Source§impl Hash for CostEstimate
impl Hash for CostEstimate
Source§impl PartialEq for CostEstimate
impl PartialEq for CostEstimate
impl StructuralPartialEq for CostEstimate
Auto Trait Implementations§
impl Forget for CostEstimate
impl Freeze for CostEstimate
impl Move for CostEstimate
impl RefUnwindSafe for CostEstimate
impl Send for CostEstimate
impl Sync for CostEstimate
impl Unpin for CostEstimate
impl UnsafeUnpin for CostEstimate
impl UnwindSafe for CostEstimate
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.