Skip to main content

ArrayAccess

Trait ArrayAccess 

Source
pub trait ArrayAccess<'de> {
    type Element;
    type Error: Error;

    // Required method
    fn next_element(&mut self) -> Result<Option<Self::Element>, Self::Error>;

    // Provided methods
    fn validate_next_element(&mut self) -> Result<Option<()>, Self::Error> { ... }
    fn size_hint(&self) -> Option<usize> { ... }
}
Expand description

Provides an ArrayVisitor with access to each element of the array in the input.

This is a trait that a Deserializer passes to an ArrayVisitor implementation.

Required Associated Types§

Source

type Element

The element / base type of the array.

Source

type Error: Error

The error type that can be returned if some error occurs during deserialization.

Required Methods§

Source

fn next_element(&mut self) -> Result<Option<Self::Element>, Self::Error>

This returns Ok(Some(value)) for the next element in the array, or Ok(None) if there are no more remaining elements.

Provided Methods§

Source

fn validate_next_element(&mut self) -> Result<Option<()>, Self::Error>

This returns Ok(Some(())) for the next element in the array, or Ok(None) if there are no more remaining elements.

Source

fn size_hint(&self) -> Option<usize>

Returns the number of elements remaining in the array, if known.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<'de, R, T> ArrayAccess<'de> for ArrayAccess<'_, R, T>
where R: BufReader<'de>, T: DeserializeSeed<'de> + Clone,