Trait SeqAccess
trait SeqAccess<'de>
Provides a Visitor access to each element of a sequence in the input.
This is a trait that a Deserializer passes to a Visitor implementation,
which deserializes each item in a sequence.
Lifetime
The 'de lifetime of this trait is the lifetime of data that may be
borrowed by deserialized sequence elements. See the page Understanding
deserializer lifetimes for a more detailed explanation of these lifetimes.
Example implementation
The example data format presented on the website demonstrates an
implementation of SeqAccess for a basic JSON data format.
Associated Types
type Error: TraitBound { trait_: Path { path: "Error", id: Id(217), args: None }, generic_params: [], modifier: None }The error type that can be returned if some error occurs during deserialization.
Required Methods
fn next_element_seed<T>(self: &mut Self, seed: T) -> Result<Option<<T as >::Value>, <Self as >::Error> where T: DeserializeSeed<'de>This returns
Ok(Some(value))for the next value in the sequence, orOk(None)if there are no more remaining items.Deserializeimplementations should typically useSeqAccess::next_elementinstead.
Provided Methods
fn next_element<T>(self: &mut Self) -> Result<Option<T>, <Self as >::Error> where T: Deserialize<'de>This returns
Ok(Some(value))for the next value in the sequence, orOk(None)if there are no more remaining items.This method exists as a convenience for
Deserializeimplementations.SeqAccessimplementations should not override the default behavior.fn size_hint(self: &Self) -> Option<usize>Returns the number of elements remaining in the sequence, if known.
Implementors
impl<'de, I, T, E> SeqAccess for SeqDeserializer<I, E>impl<'de, I, E> SeqAccess for MapDeserializer<'de, I, E>impl<'de, A> SeqAccess for &mut A