pub struct UnexpectedFields<'buf>(/* private fields */);
Expand description
A collection of paths that were unexpected according to the schema used while parsing the JSON for an OCPI object.
Implementations§
Source§impl<'buf> UnexpectedFields<'buf>
impl<'buf> UnexpectedFields<'buf>
pub fn to_strings(&self) -> Vec<String>
pub fn into_strings(self) -> Vec<String>
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Examples found in repository?
examples/lint_tariff.rs (line 13)
6fn main() {
7 const TARIFF_JSON: &str =
8 include_str!("../test_data/v221/real_world/misspelled_field/tariff.json");
9
10 let report = tariff::parse_and_report(TARIFF_JSON).unwrap();
11 let (tariff, unexpected_fields) = report.into_parts();
12
13 if !unexpected_fields.is_empty() {
14 eprintln!("Strange... there are fields in the tariff that are not defined in the spec.");
15
16 for path in &unexpected_fields {
17 eprintln!(" * {path}");
18 }
19
20 eprintln!();
21 }
22
23 let tariff = tariff.certain_or(Version::V221);
24 let report = tariff::lint(&tariff).unwrap();
25
26 print_lint_warnings(&tariff, &report.into_warning_report());
27}
pub fn len(&self) -> usize
pub fn iter<'a>(&'a self) -> UnexpectedFieldsIter<'a, 'buf> ⓘ
Trait Implementations§
Source§impl<'buf> Clone for UnexpectedFields<'buf>
impl<'buf> Clone for UnexpectedFields<'buf>
Source§fn clone(&self) -> UnexpectedFields<'buf>
fn clone(&self) -> UnexpectedFields<'buf>
Returns a duplicate 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<'buf> Debug for UnexpectedFields<'buf>
impl<'buf> Debug for UnexpectedFields<'buf>
Source§impl<'a, 'buf> IntoIterator for &'a UnexpectedFields<'buf>
impl<'a, 'buf> IntoIterator for &'a UnexpectedFields<'buf>
Source§impl<'buf> IntoIterator for UnexpectedFields<'buf>
impl<'buf> IntoIterator for UnexpectedFields<'buf>
Auto Trait Implementations§
impl<'buf> Freeze for UnexpectedFields<'buf>
impl<'buf> RefUnwindSafe for UnexpectedFields<'buf>
impl<'buf> !Send for UnexpectedFields<'buf>
impl<'buf> !Sync for UnexpectedFields<'buf>
impl<'buf> Unpin for UnexpectedFields<'buf>
impl<'buf> UnwindSafe for UnexpectedFields<'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