pub enum RemovalStatus {
Available,
AdvisoryDeprecated,
Yanked,
}Expand description
Outcome of a registry’s per-version removal/deprecation signal.
Replaces a bare is_yanked(): bool, which could not distinguish a version
a registry has hard-removed from resolution (Yanked) from one that is
merely flagged as deprecated/abandoned but still fully installable
(AdvisoryDeprecated). Conflating the two caused #347: Composer’s
package-level abandoned flag was read through is_yanked(), so every
version of an abandoned-but-installable package was filtered out of
resolution, turning an existing package into a false “Unknown package”
diagnostic.
Call blocks_resolution to decide whether a
version may be selected as an upgrade/latest candidate. Call
is_flagged only to surface the registry’s flag to
the user (e.g. a yanked/deprecated diagnostic) — never to filter
resolution.
§Examples
use deps_core::RemovalStatus;
assert!(!RemovalStatus::Available.blocks_resolution());
assert!(!RemovalStatus::AdvisoryDeprecated.blocks_resolution());
assert!(RemovalStatus::Yanked.blocks_resolution());
assert!(RemovalStatus::AdvisoryDeprecated.is_flagged());
assert!(RemovalStatus::Yanked.is_flagged());
assert!(!RemovalStatus::Available.is_flagged());Variants§
Available
The registry reports no removal/deprecation signal for this version.
AdvisoryDeprecated
The registry flags this version (or its package) as deprecated/abandoned, but the version remains fully resolvable and installable.
Yanked
The registry has hard-removed this version from fresh resolution (a real yank/retraction). Existing installs may keep using it, but it must not be selected as an upgrade/latest candidate.
Implementations§
Source§impl RemovalStatus
impl RemovalStatus
Sourcepub const fn blocks_resolution(self) -> bool
pub const fn blocks_resolution(self) -> bool
Whether fresh resolution must skip this version.
true only for Yanked. An
AdvisoryDeprecated version is fully
installable — excluding it from resolution is what caused #347.
§Examples
use deps_core::RemovalStatus;
assert!(!RemovalStatus::AdvisoryDeprecated.blocks_resolution());
assert!(RemovalStatus::Yanked.blocks_resolution());Sourcepub const fn is_flagged(self) -> bool
pub const fn is_flagged(self) -> bool
Whether the registry flags this version at all, hard or advisory.
Use this only to decide whether to surface a warning to the user —
never to filter resolution; use
blocks_resolution for that.
§Examples
use deps_core::RemovalStatus;
assert!(!RemovalStatus::Available.is_flagged());
assert!(RemovalStatus::AdvisoryDeprecated.is_flagged());
assert!(RemovalStatus::Yanked.is_flagged());Sourcepub const fn from_yanked(flag: bool) -> Self
pub const fn from_yanked(flag: bool) -> Self
Builds a status from a registry’s hard yanked/retracted boolean flag.
§Examples
use deps_core::RemovalStatus;
assert_eq!(RemovalStatus::from_yanked(true), RemovalStatus::Yanked);
assert_eq!(RemovalStatus::from_yanked(false), RemovalStatus::Available);Sourcepub const fn from_advisory(flag: bool) -> Self
pub const fn from_advisory(flag: bool) -> Self
Builds a status from a registry’s advisory deprecated/abandoned boolean flag.
§Examples
use deps_core::RemovalStatus;
assert_eq!(RemovalStatus::from_advisory(true), RemovalStatus::AdvisoryDeprecated);
assert_eq!(RemovalStatus::from_advisory(false), RemovalStatus::Available);Trait Implementations§
Source§impl Clone for RemovalStatus
impl Clone for RemovalStatus
Source§fn clone(&self) -> RemovalStatus
fn clone(&self) -> RemovalStatus
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 RemovalStatus
Source§impl Debug for RemovalStatus
impl Debug for RemovalStatus
impl Eq for RemovalStatus
Source§impl Hash for RemovalStatus
impl Hash for RemovalStatus
Source§impl PartialEq for RemovalStatus
impl PartialEq for RemovalStatus
Source§fn eq(&self, other: &RemovalStatus) -> bool
fn eq(&self, other: &RemovalStatus) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for RemovalStatus
Auto Trait Implementations§
impl Freeze for RemovalStatus
impl RefUnwindSafe for RemovalStatus
impl Send for RemovalStatus
impl Sync for RemovalStatus
impl Unpin for RemovalStatus
impl UnsafeUnpin for RemovalStatus
impl UnwindSafe for RemovalStatus
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.