[−][src]Struct serde_diff::Config
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]
self,
old: &'a T,
new: &'b T
) -> Diff<'a, 'b, T>
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]
self,
serializer: S,
old: &'a T,
new: &'b T
) -> Result<S::Ok, S::Error>
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]
self,
target: &'a mut T
) -> Apply<'a, T>
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]
self,
deserializer: D,
target: &mut T
) -> Result<(), <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
Applies a sequence of diff commands to the target, as read by the deserializer
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Config
[src]
impl Send for Config
[src]
impl Sync for Config
[src]
impl Unpin for Config
[src]
impl UnwindSafe for Config
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,