pub trait ToBytes<W>where
    W: Write,{
    // Required method
    fn to_bytes(&self, writer: &mut W) -> Result<(), Error>;
}
Expand description

A trait for converting a value to bytes.

Required Methods§

source

fn to_bytes(&self, writer: &mut W) -> Result<(), Error>

Converts the given value into &[u8] in the given writer.

Implementations on Foreign Types§

source§

impl<W> ToBytes<W> for u8where W: Write,

Encode a u8 into a byte (well, it’s already a byte!).

source§

fn to_bytes(&self, writer: &mut W) -> Result<(), Error>

source§

impl<W> ToBytes<W> for Stringwhere W: Write,

Encode a String into bytes.

Decoder is decoders::binary::string.

source§

fn to_bytes(&self, writer: &mut W) -> Result<(), Error>

source§

impl<W, I> ToBytes<W> for Vec<I, Global>where W: Write, I: ToBytes<W>,

Encode a vector into bytes.

Decoder is decoders::binary::list.

source§

fn to_bytes(&self, writer: &mut W) -> Result<(), Error>

source§

impl<W> ToBytes<W> for u64where W: Write,

Encode a u64 into bytes with a LEB128 representation.

Decoder is decoders::binary::uleb.

source§

fn to_bytes(&self, writer: &mut W) -> Result<(), Error>

source§

impl<W> ToBytes<W> for &strwhere W: Write,

Encode a str into bytes.

Decoder is decoders::binary::string.

source§

fn to_bytes(&self, writer: &mut W) -> Result<(), Error>

Implementors§

source§

impl<W> ToBytes<W> for InterfaceKindwhere W: Write,

Encode an InterfaceKind into bytes.

source§

impl<W> ToBytes<W> for Typewhere W: Write,

Encode a Type into bytes.

Decoder is in decoders::binary::types.

source§

impl<W> ToBytes<W> for TypeKindwhere W: Write,

Encode a TypeKind into bytes.

source§

impl<W> ToBytes<W> for ITypewhere W: Write,

Encode an IType into bytes.

source§

impl<W> ToBytes<W> for Instructionwhere W: Write,

Encode an Instruction into bytes.

Decoder is decoders::binary::instruction.

source§

impl<W> ToBytes<W> for Adapterwhere W: Write,

Encode an Adapter into bytes.

Decoder is in decoders::binary::adapters.

source§

impl<W> ToBytes<W> for Export<'_>where W: Write,

Encode an Export into bytes.

Decoder is in decoders::binary::exports.

source§

impl<W> ToBytes<W> for FunctionArgwhere W: Write,

source§

impl<W> ToBytes<W> for Implementationwhere W: Write,

Encode an Implementation into bytes.

Decoder is in decoders::binary::implementations.

source§

impl<W> ToBytes<W> for Import<'_>where W: Write,

Encode an Import into bytes.

Decoder is in decoders::binary::imports.

source§

impl<W> ToBytes<W> for Interfaces<'_>where W: Write,

Encode an Interfaces into bytes.

Decoder is decoders::binary::parse.

source§

impl<W> ToBytes<W> for RecordFieldTypewhere W: Write,

Encode a RecordType into bytes.

source§

impl<W> ToBytes<W> for RecordTypewhere W: Write,

Encode a RecordType into bytes.