[][src]Struct solid::int::Int

pub struct Int<'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 int<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 = Int<256, 32>(&[0u8; 32]);
let int200 = Int<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 Int<'a, N, M> where
    [u8; M]: LengthAtMost32,
    [u8; M]: LengthAtLeast1
[src]

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

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

Auto Trait Implementations

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

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

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

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

impl<'a, const N: usize, const M: usize> UnwindSafe for Int<'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>,