#[non_exhaustive]pub enum MapMode {
Set,
Append,
Extend,
}Expand description
How a MapMapping writes a non-null result to its path.
#[non_exhaustive]: a later minor may add a spelling.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Set
Replace the value at path (merging, when path is a context root).
Append
Push the result onto the array at path, in place.
A missing or null target becomes a one-element array; any other
non-array target fails the mapping rather than being wrapped. Only the
result is converted and copied, so appending costs the size of the
entry, not the size of the array: the merge idiom it replaces rebuilt
the whole array on every append, which made a log accumulated over a
loop quadratic.
Extend
As Self::Append, pushing each element of an array result. A
non-array result fails the mapping.
Trait Implementations§
impl Copy for MapMode
Source§impl<'de> Deserialize<'de> for MapMode
impl<'de> Deserialize<'de> for MapMode
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 Eq for MapMode
impl StructuralPartialEq for MapMode
Auto Trait Implementations§
impl Freeze for MapMode
impl RefUnwindSafe for MapMode
impl Send for MapMode
impl Sync for MapMode
impl Unpin for MapMode
impl UnsafeUnpin for MapMode
impl UnwindSafe for MapMode
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