pub struct RoleCostCap { /* private fields */ }Expand description
Cost cap of an agent role over a calendar period.
§Examples
use ironflow_core::agent_role::{CostPeriod, RoleCostCap};
use rust_decimal::Decimal;
let cap = RoleCostCap::per_month(Decimal::new(50, 0));
assert_eq!(cap.limit_usd(), Decimal::new(50, 0));
assert_eq!(cap.period(), CostPeriod::Month);Implementations§
Source§impl RoleCostCap
impl RoleCostCap
Sourcepub fn per_day(limit_usd: Decimal) -> RoleCostCap
pub fn per_day(limit_usd: Decimal) -> RoleCostCap
Sourcepub fn per_month(limit_usd: Decimal) -> RoleCostCap
pub fn per_month(limit_usd: Decimal) -> RoleCostCap
Sourcepub fn limit_usd(&self) -> Decimal
pub fn limit_usd(&self) -> Decimal
The cap, in USD.
§Examples
use ironflow_core::agent_role::RoleCostCap;
use rust_decimal::Decimal;
assert_eq!(RoleCostCap::per_day(Decimal::TWO).limit_usd(), Decimal::TWO);Sourcepub fn period(&self) -> CostPeriod
pub fn period(&self) -> CostPeriod
The period the cap applies to.
§Examples
use ironflow_core::agent_role::{CostPeriod, RoleCostCap};
use rust_decimal::Decimal;
assert_eq!(RoleCostCap::per_day(Decimal::TWO).period(), CostPeriod::Day);Trait Implementations§
Source§impl Clone for RoleCostCap
impl Clone for RoleCostCap
Source§fn clone(&self) -> RoleCostCap
fn clone(&self) -> RoleCostCap
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for RoleCostCap
Source§impl Debug for RoleCostCap
impl Debug for RoleCostCap
impl Eq for RoleCostCap
Source§impl PartialEq for RoleCostCap
impl PartialEq for RoleCostCap
impl StructuralPartialEq for RoleCostCap
Auto Trait Implementations§
impl Freeze for RoleCostCap
impl RefUnwindSafe for RoleCostCap
impl Send for RoleCostCap
impl Sync for RoleCostCap
impl Unpin for RoleCostCap
impl UnsafeUnpin for RoleCostCap
impl UnwindSafe for RoleCostCap
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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
Compare self to
key and return true if they are equal.