[][src]Struct serde_diff::Apply

pub struct Apply<'a, T: SerdeDiff> { /* fields omitted */ }

A deserializable structure that will apply a sequence of diff commands to the target

Examples

use serde_diff::{SerdeDiff, Diff, Apply};
use serde::{Serialize, Deserialize};
#[derive(SerdeDiff, Serialize, Deserialize, PartialEq)]
struct Test {
    a: i32,
}
let diff = Diff::serializable(&Test { a: 3 }, &Test { a: 5 });
let msgpack_data = rmp_serde::to_vec_named(&diff).expect("failed to serialize diff");
let mut deserializer = rmp_serde::Deserializer::new(msgpack_data.as_slice());
let mut target = Test { a: 4 };
Apply::apply(&mut deserializer, &mut target).expect("failed when deserializing diff");

Implementations

impl<'a, 'de, T: SerdeDiff> Apply<'a, T>[src]

pub fn deserializable(target: &'a mut T) -> Self[src]

Create a deserializable apply, where the given target will be changed when the resulting Apply struct is deserialized

pub fn apply<D>(
    deserializer: D,
    target: &mut T
) -> Result<(), <D as Deserializer<'de>>::Error> where
    D: Deserializer<'de>, 
[src]

Applies a sequence of diff commands to the target, as read by the deserializer

Trait Implementations

impl<'a, 'de, T: SerdeDiff> DeserializeSeed<'de> for Apply<'a, T>[src]

type Value = ()

The type produced by using this seed.

impl<'a, 'de, T: SerdeDiff> Visitor<'de> for Apply<'a, T>[src]

type Value = ()

The value produced by this visitor.

Auto Trait Implementations

impl<'a, T> RefUnwindSafe for Apply<'a, T> where
    T: RefUnwindSafe
[src]

impl<'a, T> Send for Apply<'a, T> where
    T: Send
[src]

impl<'a, T> Sync for Apply<'a, T> where
    T: Sync
[src]

impl<'a, T> Unpin for Apply<'a, T>[src]

impl<'a, T> !UnwindSafe for Apply<'a, T>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<'de, T> Expected for T where
    T: Visitor<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.