pub enum Spec {
Registry(String),
Alias {
name: String,
spec: Box<Spec>,
},
Git {
source: String,
committish: Option<String>,
},
Tarball(String),
Path(String),
}Expand description
A classified npm dependency specifier.
Variants§
Registry(String)
A registry spec — an exact version, a semver range, or a dist-tag (e.g. latest) —
held raw. Resolve it with version_req (the Rust semver subset of npm’s grammar).
Alias
An npm:<name>@<spec> alias — install name (per the inner spec) under the
dependency’s own key.
Git
A git source — a full git URL or a host:owner/repo / bare owner/repo shorthand —
with an optional #<committish> (branch, tag, commit, or semver:<range>).
Tarball(String)
A remote tarball fetched over http(s).
Path(String)
A local path (file:…, ./, ../, /abs, ~/…), linked or copied in place.
Implementations§
Source§impl Spec
impl Spec
Sourcepub fn parse(spec: &str) -> Spec
pub fn parse(spec: &str) -> Spec
Classify a dependencies value by form. Never fails — an unparseable-but-registry
range is still Spec::Registry; turning it into a VersionReq is a later step.
Sourcepub fn is_registry(&self) -> bool
pub fn is_registry(&self) -> bool
Whether this spec resolves to a registry tarball (the only form npm-utils fetches).
Trait Implementations§
impl Eq for Spec
impl StructuralPartialEq for Spec
Auto Trait Implementations§
impl Freeze for Spec
impl RefUnwindSafe for Spec
impl Send for Spec
impl Sync for Spec
impl Unpin for Spec
impl UnsafeUnpin for Spec
impl UnwindSafe for Spec
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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.