pub struct Deprecation {
pub reason: Option<String>,
pub replacement: Option<String>,
}Expand description
Package-level deprecation/abandonment payload: why a package is deprecated, and what to use instead.
Distinct from RemovalStatus, which answers “may resolution select this
version”. Deprecation answers “what should the user be told” — the reason text
and/or a registry-supplied replacement package name. Kept as a separate type rather
than a payload-carrying RemovalStatus variant: RemovalStatus is Copy, returned
from const fns, and matched in every ecosystem crate, so widening it would ripple
everywhere for a concept that only a couple of registries expose.
Both fields are None when the registry has nothing to say beyond “deprecated” —
e.g. Packagist’s bare "abandoned": true, with no replacement named.
§Examples
use deps_core::Deprecation;
let deprecation = Deprecation {
reason: Some("no longer maintained".into()),
replacement: Some("some-other/package".into()),
};
assert_eq!(deprecation.reason.as_deref(), Some("no longer maintained"));
assert_eq!(deprecation.replacement.as_deref(), Some("some-other/package"));Fields§
§reason: Option<String>Free-text reason the registry gives for the deprecation, if any.
replacement: Option<String>Registry-supplied replacement package name, if any. Only ever populated from a structured registry field (never regex-extracted from free text — see #205’s typosquatting rationale), so it is safe to offer as a rename target.
Trait Implementations§
Source§impl Clone for Deprecation
impl Clone for Deprecation
Source§fn clone(&self) -> Deprecation
fn clone(&self) -> Deprecation
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Deprecation
impl Debug for Deprecation
impl Eq for Deprecation
Source§impl PartialEq for Deprecation
impl PartialEq for Deprecation
Source§fn eq(&self, other: &Deprecation) -> bool
fn eq(&self, other: &Deprecation) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for Deprecation
Auto Trait Implementations§
impl Freeze for Deprecation
impl RefUnwindSafe for Deprecation
impl Send for Deprecation
impl Sync for Deprecation
impl Unpin for Deprecation
impl UnsafeUnpin for Deprecation
impl UnwindSafe for Deprecation
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.