pub struct Ledger { /* private fields */ }Implementations§
Source§impl Ledger
impl Ledger
pub fn new(policy: CostPolicy) -> Self
pub fn mode(&self) -> CostMode
Sourcepub fn units_for(&self, bound: CostBound) -> Result<u64, Refused>
pub fn units_for(&self, bound: CostBound) -> Result<u64, Refused>
The units a call with this disclosure reserves under this ledger’s mode, or why it cannot be dispatched (spec 003, 3.5.3).
Sourcepub fn settle(
&self,
attempt_id: &str,
reserved: u64,
charge: Charge,
bounded: bool,
)
pub fn settle( &self, attempt_id: &str, reserved: u64, charge: Charge, bounded: bool, )
Settle a dispatched attempt’s reservation (spec 003, 3.5.4). bounded
says whether the reservation was an enforceable bound.
Sourcepub fn reconcile(&self, attempt_id: &str, observed: u64) -> bool
pub fn reconcile(&self, attempt_id: &str, observed: u64) -> bool
A later observed charge for an attempt whose cost was unknown (spec 003, 3.5.5). Returns false when the attempt has no open liability.
pub fn summary(&self) -> CostSummary
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Ledger
impl RefUnwindSafe for Ledger
impl Send for Ledger
impl Sync for Ledger
impl Unpin for Ledger
impl UnsafeUnpin for Ledger
impl UnwindSafe for Ledger
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