pub trait MessageWrite {
type Output;
// Required methods
fn mut_data(&mut self) -> &mut [u8] ⓘ;
fn data(&self) -> &[u8] ⓘ;
fn len(&self) -> usize;
fn push_data(&mut self, data: &[u8]);
fn push_attribute_unchecked(&mut self, attr: &dyn AttributeWrite);
fn finish(self) -> Self::Output;
// Provided methods
fn max_size(&self) -> Option<usize> { ... }
fn has_attribute(&self, atype: AttributeType) -> bool { ... }
fn has_any_attribute(
&self,
atypes: &[AttributeType],
) -> Option<AttributeType> { ... }
}
Expand description
Trait for implementing a writer for Message
s.
Required Associated Types§
Sourcetype Output
type Output
The output of this MessageWrite
Required Methods§
Sourcefn push_attribute_unchecked(&mut self, attr: &dyn AttributeWrite)
fn push_attribute_unchecked(&mut self, attr: &dyn AttributeWrite)
Write an attribute to the end of the Message.
Provided Methods§
Sourcefn max_size(&self) -> Option<usize>
fn max_size(&self) -> Option<usize>
Return the maximum size of the output. If the output data is not bound to a fixed size,
None
should be returned.
Sourcefn has_attribute(&self, atype: AttributeType) -> bool
fn has_attribute(&self, atype: AttributeType) -> bool
Return whether this MessageWrite
contains a particular attribute.
Sourcefn has_any_attribute(&self, atypes: &[AttributeType]) -> Option<AttributeType>
fn has_any_attribute(&self, atypes: &[AttributeType]) -> Option<AttributeType>
Return whether this MessageWrite
contains any of the provided attributes and
returns the attribute found.