pub enum MergeStrategy {
LastWins,
Concatenate,
SubmoduleMerge,
AttrsetMerge,
Disjoint,
Custom,
AnyLastWins,
}Expand description
How multiple definitions of one option fold into one value.
The cppnix lattice is small: most types are last-wins under
priority resolution; listOf concatenates after priority; the
submodule + attrsOf variants recurse. Custom merges plug in via
a named hook the interpreter resolves.
Variants§
LastWins
One definition wins by priority order (bool, int, str,
path, package, null, enum). Tie at top priority is
a typeError.
Concatenate
Concatenate lists in priority order (listOf T). Elements
from higher priorities come first.
SubmoduleMerge
Recursive submodule eval — apply the module algorithm to the
definitions of this option (submodule).
AttrsetMerge
Deep-merge attrsets — recurse on overlapping keys, set-union
on disjoint (attrsOf T, plain attrs).
Disjoint
At most one definition allowed; multiple = typeError
(oneOf after dispatch).
Custom
Plug-in merge function named by string; the interpreter
resolves the name to a builtin or a user-supplied function.
Used for lib.types.either, lib.types.functionTo, etc.
AnyLastWins
any-typed: accept any value, last-wins. Unsafe; only
permitted for the any option type explicitly.
Trait Implementations§
Source§impl Clone for MergeStrategy
impl Clone for MergeStrategy
Source§fn clone(&self) -> MergeStrategy
fn clone(&self) -> MergeStrategy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for MergeStrategy
Source§impl Debug for MergeStrategy
impl Debug for MergeStrategy
Source§impl<'de> Deserialize<'de> for MergeStrategy
impl<'de> Deserialize<'de> for MergeStrategy
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>,
impl Eq for MergeStrategy
Source§impl PartialEq for MergeStrategy
impl PartialEq for MergeStrategy
Source§fn eq(&self, other: &MergeStrategy) -> bool
fn eq(&self, other: &MergeStrategy) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for MergeStrategy
impl Serialize for MergeStrategy
impl StructuralPartialEq for MergeStrategy
Auto Trait Implementations§
impl Freeze for MergeStrategy
impl RefUnwindSafe for MergeStrategy
impl Send for MergeStrategy
impl Sync for MergeStrategy
impl Unpin for MergeStrategy
impl UnsafeUnpin for MergeStrategy
impl UnwindSafe for MergeStrategy
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.