pub enum CurrentVersion {
Resolved(ConcreteVersion),
Declared(VersionReq),
Unknown,
}Expand description
A dependency’s “current” version for deps-cli update’s report.
Replaces the historical three-way String/"" convention (issue #1593) with an
exhaustive state, so an unresolved current version can no longer be silently confused with
a resolved empty-string one.
§Examples
use deps_cli::update::CurrentVersion;
use deps_core::ConcreteVersion;
use deps_core::edit::UpdateKind;
let current = CurrentVersion::Resolved(ConcreteVersion::from("1.0.0"));
assert_eq!(
current.update_kind_to(&ConcreteVersion::from("2.0.0")),
UpdateKind::Major
);
assert_eq!(
CurrentVersion::Unknown.update_kind_to(&ConcreteVersion::from("2.0.0")),
UpdateKind::Unknown
);Variants§
Resolved(ConcreteVersion)
A lockfile/registry-resolved in-use version.
Declared(VersionReq)
No in-use version could be resolved; falls back to the dependency’s declared
requirement text (--security-only mode only — see security’s security_current).
Unknown
Neither a resolved in-use version nor a declared requirement was available.
Implementations§
Source§impl CurrentVersion
impl CurrentVersion
Sourcepub fn update_kind_to(&self, target: &ConcreteVersion) -> UpdateKind
pub fn update_kind_to(&self, target: &ConcreteVersion) -> UpdateKind
Classifies the update from this current version to target.
Self::Declared and Self::Unknown both classify as UpdateKind::Unknown —
behavior-identical to pre-#1593, though for two different reasons per variant: the
default planner (the only caller that ever classifies current) never produced
Self::Declared to begin with, and --security-only (the only caller that could)
never called classify_update on current at all before this refactor. Neither
caller’s classification behavior changes; this method exists so a future caller
cannot classify a Self::Declared requirement range as if it were a resolved version.
§Examples
use deps_cli::update::CurrentVersion;
use deps_core::{ConcreteVersion, VersionReq};
use deps_core::edit::UpdateKind;
let declared = CurrentVersion::Declared(VersionReq::new("^1.0"));
assert_eq!(
declared.update_kind_to(&ConcreteVersion::from("2.0.0")),
UpdateKind::Unknown
);Trait Implementations§
Source§impl Clone for CurrentVersion
impl Clone for CurrentVersion
Source§impl Debug for CurrentVersion
impl Debug for CurrentVersion
impl Eq for CurrentVersion
Source§impl From<Option<ConcreteVersion>> for CurrentVersion
impl From<Option<ConcreteVersion>> for CurrentVersion
Source§fn from(value: Option<ConcreteVersion>) -> Self
fn from(value: Option<ConcreteVersion>) -> Self
Some maps to Self::Resolved, None to Self::Unknown — the default planner’s
only two possible states (it never produces Self::Declared; only --security-only
does, via security_current).
Source§impl PartialEq for CurrentVersion
impl PartialEq for CurrentVersion
impl StructuralPartialEq for CurrentVersion
Auto Trait Implementations§
impl Freeze for CurrentVersion
impl RefUnwindSafe for CurrentVersion
impl Send for CurrentVersion
impl Sync for CurrentVersion
impl Unpin for CurrentVersion
impl UnsafeUnpin for CurrentVersion
impl UnwindSafe for CurrentVersion
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,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more