pub struct Capacity(/* private fields */);
Expand description
CKB capacity.
It is encoded as the amount of Shannons
internally.
Implementations§
Source§impl Capacity
impl Capacity
Sourcepub fn safe_add<C: IntoCapacity>(self, rhs: C) -> Result<Self>
pub fn safe_add<C: IntoCapacity>(self, rhs: C) -> Result<Self>
Adds self and rhs and checks overflow error.
Sourcepub fn safe_sub<C: IntoCapacity>(self, rhs: C) -> Result<Self>
pub fn safe_sub<C: IntoCapacity>(self, rhs: C) -> Result<Self>
Subtracts self and rhs and checks overflow error.
Sourcepub fn safe_mul<C: IntoCapacity>(self, rhs: C) -> Result<Self>
pub fn safe_mul<C: IntoCapacity>(self, rhs: C) -> Result<Self>
Multiplies self and rhs and checks overflow error.
Sourcepub fn safe_mul_ratio(self, ratio: Ratio) -> Result<Self>
pub fn safe_mul_ratio(self, ratio: Ratio) -> Result<Self>
Multiplies self with a ratio and checks overflow error.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Capacity
impl<'de> Deserialize<'de> for Capacity
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl IntoCapacity for Capacity
impl IntoCapacity for Capacity
Source§fn into_capacity(self) -> Capacity
fn into_capacity(self) -> Capacity
Converts
self
into Capacity
.Source§impl Ord for Capacity
impl Ord for Capacity
Source§impl PartialOrd for Capacity
impl PartialOrd for Capacity
impl Copy for Capacity
impl Eq for Capacity
impl StructuralPartialEq for Capacity
Auto Trait Implementations§
impl Freeze for Capacity
impl RefUnwindSafe for Capacity
impl Send for Capacity
impl Sync for Capacity
impl Unpin for Capacity
impl UnwindSafe for Capacity
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)