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 has been identified as being a certain Version.
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 43)
32fn print_lint_warnings(
33 tariff: &tariff::Versioned<'_>,
34 warnings: &warning::Set<lint::tariff::WarningKind>,
35) {
36 if warnings.is_empty() {
37 return;
38 }
39
40 eprintln!(
41 "WARN: {} warnings from the linting:\n {}",
42 warnings.len(),
43 warning::SetWriter::new(tariff.as_element(), warnings)
44 );
45}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