[][src]Struct serde_diff::Config

pub struct Config { /* fields omitted */ }

Configures creation of Apply and Diff

Examples

use serde_diff::{SerdeDiff, Config, FieldPathMode};
use serde::{Serialize, Deserialize};
#[derive(SerdeDiff, Serialize, Deserialize, PartialEq)]
struct Test {
    a: i32,
}
let diff = Config::new()
    .with_field_path_mode(FieldPathMode::Index)
    .serializable_diff(&Test { a: 3 }, &Test { a: 5 });

Implementations

impl Config[src]

pub fn new() -> Self[src]

Creates a Config with default values

pub fn with_field_path_mode(mut self: Self, mode: FieldPathMode) -> Self[src]

Sets the FieldPathMode to use when serializing a Diff

pub fn serializable_diff<'a, 'b, T: SerdeDiff + 'a + 'b>(
    self,
    old: &'a T,
    new: &'b T
) -> Diff<'a, 'b, T>
[src]

Create a serializable Diff, which when serialized will write the differences between the old and new value into the serializer in the form of a sequence of diff commands

pub fn diff<'a, 'b, S: Serializer, T: SerdeDiff + 'a + 'b>(
    self,
    serializer: S,
    old: &'a T,
    new: &'b T
) -> Result<S::Ok, S::Error>
[src]

Writes the differences between the old and new value into the given serializer in the form of a sequence of diff commands

pub fn deserializable_apply<'a, T: SerdeDiff>(
    self,
    target: &'a mut T
) -> Apply<'a, T>
[src]

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

pub fn apply<'de, D, T: SerdeDiff>(
    self,
    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 Default for Config[src]

Auto Trait Implementations

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<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.