pub enum EnumDelta<T, D> {
Became(T),
Delta(D),
}Expand description
The delta of an enum: a change within a variant, or a change of variant.
T is the source enum and D its generated {Self}Delta, so deriving
Delta on enum Shape gives
Output = EnumDelta<Shape, ShapeDelta>. The wrapper is a type in this
crate rather than an arm of the generated enum so that Became cannot
collide with a variant you wrote.
Note that Became carries the source value whole. There is nothing
smaller it could carry — the receiver holds a different variant, so it
shares none of the new one — which is also why serializing an enum’s delta
needs the enum itself to be serializable.
Variants§
Became(T)
The value moved to a different variant, so here it is in full.
Delta(D)
The value stayed in its variant; this is what changed inside it.
Trait Implementations§
Source§impl<'de, T, D> Deserialize<'de> for EnumDelta<T, D>where
T: Deserialize<'de>,
D: Deserialize<'de>,
impl<'de, T, D> Deserialize<'de> for EnumDelta<T, D>where
T: Deserialize<'de>,
D: 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
impl<T: Eq, D: Eq> Eq for EnumDelta<T, D>
impl<T: PartialEq, D: PartialEq> StructuralPartialEq for EnumDelta<T, D>
Auto Trait Implementations§
impl<T, D> Freeze for EnumDelta<T, D>
impl<T, D> RefUnwindSafe for EnumDelta<T, D>where
T: RefUnwindSafe,
D: RefUnwindSafe,
impl<T, D> Send for EnumDelta<T, D>
impl<T, D> Sync for EnumDelta<T, D>
impl<T, D> Unpin for EnumDelta<T, D>
impl<T, D> UnsafeUnpin for EnumDelta<T, D>where
T: UnsafeUnpin,
D: UnsafeUnpin,
impl<T, D> UnwindSafe for EnumDelta<T, D>where
T: UnwindSafe,
D: 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