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 BinDecodable<'_> for u16
impl BinDecodable<'_> for u16
fn read(decoder: &mut BinDecoder<'_>) -> Result<Self, ProtoError>
Source§impl BinDecodable<'_> for u32
impl BinDecodable<'_> for u32
fn read(decoder: &mut BinDecoder<'_>) -> Result<Self, ProtoError>
Source§impl<'r> BinDecodable<'r> for i32
impl<'r> BinDecodable<'r> for i32
fn read(decoder: &mut BinDecoder<'r>) -> Result<Self, ProtoError>
Implementors§
impl BinDecodable<'_> for DNSClass
impl BinDecodable<'_> for RecordType
impl<'a> BinDecodable<'a> for ClientSubnet
impl<'r> BinDecodable<'r> for hickory_proto::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 NSEC3PARAM
Available on crate feature
dnssec
only.