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 has been identified as being a certain Version
.
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/lint_tariff.rs (line 39)
29fn print_lint_warnings(
30 tariff: &tariff::Versioned<'_>,
31 warnings: &warning::Report<lint::tariff::WarningKind>,
32) {
33 if warnings.is_empty() {
34 return;
35 }
36
37 eprintln!("WARN: {} warnings from the linting", warnings.len());
38
39 for warning::ElementReport { element, warnings } in warnings.iter(tariff.as_element()) {
40 eprintln!(
41 "Warnings reported for `json::Element` at path: `{}`",
42 element.path()
43 );
44
45 for warning in warnings {
46 eprintln!(" * {warning}");
47 }
48
49 eprintln!();
50 }
51}
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