pub trait Compose {
// Required methods
fn compose_len(&self) -> usize;
fn compose<B: BufMut>(&self, buf: &mut B);
}Expand description
A type that knows how to compose itself.
The term ‘composing’ refers to the process of creating a DNS wire-format
representation of a value’s data. This happens by appending appending
this data to the end of a type implementing the BufMut trait.
Required Methods§
Sourcefn compose_len(&self) -> usize
fn compose_len(&self) -> usize
Returns the number of bytes this value will need without compression.
Sourcefn compose<B: BufMut>(&self, buf: &mut B)
fn compose<B: BufMut>(&self, buf: &mut B)
Appends the uncompressed representation of this value to buf.
An implementation may assume that the buffer has at least as many
bytes remaining as the amount a call to compose_len() would return
right now. If that’s not the case, the implementation should panic.
That is, the implementation can use buf‘s put_*() methods
unchecked.
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.