pub enum Versioned<'buf> {
V211(Element<'buf>),
V221(Element<'buf>),
}
Expand description
A json::Element
that has been parsed by the either the parse_with_version
or parse
functions
and was determined to be one of the supported Version
s.
Variants§
V211(Element<'buf>)
The parsing function determined that this is a v211 CDR.
V221(Element<'buf>)
The parsing function determined that this is a v221 CDR.
Implementations§
Source§impl<'buf> Versioned<'buf>
impl<'buf> Versioned<'buf>
Sourcepub fn into_element(self) -> Element<'buf>
pub fn into_element(self) -> Element<'buf>
Return the inner json::Element
and discard the version info.
Sourcepub fn as_element(&self) -> &Element<'buf>
pub fn as_element(&self) -> &Element<'buf>
Return the inner json::Element
and discard the version info.
Examples found in repository?
examples/price_cdr_with_unknown_version.rs (line 87)
77fn print_timezone_warnings(
78 cdr: &cdr::Versioned<'_>,
79 warnings: &warning::Report<timezone::WarningKind>,
80) {
81 if warnings.is_empty() {
82 return;
83 }
84
85 eprintln!("WARN: {} warnings from the timezone search", warnings.len());
86
87 for warning::ElementReport { element, warnings } in warnings.iter(cdr.as_element()) {
88 eprintln!(
89 "Warnings reported for `json::Element` at path: `{}`",
90 element.path()
91 );
92
93 for warning in warnings {
94 eprintln!(" * {warning}");
95 }
96
97 eprintln!();
98 }
99}
Trait Implementations§
Auto Trait Implementations§
impl<'buf> Freeze for Versioned<'buf>
impl<'buf> RefUnwindSafe for Versioned<'buf>
impl<'buf> !Send for Versioned<'buf>
impl<'buf> !Sync for Versioned<'buf>
impl<'buf> Unpin for Versioned<'buf>
impl<'buf> UnwindSafe for Versioned<'buf>
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