[][src]Struct solid::int::Uint

pub struct Uint<'a, const N: usize, const M: usize>(pub &'a [u8; M])
where
    [u8; M]: LengthAtMost32,
    [u8; M]: LengthAtLeast1
;

A simpler structure to represent all Solidity uint<N> types using const generics

Due to const generics not being stable, the user would be required to specify both the size in bites and bytes (N and M respectively) for each type. N MUST be equal to M * 8.

let int256 = Uint<256, 32>(&[0u8; 32]);
let int200 = Uint<200, 25>(&[0u8; 25]);

Note: It's very easy to missuse this structure because the even though the struct requries both the number of bits and bytes to be supplied, it cannot validate that N = M * 8 which is why it's not recommend to use this until const generics are stable.

Trait Implementations

impl<'a, const N: usize, const M: usize> Decode<'a> for Uint<'a, N, M> where
    [u8; M]: LengthAtMost32,
    [u8; M]: LengthAtLeast1
[src]

impl<'a, const N: usize, const M: usize> Encode for Uint<'a, N, M> where
    [u8; M]: LengthAtMost32,
    [u8; M]: LengthAtLeast1
[src]

impl<'a, const N: usize, const M: usize> IntoType for Uint<'a, N, M> where
    [u8; M]: LengthAtMost32,
    [u8; M]: LengthAtLeast1
[src]

Auto Trait Implementations

impl<'a, const N: usize, const M: usize> RefUnwindSafe for Uint<'a, N, M>

impl<'a, const N: usize, const M: usize> Send for Uint<'a, N, M>

impl<'a, const N: usize, const M: usize> Sync for Uint<'a, N, M>

impl<'a, const N: usize, const M: usize> Unpin for Uint<'a, N, M>

impl<'a, const N: usize, const M: usize> UnwindSafe for Uint<'a, N, M>

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> From<T> for T[src]

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

impl<T> Same<T> for T

type Output = T

Should always be Self

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