snarkvm_utilities::bytes

Trait ToBytes

Source
pub trait ToBytes {
    // Required method
    fn write_le<W: Write>(&self, writer: W) -> IoResult<()>
       where Self: Sized;

    // Provided method
    fn to_bytes_le(&self) -> Result<Vec<u8>>
       where Self: Sized { ... }
}

Required Methods§

Source

fn write_le<W: Write>(&self, writer: W) -> IoResult<()>
where Self: Sized,

Writes self into writer as little-endian bytes.

Provided Methods§

Source

fn to_bytes_le(&self) -> Result<Vec<u8>>
where Self: Sized,

Returns self as a byte array in little-endian order.

Implementations on Foreign Types§

Source§

impl ToBytes for SocketAddr

Source§

fn write_le<W: Write>(&self, writer: W) -> IoResult<()>

Source§

impl ToBytes for bool

Source§

fn write_le<W: Write>(&self, writer: W) -> IoResult<()>

Source§

impl ToBytes for i8

Source§

fn write_le<W: Write>(&self, writer: W) -> IoResult<()>

Source§

impl ToBytes for i16

Source§

fn write_le<W: Write>(&self, writer: W) -> IoResult<()>

Source§

impl ToBytes for i32

Source§

fn write_le<W: Write>(&self, writer: W) -> IoResult<()>

Source§

impl ToBytes for i64

Source§

fn write_le<W: Write>(&self, writer: W) -> IoResult<()>

Source§

impl ToBytes for i128

Source§

fn write_le<W: Write>(&self, writer: W) -> IoResult<()>

Source§

impl ToBytes for u8

Source§

fn write_le<W: Write>(&self, writer: W) -> IoResult<()>

Source§

impl ToBytes for u16

Source§

fn write_le<W: Write>(&self, writer: W) -> IoResult<()>

Source§

impl ToBytes for u32

Source§

fn write_le<W: Write>(&self, writer: W) -> IoResult<()>

Source§

impl ToBytes for u64

Source§

fn write_le<W: Write>(&self, writer: W) -> IoResult<()>

Source§

impl ToBytes for u128

Source§

fn write_le<W: Write>(&self, writer: W) -> IoResult<()>

Source§

impl ToBytes for ()

Source§

fn write_le<W: Write>(&self, _writer: W) -> IoResult<()>

Source§

impl<'a, T: 'a + ToBytes> ToBytes for &'a [T]

Source§

fn write_le<W: Write>(&self, writer: W) -> IoResult<()>

Source§

impl<'a, T: 'a + ToBytes> ToBytes for &'a T

Source§

fn write_le<W: Write>(&self, writer: W) -> IoResult<()>

Source§

impl<L: ToBytes, R: ToBytes> ToBytes for (L, R)

Source§

fn write_le<W: Write>(&self, writer: W) -> IoResult<()>

Source§

impl<const N: usize> ToBytes for [u8; N]

Source§

fn write_le<W: Write>(&self, writer: W) -> IoResult<()>

Source§

impl<const N: usize> ToBytes for [u16; N]

Source§

fn write_le<W: Write>(&self, writer: W) -> IoResult<()>

Source§

impl<const N: usize> ToBytes for [u32; N]

Source§

fn write_le<W: Write>(&self, writer: W) -> IoResult<()>

Source§

impl<const N: usize> ToBytes for [u64; N]

Source§

fn write_le<W: Write>(&self, writer: W) -> IoResult<()>

Implementors§