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>(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.
Sourcepub 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.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Capacity
impl<'de> Deserialize<'de> for Capacity
Source§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
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
Source§impl Serialize for Capacity
impl Serialize for Capacity
Source§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
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
)