pub struct Capacity(/* private fields */);
Expand description
CKB capacity.
It is encoded as the amount of Shannons
internally.
Implementations§
§impl Capacity
impl Capacity
pub fn safe_add<C>(self, rhs: C) -> Result<Capacity, Error>where
C: IntoCapacity,
pub fn safe_add<C>(self, rhs: C) -> Result<Capacity, Error>where
C: IntoCapacity,
Adds self and rhs and checks overflow error.
pub fn safe_sub<C>(self, rhs: C) -> Result<Capacity, Error>where
C: IntoCapacity,
pub fn safe_sub<C>(self, rhs: C) -> Result<Capacity, Error>where
C: IntoCapacity,
Subtracts self and rhs and checks overflow error.
pub fn safe_mul<C>(self, rhs: C) -> Result<Capacity, Error>where
C: IntoCapacity,
pub fn safe_mul<C>(self, rhs: C) -> Result<Capacity, Error>where
C: IntoCapacity,
Multiplies self and rhs and checks overflow error.
pub fn safe_mul_ratio(self, ratio: Ratio) -> Result<Capacity, Error>
pub fn safe_mul_ratio(self, ratio: Ratio) -> Result<Capacity, Error>
Multiplies self with a ratio and checks overflow error.
Trait Implementations§
§impl<'de> Deserialize<'de> for Capacity
impl<'de> Deserialize<'de> for Capacity
§fn deserialize<__D>(
__deserializer: __D
) -> Result<Capacity, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<Capacity, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
§impl IntoCapacity for Capacity
impl IntoCapacity for Capacity
§fn into_capacity(self) -> Capacity
fn into_capacity(self) -> Capacity
Converts
self
into Capacity
.§impl Ord for Capacity
impl Ord for Capacity
§impl PartialOrd for Capacity
impl PartialOrd for Capacity
§fn partial_cmp(&self, other: &Capacity) -> Option<Ordering>
fn partial_cmp(&self, other: &Capacity) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read more§impl Serialize for Capacity
impl Serialize for Capacity
§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
source§impl<'r> Unpack<Capacity> for Uint64Reader<'r>
impl<'r> Unpack<Capacity> for Uint64Reader<'r>
impl Copy for Capacity
impl Eq for Capacity
impl StructuralPartialEq for Capacity
Auto Trait Implementations§
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