pub struct Versioned<'buf> { /* private fields */ }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 Versions.
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 85)
75fn print_timezone_warnings(
76 cdr: &cdr::Versioned<'_>,
77 warnings: &warning::Report<timezone::WarningKind>,
78) {
79 if warnings.is_empty() {
80 return;
81 }
82
83 eprintln!("WARN: {} warnings from the timezone search", warnings.len());
84
85 for warning::ElementReport { element, warnings } in warnings.iter(cdr.as_element()) {
86 eprintln!(
87 "Warnings reported for `json::Element` at path: `{}`",
88 element.path()
89 );
90
91 for warning in warnings {
92 eprintln!(" * {warning}");
93 }
94
95 eprintln!();
96 }
97}Sourcepub fn as_json_str(&self) -> &'buf str
pub fn as_json_str(&self) -> &'buf str
Return the inner JSON str and discard the version info.
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