[]Struct ckb_types::core::Capacity

pub struct Capacity(_);

CKB capacity.

It is encoded as the amount of Shannons internally.

Implementations

impl Capacity

pub const fn zero() -> Capacity

Capacity of zero Shannons.

pub const fn one() -> Capacity

Capacity of one Shannon.

pub const fn shannons(val: u64) -> Capacity

Views the capacity as Shannons.

pub fn bytes(val: usize) -> Result<Capacity, Error>

Views the capacity as CKBytes.

pub fn as_u64(self) -> u64

Views the capacity as Shannons.

pub fn safe_add<C>(self, rhs: C) -> Result<Capacity, Error> where
    C: AsCapacity, 

Adds self and rhs and checks overflow error.

pub fn safe_sub<C>(self, rhs: C) -> Result<Capacity, Error> where
    C: AsCapacity, 

Subtracts self and rhs and checks overflow error.

pub fn safe_mul<C>(self, rhs: C) -> Result<Capacity, Error> where
    C: AsCapacity, 

Multiplies self and rhs and checks overflow error.

pub fn safe_mul_ratio(self, ratio: Ratio) -> Result<Capacity, Error>

Multiplies self with a ratio and checks overflow error.

Trait Implementations

impl AsCapacity for Capacity

impl Clone for Capacity

impl Copy for Capacity

impl Debug for Capacity

impl Default for Capacity

impl<'de> Deserialize<'de> for Capacity

impl Display for Capacity

impl Eq for Capacity

impl FromStr for Capacity

type Err = ParseIntError

The associated error which can be returned from parsing.

impl Hash for Capacity

impl LowerHex for Capacity

impl Ord for Capacity

impl Pack<Uint64> for Capacity[src]

impl PartialEq<Capacity> for Capacity

impl PartialOrd<Capacity> for Capacity

impl Serialize for Capacity

impl StructuralEq for Capacity

impl StructuralPartialEq for Capacity

impl<'r> Unpack<Capacity> for Uint64Reader<'r>[src]

impl Unpack<Capacity> for Uint64[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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,