pub struct VersionPreferences {
try_to_use: HashSet<PackageId>,
prefer_patch_deps: HashMap<InternedString, HashSet<Dependency>>,
version_ordering: VersionOrdering,
rust_versions: Vec<PartialVersion>,
}
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>>
§version_ordering: VersionOrdering
§rust_versions: Vec<PartialVersion>
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.
pub fn version_ordering(&mut self, ordering: VersionOrdering)
pub fn rust_versions(&mut self, vers: Vec<PartialVersion>)
Sourcepub fn sort_summaries(
&self,
summaries: &mut Vec<Summary>,
first_version: Option<VersionOrdering>,
)
pub fn sort_summaries( &self, summaries: &mut Vec<Summary>, first_version: Option<VersionOrdering>, )
Sort (and filter) the given vector of summaries in-place
Note: all summaries presumed to be for the same package.
Sort order:
- Preferred packages
- Most compatible
VersionPreferences::rust_versions
first_version
, falling back toVersionPreferences::version_ordering
whenNone
Filtering:
first_version
fn msrv_compat_count(&self, summary: &Summary) -> usize
Trait Implementations§
Source§impl Default for VersionPreferences
impl Default for VersionPreferences
Source§fn default() -> VersionPreferences
fn default() -> VersionPreferences
Auto Trait Implementations§
impl Freeze for VersionPreferences
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§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>,
§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: 128 bytes