pub struct VecSkipError<A = Same>(/* private fields */);Expand description
Skips elements of a vector which cannot be deserialized.
The elements are deserialized with the adapter A (by default
Same). If an element fails, the rest of it is skipped (see
Sink::recover). Only errors of the elements are handled, errors of
the data format and of layers still fail the deserialization.
Serialization uses the inner adapter for the elements.
use deser::Deserialize;
use deser::adapters::VecSkipError;
#[derive(Deserialize)]
pub enum Kind {
A,
B,
}
#[derive(Deserialize)]
pub struct Item {
// unknown kinds are skipped
#[deser(as = VecSkipError)]
kinds: Vec<Kind>,
}Trait Implementations§
Source§impl<'de, T: Send, A: Deserialize<'de, T>> Deserialize<'de, Vec<T>> for VecSkipError<A>
impl<'de, T: Send, A: Deserialize<'de, T>> Deserialize<'de, Vec<T>> for VecSkipError<A>
Source§fn expecting() -> Cow<'static, str>
fn expecting() -> Cow<'static, str>
Returns what the value expects, for error messages. Read more
Source§fn deserialize_into<'out>(
out: &'out mut Option<Vec<T>>,
state: &mut State,
) -> SinkHandle<'out, 'de>
fn deserialize_into<'out>( out: &'out mut Option<Vec<T>>, state: &mut State, ) -> SinkHandle<'out, 'de>
Creates a sink that deserializes the value into the given slot. Read more
Source§fn deserialize_atom(
slot: &mut Slot<T, Self>,
atom: Atom<'_>,
state: &mut State,
) -> Result<(), Error>
fn deserialize_atom( slot: &mut Slot<T, Self>, atom: Atom<'_>, state: &mut State, ) -> Result<(), Error>
Deserializes an atom into the slot. Read more
Source§fn deserialize_borrowed_atom(
slot: &mut Slot<T, Self>,
atom: Atom<'de>,
state: &mut State,
) -> Result<(), Error>
fn deserialize_borrowed_atom( slot: &mut Slot<T, Self>, atom: Atom<'de>, state: &mut State, ) -> Result<(), Error>
Deserializes an atom that borrows from the data being deserialized
into the slot. Read more
Source§fn describe_type(d: &mut dyn Describe)
fn describe_type(d: &mut dyn Describe)
Describes the Rust shape of the type. Read more
Source§fn initial_value() -> Option<T>
fn initial_value() -> Option<T>
Provides the value of a missing struct field. Read more
Source§fn deserialize_update<'out>(
value: &'out mut T,
state: &mut State,
) -> SinkHandle<'out, 'de>
fn deserialize_update<'out>( value: &'out mut T, state: &mut State, ) -> SinkHandle<'out, 'de>
Creates a sink that updates an existing value. Read more
Source§impl<T: Sync, A: Serialize<T>> Serialize<Vec<T>> for VecSkipError<A>
impl<T: Sync, A: Serialize<T>> Serialize<Vec<T>> for VecSkipError<A>
Source§fn serialize<'a>(
value: &'a Vec<T>,
state: &mut State,
) -> Result<Emit<'a>, Error>
fn serialize<'a>( value: &'a Vec<T>, state: &mut State, ) -> Result<Emit<'a>, Error>
Serializes the value.
Source§fn container_shape(value: &Vec<T>) -> ContainerShape
fn container_shape(value: &Vec<T>) -> ContainerShape
Returns the shape of the value if it’s a map or sequence. Read more
Source§fn describe(value: &Vec<T>, d: &mut dyn Describe)
fn describe(value: &Vec<T>, d: &mut dyn Describe)
Describes the Rust shape of the value. Read more
Auto Trait Implementations§
impl<A> Freeze for VecSkipError<A>
impl<A> RefUnwindSafe for VecSkipError<A>
impl<A> Send for VecSkipError<A>
impl<A> Sync for VecSkipError<A>
impl<A> Unpin for VecSkipError<A>
impl<A> UnsafeUnpin for VecSkipError<A>
impl<A> UnwindSafe for VecSkipError<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