[][src]Struct ckb_occupied_capacity_core::Capacity

pub struct Capacity(_);

CKB capacity.

It is encoded as the amount of Shannons internally.

Implementations

impl Capacity[src]

pub const fn zero() -> Self[src]

Capacity of zero Shannons.

pub const fn one() -> Self[src]

Capacity of one Shannon.

pub const fn shannons(val: u64) -> Self[src]

Views the capacity as Shannons.

pub fn bytes(val: usize) -> Result<Self>[src]

Views the capacity as CKBytes.

pub fn as_u64(self) -> u64[src]

Views the capacity as Shannons.

pub fn safe_add<C: AsCapacity>(self, rhs: C) -> Result<Self>[src]

Adds self and rhs and checks overflow error.

pub fn safe_sub<C: AsCapacity>(self, rhs: C) -> Result<Self>[src]

Subtracts self and rhs and checks overflow error.

pub fn safe_mul<C: AsCapacity>(self, rhs: C) -> Result<Self>[src]

Multiplies self and rhs and checks overflow error.

pub fn safe_mul_ratio(self, ratio: Ratio) -> Result<Self>[src]

Multiplies self with a ratio and checks overflow error.

Trait Implementations

impl AsCapacity for Capacity[src]

impl Clone for Capacity[src]

impl Copy for Capacity[src]

impl Debug for Capacity[src]

impl Default for Capacity[src]

impl<'de> Deserialize<'de> for Capacity[src]

impl Display for Capacity[src]

impl Eq for Capacity[src]

impl FromStr for Capacity[src]

type Err = ParseIntError

The associated error which can be returned from parsing.

impl Hash for Capacity[src]

impl LowerHex for Capacity[src]

impl Ord for Capacity[src]

impl PartialEq<Capacity> for Capacity[src]

impl PartialOrd<Capacity> for Capacity[src]

impl Serialize for Capacity[src]

impl StructuralEq for Capacity[src]

impl StructuralPartialEq for Capacity[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.