pub trait SliceVisitor<'de, T: ToOwned + ?Sized>: Sized {
    type Output;

    // Required method
    fn visit<E: Error>(self, slice: &T) -> Result<Self::Output, E>;

    // Provided methods
    fn visit_owned<E: Error>(self, buf: T::Owned) -> Result<Self::Output, E> { ... }
    fn visit_borrowed<E: Error>(
        self,
        borrowed_slice: &'de T
    ) -> Result<Self::Output, E> { ... }
}
Expand description

A SliceVisitor is provided a slice T of some elements by a Deserializer and is tasked with translating this slice to the Output type.

Required Associated Types§

source

type Output

The output produced by this visitor.

Required Methods§

source

fn visit<E: Error>(self, slice: &T) -> Result<Self::Output, E>

The input contains a slice.

The lifetime of the slice is ephemeral and it may be destroyed after this method returns.

Provided Methods§

source

fn visit_owned<E: Error>(self, buf: T::Owned) -> Result<Self::Output, E>

The input contains a slice and ownership of the slice is being given to the SliceVisitor.

source

fn visit_borrowed<E: Error>( self, borrowed_slice: &'de T ) -> Result<Self::Output, E>

The input contains a slice that lives at least as long ('de) as the Deserializer.

Object Safety§

This trait is not object safe.

Implementors§