pub struct VersionPreferences { /* private fields */ }
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.
Implementations
sourceimpl 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
)
pub fn sort_summaries(
&self,
summaries: &mut Vec<Summary>,
version_ordering: VersionOrdering
)
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
sourceimpl Default for VersionPreferences
impl Default for VersionPreferences
sourcefn default() -> VersionPreferences
fn default() -> VersionPreferences
Returns the “default value” for a type. Read more
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more