pub trait BinDecodable<'r>: Sized {
// Required method
fn read(decoder: &mut BinDecoder<'r>) -> Result<Self, ProtoError>;
// Provided method
fn from_bytes(bytes: &'r [u8]) -> Result<Self, ProtoError> { ... }
}
Expand description
A trait for types which are serializable to and from DNS binary formats
Required Methods§
Sourcefn read(decoder: &mut BinDecoder<'r>) -> Result<Self, ProtoError>
fn read(decoder: &mut BinDecoder<'r>) -> Result<Self, ProtoError>
Read the type from the stream
Provided Methods§
Sourcefn from_bytes(bytes: &'r [u8]) -> Result<Self, ProtoError>
fn from_bytes(bytes: &'r [u8]) -> Result<Self, ProtoError>
Returns the object in binary form
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl<'r> BinDecodable<'r> for i32
impl<'r> BinDecodable<'r> for i32
fn read(decoder: &mut BinDecoder<'r>) -> Result<Self, ProtoError>
Source§impl<'r> BinDecodable<'r> for u16
impl<'r> BinDecodable<'r> for u16
fn read(decoder: &mut BinDecoder<'_>) -> Result<Self, ProtoError>
Source§impl<'r> BinDecodable<'r> for u32
impl<'r> BinDecodable<'r> for u32
fn read(decoder: &mut BinDecoder<'_>) -> Result<Self, ProtoError>
Implementors§
impl<'a> BinDecodable<'a> for ClientSubnet
impl<'r> BinDecodable<'r> for DNSClass
impl<'r> BinDecodable<'r> for hickory_proto::rr::dnssec::Algorithm
Available on crate feature
dnssec
only.impl<'r> BinDecodable<'r> for hickory_proto::rr::rdata::cert::Algorithm
impl<'r> BinDecodable<'r> for CertType
impl<'r> BinDecodable<'r> for SvcParamKey
impl<'r> BinDecodable<'r> for RecordType
impl<'r> BinDecodable<'r> for Header
impl<'r> BinDecodable<'r> for Message
impl<'r> BinDecodable<'r> for Query
impl<'r> BinDecodable<'r> for LowerQuery
impl<'r> BinDecodable<'r> for NSEC3PARAM
Available on crate feature
dnssec
only.