pub trait Compose {
// Required method
fn compose<T: OctetsBuilder + AsMut<[u8]>>(
&self,
target: &mut T
) -> Result<(), ShortBuf>;
// Provided method
fn compose_canonical<T: OctetsBuilder + AsMut<[u8]>>(
&self,
target: &mut T
) -> Result<(), ShortBuf> { ... }
}
Expand description
A type that knows how to compose itself into an octets builder.
The term ‘composing’ refers to the process of creating a DNS wire-format representation of a value’s data by appending this representation to the end of an octets builder.
The trait supports two different representations: a concrete and a
canonical representation. The former represents the actual data of the
value. For instance, it reflects the capitalisation of strings. The
canonical representation is used when calculating digests or ordering
values. Typically, it ignores capitalization and never compresses domain
names. See the documentation of CanonicalOrd
for more details on
canonical representation.
Required Methods§
sourcefn compose<T: OctetsBuilder + AsMut<[u8]>>(
&self,
target: &mut T
) -> Result<(), ShortBuf>
fn compose<T: OctetsBuilder + AsMut<[u8]>>( &self, target: &mut T ) -> Result<(), ShortBuf>
Appends the concrete representation of the value to the target.
If the representation doesn’t fit into the builder, returns an error. In this case the target is considered undefined. If it is supposed to be reused, it needs to be reset specifically.
Provided Methods§
sourcefn compose_canonical<T: OctetsBuilder + AsMut<[u8]>>(
&self,
target: &mut T
) -> Result<(), ShortBuf>
fn compose_canonical<T: OctetsBuilder + AsMut<[u8]>>( &self, target: &mut T ) -> Result<(), ShortBuf>
Appends the canonical representation of the value to the target.
If the representation doesn’t fit into the builder, returns an error. In this case the target is considered undefined. If it is supposed to be reused, it needs to be reset specifically.