pub struct HintSet<'a> { /* private fields */ }
Expand description
A set of paths to parts of the input that are subject to a hint in
Hints
.
Implementations§
Source§impl<'a> HintSet<'a>
impl<'a> HintSet<'a>
Sourcepub fn new(values: Vec<&'a [String]>) -> Self
pub fn new(values: Vec<&'a [String]>) -> Self
Constructs a new HintSet
.
Each element of values
is a separate “path”. Each element of a path is
treated as a path “segment”. So, for example, this:
use jtd_infer::HintSet;
let path1 = vec!["foo".to_string(), "bar".to_string()];
let path2 = vec!["baz".to_string()];
HintSet::new(vec![&path1, &path2]);
Creates a set of paths pointing to /foo/bar
and /baz
in an input.
The -
path segment value is special, and acts as a wildcard, matching
any property name. It also matches array elements, unlike ordinary path
segments.
Auto Trait Implementations§
impl<'a> Freeze for HintSet<'a>
impl<'a> RefUnwindSafe for HintSet<'a>
impl<'a> Send for HintSet<'a>
impl<'a> Sync for HintSet<'a>
impl<'a> Unpin for HintSet<'a>
impl<'a> UnwindSafe for HintSet<'a>
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