Struct cargo::core::resolver::version_prefs::VersionPreferences
source · pub struct VersionPreferences {
try_to_use: HashSet<PackageId>,
prefer_patch_deps: HashMap<InternedString, HashSet<Dependency>>,
}
Expand description
A collection of preferences for particular package versions.
This is built up with Self::prefer_package_id
and Self::prefer_dependency
, then used to sort the set of
summaries for a package during resolution via Self::sort_summaries
.
As written, a version is either “preferred” or “not preferred”. Later extensions may introduce more granular preferences.
Fields§
§try_to_use: HashSet<PackageId>
§prefer_patch_deps: HashMap<InternedString, HashSet<Dependency>>
Implementations§
source§impl VersionPreferences
impl VersionPreferences
sourcepub fn prefer_package_id(&mut self, pkg_id: PackageId)
pub fn prefer_package_id(&mut self, pkg_id: PackageId)
Indicate that the given package (specified as a PackageId
) should be preferred.
sourcepub fn prefer_dependency(&mut self, dep: Dependency)
pub fn prefer_dependency(&mut self, dep: Dependency)
Indicate that the given package (specified as a Dependency
) should be preferred.
sourcepub fn sort_summaries(
&self,
summaries: &mut Vec<Summary>,
version_ordering: VersionOrdering,
first_version: bool
)
pub fn sort_summaries( &self, summaries: &mut Vec<Summary>, version_ordering: VersionOrdering, first_version: bool )
Sort the given vector of summaries in-place, with all summaries presumed to be for
the same package. Preferred versions appear first in the result, sorted by
version_ordering
, followed by non-preferred versions sorted the same way.
Trait Implementations§
source§impl Default for VersionPreferences
impl Default for VersionPreferences
source§fn default() -> VersionPreferences
fn default() -> VersionPreferences
Auto Trait Implementations§
impl RefUnwindSafe for VersionPreferences
impl !Send for VersionPreferences
impl !Sync for VersionPreferences
impl Unpin for VersionPreferences
impl UnwindSafe for VersionPreferences
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
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> WithSubscriber for T
impl<T> WithSubscriber for T
source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,
source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 96 bytes