pub struct StructFieldTracker<'a> { /* private fields */ }Expand description
Tracks which fields have been seen while deserializing a struct.
This is the first building block of the shared visitor requested in issue #1127 – it centralizes duplicate detection, unknown-field tracking, and default synthesis hooks so individual format crates don’t have to reimplement the bookkeeping.
Implementations§
Source§impl<'a> StructFieldTracker<'a>
impl<'a> StructFieldTracker<'a>
Sourcepub fn new(resolution: &'a Resolution) -> Self
pub fn new(resolution: &'a Resolution) -> Self
Create a tracker for the given resolution.
Sourcepub fn record(&mut self, name: &str) -> FieldMatch<'a>
pub fn record(&mut self, name: &str) -> FieldMatch<'a>
Record an incoming serialized field and classify it.
Sourcepub fn missing_required(&self) -> Vec<&'static str>
pub fn missing_required(&self) -> Vec<&'static str>
Return serialized names for required fields that have not been seen yet.
Sourcepub fn missing_optional(&self) -> impl Iterator<Item = &'a FieldInfo>
pub fn missing_optional(&self) -> impl Iterator<Item = &'a FieldInfo>
Iterate over optional fields that are still unset (useful for defaults).
Auto Trait Implementations§
impl<'a> Freeze for StructFieldTracker<'a>
impl<'a> RefUnwindSafe for StructFieldTracker<'a>
impl<'a> Send for StructFieldTracker<'a>
impl<'a> Sync for StructFieldTracker<'a>
impl<'a> Unpin for StructFieldTracker<'a>
impl<'a> UnwindSafe for StructFieldTracker<'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