pub struct FieldFormatter<'f> { /* private fields */ }Expand description
A Formatter for filling a particular TTLV field.
A Formatter can delegate to a FieldFormatter to format a TTLV
field such as a structure. This provides an incremental API to fill the
field.
Implementations§
Source§impl FieldFormatter<'_>
impl FieldFormatter<'_>
Sourcepub fn finish(self) -> FormatDone
pub fn finish(self) -> FormatDone
Successfully finish formatting.
Methods from Deref<Target = Formatter<'f>>§
pub fn clear(&mut self)
Sourcepub fn filled_mut(&mut self) -> &mut [[u8; 8]]
pub fn filled_mut(&mut self) -> &mut [[u8; 8]]
The filled part of the buffer, mutably.
Sourcepub fn remaining(&mut self) -> &mut [MaybeUninit<[u8; 8]>]
pub fn remaining(&mut self) -> &mut [MaybeUninit<[u8; 8]>]
The remaining part of the buffer.
Sourcepub fn format_struct(
&mut self,
tag: Tag,
) -> Result<FieldFormatter<'_>, TruncationError>
pub fn format_struct( &mut self, tag: Tag, ) -> Result<FieldFormatter<'_>, TruncationError>
Format a structure.
The returned sub-formatter should be used to format the fields of the
struct; once it is finished, self can continue.
Sourcepub fn format_int(&mut self, tag: Tag, value: i32) -> FormatResult
pub fn format_int(&mut self, tag: Tag, value: i32) -> FormatResult
Format an integer.
Sourcepub fn format_long_int(&mut self, tag: Tag, value: i64) -> FormatResult
pub fn format_long_int(&mut self, tag: Tag, value: i64) -> FormatResult
Format a long integer.
Sourcepub fn format_big_int(&mut self, tag: Tag, value: &[u8]) -> FormatResult
pub fn format_big_int(&mut self, tag: Tag, value: &[u8]) -> FormatResult
Format a big integer.
value should be the bytewise digits of a signed (two’s complement)
big-endian integer. It will be padded (with leading sign-extension
bytes) into a multiple of 8 bytes before being stored.
§Panics
Panics if the length of value (when rounded up to a multiple of 8
bytes) does not fit in a u32.
Sourcepub fn format_enum(&mut self, tag: Tag, value: u32) -> FormatResult
pub fn format_enum(&mut self, tag: Tag, value: u32) -> FormatResult
Format an enumeration.
Sourcepub fn format_bool(&mut self, tag: Tag, value: bool) -> FormatResult
pub fn format_bool(&mut self, tag: Tag, value: bool) -> FormatResult
Format a boolean.
Sourcepub fn format_text(&mut self, tag: Tag, value: &str) -> FormatResult
pub fn format_text(&mut self, tag: Tag, value: &str) -> FormatResult
Format a text string.
Sourcepub fn format_bytes(&mut self, tag: Tag, value: &[u8]) -> FormatResult
pub fn format_bytes(&mut self, tag: Tag, value: &[u8]) -> FormatResult
Format a byte string.
Sourcepub fn format_date_time(&mut self, tag: Tag, value: i64) -> FormatResult
pub fn format_date_time(&mut self, tag: Tag, value: i64) -> FormatResult
Format a date-time.
Sourcepub fn format_interval(&mut self, tag: Tag, value: u32) -> FormatResult
pub fn format_interval(&mut self, tag: Tag, value: u32) -> FormatResult
Format an interval.