Struct NpmVersion
pub struct NpmVersion {
pub version: ConcreteVersion,
pub deprecated: bool,
pub deprecation: Option<Deprecation>,
pub published_at: Option<PublishTime>,
}Expand description
Version information for an npm package.
Retrieved from the npm registry API at https://registry.npmjs.org/{package}.
Contains version number and deprecation status.
§Examples
use deps_npm::types::NpmVersion;
let version = NpmVersion {
version: "4.18.2".into(),
deprecated: false,
deprecation: None,
published_at: None,
};
assert!(!version.deprecated);Fields§
§version: ConcreteVersion§deprecated: bool§deprecation: Option<Deprecation>Package-level deprecation payload (issue #205), derived from the packument’s
deprecated free-text field. None whenever deprecated is absent, null, or
an all-whitespace string — npm’s own convention for “un-deprecating” a package is
republishing with an empty deprecated string, so that case must not produce a
dangling, information-free diagnostic (see deprecation_from_message). Carries no
replacement: npm only ever names a successor in free text, and regex-extracting
a package name from registry-controlled prose to rewrite a manifest is a
typosquatting vector — see NpmFormatter::supports_package_rename.
published_at: Option<PublishTime>Publish timestamp, populated only when Registry::get_versions_with is called with
freshness enabled — derived from the full packument’s time map, never the
abbreviated packument get_versions otherwise uses.
Trait Implementations§
§impl Clone for NpmVersion
impl Clone for NpmVersion
§fn clone(&self) -> NpmVersion
fn clone(&self) -> NpmVersion
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for NpmVersion
impl Debug for NpmVersion
§impl Version for NpmVersion
impl Version for NpmVersion
§fn version_string(&self) -> &ConcreteVersion
fn version_string(&self) -> &ConcreteVersion
§fn removal_status(&self) -> RemovalStatus
fn removal_status(&self) -> RemovalStatus
§fn published_at(&self) -> Option<PublishTime>
fn published_at(&self) -> Option<PublishTime>
§fn is_prerelease(&self) -> bool
fn is_prerelease(&self) -> bool
§fn deprecation(&self) -> Option<&Deprecation>
fn deprecation(&self) -> Option<&Deprecation>
Auto Trait Implementations§
impl Freeze for NpmVersion
impl RefUnwindSafe for NpmVersion
impl Send for NpmVersion
impl Sync for NpmVersion
impl Unpin for NpmVersion
impl UnsafeUnpin for NpmVersion
impl UnwindSafe for NpmVersion
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<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>
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