Struct HintSet

Source
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>

Source

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.