Skip to main content

BinEncodable

Trait BinEncodable 

Source
pub trait BinEncodable {
    // Required method
    fn emit(&self, encoder: &mut BinEncoder<'_>) -> ProtoResult<()>;

    // Provided method
    fn to_bytes(&self) -> ProtoResult<Vec<u8>> { ... }
}
Expand description

A type which can be encoded into a DNS binary format

Required Methods§

Source

fn emit(&self, encoder: &mut BinEncoder<'_>) -> ProtoResult<()>

Write the type to the stream

Provided Methods§

Source

fn to_bytes(&self) -> ProtoResult<Vec<u8>>

Returns the object in binary form

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl BinEncodable for Ipv4Addr

Source§

fn emit(&self, encoder: &mut BinEncoder<'_>) -> ProtoResult<()>

Source§

impl BinEncodable for Ipv6Addr

Source§

fn emit(&self, encoder: &mut BinEncoder<'_>) -> ProtoResult<()>

Source§

impl BinEncodable for Vec<u8>

Source§

fn emit(&self, encoder: &mut BinEncoder<'_>) -> ProtoResult<()>

Source§

impl BinEncodable for i32

Source§

fn emit(&self, encoder: &mut BinEncoder<'_>) -> ProtoResult<()>

Source§

impl BinEncodable for u16

Source§

fn emit(&self, encoder: &mut BinEncoder<'_>) -> ProtoResult<()>

Source§

impl BinEncodable for u32

Source§

fn emit(&self, encoder: &mut BinEncoder<'_>) -> ProtoResult<()>

Implementors§