pub struct Modify<T> { /* private fields */ }Expand description
Modifiable object
Implements Deref and DerefMut to access the value and
adds a flag to indicate if the object was modified.
§Example
use crate::modify::*;
let mut value = Modify::new(42);
assert_eq!(value.is_modified(), false);
*value = 43;
assert_eq!(value.is_modified(), true);
value.saved();
assert_eq!(value.is_modified(), false);if you use serde you should use #[serde(flatten)} for your
Modify<> attribute to avoid the extra level of indirection.
Implementations§
Trait Implementations§
Source§impl<'de, T> Deserialize<'de> for Modify<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for Modify<T>where
T: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<T> Modifiable for Modify<T>
impl<T> Modifiable for Modify<T>
Source§fn is_modified(&self) -> bool
fn is_modified(&self) -> bool
Return
true if the object was modified.impl<T> StructuralPartialEq for Modify<T>
Auto Trait Implementations§
impl<T> Freeze for Modify<T>where
T: Freeze,
impl<T> RefUnwindSafe for Modify<T>where
T: RefUnwindSafe,
impl<T> Send for Modify<T>where
T: Send,
impl<T> Sync for Modify<T>where
T: Sync,
impl<T> Unpin for Modify<T>where
T: Unpin,
impl<T> UnwindSafe for Modify<T>where
T: UnwindSafe,
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