Struct bc_envelope::base::format_context::FormatContext
source · pub struct FormatContext { /* private fields */ }Expand description
The envelope formatting functions take a FormatContext as an argument. This type
defines information about CBOR tags, known values, functions and parameters that
are used to annotate the output of the formatting functions.
The with_format_context! macro can be used to access the global format context:
with_format_context!(|context| {
assert_eq!(e.diagnostic_opt(true, Some(context)),
indoc! {r#"
200( / envelope /
24("Hello.") / leaf /
)
"#}.trim()
);
});Implementations§
source§impl FormatContext
impl FormatContext
pub fn new( tags: Option<&TagsStore>, known_values: Option<&KnownValuesStore>, functions: Option<&FunctionsStore>, parameters: Option<&ParametersStore> ) -> Self
pub fn assigned_name_for_tag(&self, tag: &Tag) -> Option<String>
pub fn name_for_tag(&self, tag: &Tag) -> String
pub fn tag_for_value(&self, value: u64) -> Option<Tag>
pub fn tag_for_name(&self, name: &str) -> Option<Tag>
pub fn known_values(&self) -> &KnownValuesStore
pub fn functions(&self) -> &FunctionsStore
pub fn parameters(&self) -> &ParametersStore
Trait Implementations§
source§impl Clone for FormatContext
impl Clone for FormatContext
source§fn clone(&self) -> FormatContext
fn clone(&self) -> FormatContext
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl Debug for FormatContext
impl Debug for FormatContext
Auto Trait Implementations§
impl RefUnwindSafe for FormatContext
impl Send for FormatContext
impl Sync for FormatContext
impl Unpin for FormatContext
impl UnwindSafe for FormatContext
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more