pub struct FieldIterator<'bytes, 'parent, B, S>{ /* private fields */ }
Expand description
An iterator over fields.
Implementations§
Source§impl<'bytes, 'parent, B, S> FieldIterator<'bytes, 'parent, B, S>
impl<'bytes, 'parent, B, S> FieldIterator<'bytes, 'parent, B, S>
Sourcepub fn next(
&mut self,
) -> Option<Result<(impl Iterator<Item = Result<char, JsonError<'bytes, B, S>>> + use<'bytes, B, S>, Value<'bytes, '_, B, S>), JsonError<'bytes, B, S>>>
pub fn next( &mut self, ) -> Option<Result<(impl Iterator<Item = Result<char, JsonError<'bytes, B, S>>> + use<'bytes, B, S>, Value<'bytes, '_, B, S>), JsonError<'bytes, B, S>>>
The next entry (key, value) within the object.
The key is presented as an iterator over the characters within the serialized string, with
the escape sequences handled. If the key specifies invalid UTF characters, the iterator will
yield an error when it attempts to parse them. While it may not be possible to parse a key
as UTF characters, decoding of this field’s value (and the rest of the structure) is still
possible (even after the iterator yields its error). For more information, please refer to
Value::to_str
.
This is approximate to Iterator::next
yet each item maintains a mutable reference to the
iterator. Accordingly, we cannot use Iterator::next
which requires items not borrow from
the iterator.
polonius-the-crab details a frequent limitation of Rust’s borrow checker which users of this function may incur. It also details potential solutions (primarily using inlined code instead of functions, callbacks) before presenting itself as a complete solution. Please refer to it if you have difficulties calling this method for context.