pub struct UniversalMarker { /* private fields */ }Expand description
A representation of a marker for use in universal resolution.
(This degrades gracefully to a standard PEP 508 marker in the case of non-universal resolution.)
This universal marker is meant to combine both a PEP 508 marker and a marker for conflicting extras/groups. The latter specifically expresses whether a particular edge in a dependency graph should be followed depending on the activated extras and groups.
A universal marker evaluates to true only when both its PEP 508 marker and its conflict marker evaluate to true.
Implementations§
Source§impl UniversalMarker
impl UniversalMarker
Sourcepub const TRUE: UniversalMarker
pub const TRUE: UniversalMarker
A constant universal marker that always evaluates to true.
Sourcepub const FALSE: UniversalMarker
pub const FALSE: UniversalMarker
A constant universal marker that always evaluates to false.
Sourcepub fn new(
pep508_marker: MarkerTree,
conflict_marker: ConflictMarker,
) -> UniversalMarker
pub fn new( pep508_marker: MarkerTree, conflict_marker: ConflictMarker, ) -> UniversalMarker
Creates a new universal marker from its constituent pieces.
Sourcepub fn from_combined(marker: MarkerTree) -> UniversalMarker
pub fn from_combined(marker: MarkerTree) -> UniversalMarker
Creates a new universal marker from a marker that has already been combined from a PEP 508 and conflict marker.
Sourcepub fn or(&mut self, other: UniversalMarker)
pub fn or(&mut self, other: UniversalMarker)
Combine this universal marker with the one given in a way that unions
them. That is, the updated marker will evaluate to true if self or
other evaluate to true.
Sourcepub fn and(&mut self, other: UniversalMarker)
pub fn and(&mut self, other: UniversalMarker)
Combine this universal marker with the one given in a way that
intersects them. That is, the updated marker will evaluate to true if
self and other evaluate to true.
Sourcepub fn imbibe(&mut self, conflicts: ConflictMarker)
pub fn imbibe(&mut self, conflicts: ConflictMarker)
Imbibes the world knowledge expressed by conflicts into this marker.
This will effectively simplify the conflict marker in this universal marker. In particular, it enables simplifying based on the fact that no two items from the same set in the given conflicts can be active at a given time.
Sourcepub fn assume_conflict_item(&mut self, item: &ConflictItem)
pub fn assume_conflict_item(&mut self, item: &ConflictItem)
Assumes that a given extra/group for the given package is activated.
This may simplify the conflicting marker component of this universal marker.
Sourcepub fn assume_not_conflict_item(&mut self, item: &ConflictItem)
pub fn assume_not_conflict_item(&mut self, item: &ConflictItem)
Assumes that a given extra/group for the given package is not activated.
This may simplify the conflicting marker component of this universal marker.
Sourcepub fn is_true(self) -> bool
pub fn is_true(self) -> bool
Returns true if this universal marker will always evaluate to true.
Sourcepub fn is_false(self) -> bool
pub fn is_false(self) -> bool
Returns true if this universal marker will always evaluate to false.
Sourcepub fn has_conflict_marker(self) -> bool
pub fn has_conflict_marker(self) -> bool
Returns true if this universal marker contains a conflict marker.
Conflict items are encoded as extra expressions in marker, while pep508 is the same
canonical marker with all extra expressions removed. Since MarkerTree equality is
semantic, the trees differ exactly when the marker depends on a conflict item.
Sourcepub fn is_disjoint(self, other: UniversalMarker) -> bool
pub fn is_disjoint(self, other: UniversalMarker) -> bool
Returns true if this universal marker is disjoint with the one given.
Two universal markers are disjoint when it is impossible for them both
to evaluate to true simultaneously.
Sourcepub fn evaluate_no_extras(self, env: &MarkerEnvironment) -> bool
pub fn evaluate_no_extras(self, env: &MarkerEnvironment) -> bool
Returns true if this universal marker is satisfied by the given marker environment.
This should only be used when evaluating a marker that is known not to have any extras. For example, the PEP 508 markers on a fork.
Sourcepub fn evaluate<P, E, G>(
self,
env: &MarkerEnvironment,
projects: impl Iterator<Item = P>,
extras: impl Iterator<Item = (P, E)>,
groups: impl Iterator<Item = (P, G)>,
) -> bool
pub fn evaluate<P, E, G>( self, env: &MarkerEnvironment, projects: impl Iterator<Item = P>, extras: impl Iterator<Item = (P, E)>, groups: impl Iterator<Item = (P, G)>, ) -> bool
Returns true if this universal marker is satisfied by the given marker environment and list of activated projects, extras, and groups.
The activated extras and groups should be the complete set activated for a particular context. And each extra and group must be scoped to the particular package that it’s enabled for.
Sourcepub fn evaluate_activated(
self,
env: &MarkerEnvironment,
activated: &ActivatedConflictItems,
) -> bool
pub fn evaluate_activated( self, env: &MarkerEnvironment, activated: &ActivatedConflictItems, ) -> bool
Returns true if this universal marker is satisfied by an already encoded activated set.
Sourcepub fn combined(self) -> MarkerTree
pub fn combined(self) -> MarkerTree
Returns the internal marker that combines both the PEP 508 and conflict marker.
Sourcepub fn pep508(self) -> MarkerTree
pub fn pep508(self) -> MarkerTree
Returns the PEP 508 marker for this universal marker.
One should be cautious using this. Generally speaking, it should only be used when one knows universal resolution isn’t in effect. When universal resolution is enabled (i.e., there may be multiple forks producing different versions of the same package), then one should always use a universal marker since it accounts for all possible ways for a package to be installed.
Sourcepub fn conflict(self) -> ConflictMarker
pub fn conflict(self) -> ConflictMarker
Returns the non-PEP 508 marker expression that represents conflicting extras/groups.
Like with UniversalMarker::pep508, one should be cautious when using
this. It is generally always wrong to consider conflicts in isolation
from PEP 508 markers. But this can be useful for detecting failure
cases. For example, the code for emitting a ResolverOutput (even a
universal one) in a requirements.txt format checks for the existence
of non-trivial conflict markers and fails if any are found. (Because
conflict markers cannot be represented in the requirements.txt
format.)
Sourcepub fn conflict_for_environment(self, env: &MarkerEnvironment) -> ConflictMarker
pub fn conflict_for_environment(self, env: &MarkerEnvironment) -> ConflictMarker
Returns the conflict marker that remains after evaluating all PEP 508 expressions in the given environment.
Unlike UniversalMarker::conflict, this preserves the relationship between PEP 508 and
conflict expressions. For example, given sys_platform == 'linux' or extra == 'foo', the
conflict marker is always true on Linux but still depends on foo elsewhere.
Trait Implementations§
Source§impl Boolean for UniversalMarker
impl Boolean for UniversalMarker
Source§fn and(&mut self, other: UniversalMarker)
fn and(&mut self, other: UniversalMarker)
Source§fn or(&mut self, other: UniversalMarker)
fn or(&mut self, other: UniversalMarker)
Source§impl Clone for UniversalMarker
impl Clone for UniversalMarker
Source§fn clone(&self) -> UniversalMarker
fn clone(&self) -> UniversalMarker
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 UniversalMarker
Source§impl Debug for UniversalMarker
impl Debug for UniversalMarker
Source§impl Default for UniversalMarker
impl Default for UniversalMarker
Source§fn default() -> UniversalMarker
fn default() -> UniversalMarker
impl Eq for UniversalMarker
Source§impl Hash for UniversalMarker
impl Hash for UniversalMarker
Source§impl Ord for UniversalMarker
impl Ord for UniversalMarker
Source§fn cmp(&self, other: &UniversalMarker) -> Ordering
fn cmp(&self, other: &UniversalMarker) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for UniversalMarker
impl PartialEq for UniversalMarker
Source§impl PartialOrd for UniversalMarker
impl PartialOrd for UniversalMarker
Source§impl Reachable<UniversalMarker> for UniversalMarker
impl Reachable<UniversalMarker> for UniversalMarker
Source§fn true_marker() -> UniversalMarker
fn true_marker() -> UniversalMarker
Source§fn false_marker() -> UniversalMarker
fn false_marker() -> UniversalMarker
Source§fn marker(&self) -> UniversalMarker
fn marker(&self) -> UniversalMarker
impl StructuralPartialEq for UniversalMarker
Auto Trait Implementations§
impl Freeze for UniversalMarker
impl RefUnwindSafe for UniversalMarker
impl Send for UniversalMarker
impl Sync for UniversalMarker
impl Unpin for UniversalMarker
impl UnsafeUnpin for UniversalMarker
impl UnwindSafe for UniversalMarker
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<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§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>
impl<T> MaybeSend for Twhere
T: Send,
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.Source§impl<D> OwoColorize for D
impl<D> OwoColorize for D
Source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
Source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
Source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
Source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
Source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
Source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
Source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
Source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
Source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
Source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
Source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
Source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
Source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
Source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
Source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
Source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
Source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
Source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
Source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
Source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
Source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
Source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
Source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
Source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
Source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
Source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
Source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
Source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
Source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
Source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
Source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
Source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
Source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
Source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
Source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
Source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
Source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
Source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
Source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
Source§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg or
a color-specific method, such as OwoColorize::green, Read moreSource§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read more