Struct feeless::units::UnboundedRai[][src]

pub struct UnboundedRai(_);

The UnboundedRai (100 rai) unit denomination.

See the module documentation for more information as this is generated by a macro and it’s tricky to write docs for it :).

Implementations

impl UnboundedRai[src]

pub fn new<T: Into<BigDecimal>>(v: T) -> Self[src]

pub fn new_with_rai<T: Into<BigDecimal>>(v: T) -> Self[src]

When initializing, use a rai value intsead of this unit type.

let decimal = BigDecimal::from_str("1_000_000_000_000_000_000_000_000")?;
let cents = MicroNano::new_with_rai(decimal);
assert_eq!(cents, MicroNano::new(1));

pub fn to_rai(&self) -> Result<Rai, FeelessError>[src]

Returns a Rai.

If the converted amount is out of range of 0..u128::MAX it will return an error.

let nano = Nano::new(BigDecimal::from_str("0.000000000000000000000000000001")?);
let rai = nano.to_rai()?;
assert_eq!(rai, Rai::new(1u128));

pub fn to_unbounded_rai(&self) -> UnboundedRai[src]

pub fn to_micro_nano(&self) -> MicroNano[src]

pub fn to_cents(&self) -> Cents[src]

pub fn to_nano(&self) -> Nano[src]

pub fn to_f64(&self) -> f64[src]

pub fn to_big_decimal(&self) -> &BigDecimal[src]

Returns a BigDecimal with the value of this type.

let nano = Nano::new(1);
let decimal = nano.to_big_decimal();
assert_eq!(decimal, &BigDecimal::from_str("1")?);

pub fn to_rai_big_decimal(&self) -> BigDecimal[src]

Returns a BigDecimal with the rai value.

let nano = Nano::new(1);
let decimal = nano.to_rai_big_decimal();
assert_eq!(decimal, BigDecimal::from_str("1000000000000000000000000000000")?);

Trait Implementations

impl Add<UnboundedRai> for UnboundedRai[src]

type Output = Self

The resulting type after applying the + operator.

impl AddAssign<UnboundedRai> for UnboundedRai[src]

impl Clone for UnboundedRai[src]

impl Debug for UnboundedRai[src]

impl Div<UnboundedRai> for UnboundedRai[src]

type Output = Self

The resulting type after applying the / operator.

impl Eq for UnboundedRai[src]

impl From<&'_ Rai> for UnboundedRai[src]

impl From<Rai> for UnboundedRai[src]

impl FromStr for UnboundedRai[src]

type Err = FeelessError

The associated error which can be returned from parsing.

impl Mul<UnboundedRai> for UnboundedRai[src]

type Output = Self

The resulting type after applying the * operator.

impl MulAssign<UnboundedRai> for UnboundedRai[src]

impl PartialEq<UnboundedRai> for UnboundedRai[src]

impl StructuralEq for UnboundedRai[src]

impl StructuralPartialEq for UnboundedRai[src]

impl Sub<UnboundedRai> for UnboundedRai[src]

type Output = Self

The resulting type after applying the - operator.

impl SubAssign<UnboundedRai> for UnboundedRai[src]

impl ToString for UnboundedRai[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> Conv for T

impl<T> Conv for T

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> FmtForward for T

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

impl<T> Instrument for T[src]

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

impl<T> Pipe for T where
    T: ?Sized

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Tap for T

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

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

type Owned = T

The resulting type after obtaining ownership.

impl<T> TryConv for T

impl<T> TryConv for T

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>,