pub struct Inferrer<'a> { /* private fields */ }
Expand description
Keeps track of a sequence of example inputs, and can be converted into an inferred schema.
Implementations§
Source§impl<'a> Inferrer<'a>
impl<'a> Inferrer<'a>
Sourcepub fn new(hints: Hints<'a>) -> Self
pub fn new(hints: Hints<'a>) -> Self
Constructs a new inferrer with a given set of hints.
See the documentation for Hints
for details on what affect they have
on Inferrer::infer
.
Sourcepub fn infer(self, value: Value) -> Self
pub fn infer(self, value: Value) -> Self
“Updates” the inference given an example data.
Note that though the previous sentence uses the word “update”, in Rust
ownership terms this method moves self
.
Sourcepub fn into_schema(self) -> Schema
pub fn into_schema(self) -> Schema
Converts the inference to a JSON Type Definition schema.
It is guaranteed that the resulting schema will accept all of the inputs
previously provided via Inferrer::infer
.
Auto Trait Implementations§
impl<'a> Freeze for Inferrer<'a>
impl<'a> RefUnwindSafe for Inferrer<'a>
impl<'a> Send for Inferrer<'a>
impl<'a> Sync for Inferrer<'a>
impl<'a> Unpin for Inferrer<'a>
impl<'a> UnwindSafe for Inferrer<'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