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:
assert_eq!(e.diagnostic_annotated(),
indoc! {r#"
200( / envelope /
201("Hello.") / leaf /
)
"#}.trim()
);Implementations§
Source§impl FormatContext
impl FormatContext
pub fn new( flat: bool, tags: Option<&TagsStore>, known_values: Option<&KnownValuesStore>, functions: Option<&FunctionsStore>, parameters: Option<&ParametersStore>, ) -> Self
pub fn is_flat(&self) -> bool
pub fn set_flat(self, flat: bool) -> Self
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 Default for FormatContext
impl Default for FormatContext
Source§impl TagsStoreTrait for FormatContext
impl TagsStoreTrait for FormatContext
fn assigned_name_for_tag(&self, tag: &Tag) -> Option<String>
fn name_for_tag(&self, tag: &Tag) -> String
fn tag_for_name(&self, name: &str) -> Option<Tag>
fn tag_for_value(&self, value: u64) -> Option<Tag>
fn summarizer(&self, tag: TagValue) -> Option<&CBORSummarizer>
fn name_for_value(&self, value: u64) -> String
fn name_for_tag_opt<T>(tag: &Tag, tags: Option<&T>) -> Stringwhere
T: TagsStoreTrait,
Self: Sized,
Auto Trait Implementations§
impl Freeze for FormatContext
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more