Trait dusk_bytes::Serializable[][src]

pub trait Serializable<const N: usize> {
    type Error;

    const SIZE: usize;

    fn from_bytes(buf: &[u8; N]) -> Result<Self, Self::Error>
    where
        Self: Sized
;
fn to_bytes(&self) -> [u8; N]; }

The core trait used to implement [from_bytes] and [to_bytes]

Associated Types

type Error[src]

The type returned in the event of a conversion error.

Loading content...

Associated Constants

const SIZE: usize[src]

The size of

Loading content...

Required methods

fn from_bytes(buf: &[u8; N]) -> Result<Self, Self::Error> where
    Self: Sized
[src]

Deserialize a [&[u8; N]] into Self, it might be fail.

fn to_bytes(&self) -> [u8; N][src]

Serialize Self into a [[u8; N]].

Loading content...

Implementors

impl Serializable<{ core::mem::size_of::<$ty>() }> for u16[src]

type Error = Error

impl Serializable<{ core::mem::size_of::<$ty>() }> for u32[src]

type Error = Error

impl Serializable<{ core::mem::size_of::<$ty>() }> for u64[src]

type Error = Error

impl Serializable<{ core::mem::size_of::<$ty>() }> for u128[src]

type Error = Error

Loading content...