pub enum EcosystemId {
Show 14 variants
Cargo,
Npm,
Pypi,
Go,
Bundler,
Dart,
Maven,
Composer,
Gradle,
Swift,
NuGet,
Deno,
GithubActions,
GitlabCi,
}Expand description
Canonical, exhaustive identifier for every package ecosystem the workspace supports.
Ecosystem::id returns a &'static str for registry lookups and document
storage, but any code that needs to branch on ecosystem identity should match on
this enum instead of re-deriving its own partial match over that string: an
unhandled variant here is a compile error, while an unhandled string is a silent
runtime bug (see the fix for issue #118, where two call sites silently mishandled
ecosystems missing from an incomplete string match).
Deliberately not #[non_exhaustive]: adding a new ecosystem must force every
exhaustive match on this type across the workspace to be updated at compile time.
§Examples
use deps_core::EcosystemId;
let id: EcosystemId = "npm".parse().unwrap();
assert_eq!(id, EcosystemId::Npm);
assert_eq!(id.id(), "npm");
assert_eq!(id.to_string(), "npm");
assert!("unknown".parse::<EcosystemId>().is_err());Variants§
Cargo
Rust Cargo ecosystem (Cargo.toml).
Npm
JavaScript/TypeScript npm ecosystem (package.json).
Pypi
Python PyPI ecosystem (pyproject.toml).
Go
Go modules ecosystem (go.mod).
Bundler
Ruby Bundler ecosystem (Gemfile).
Dart
Dart/Flutter pub ecosystem (pubspec.yaml).
Maven
Java/Kotlin Maven ecosystem (pom.xml).
Composer
PHP Composer ecosystem (composer.json).
Gradle
Java/Kotlin Gradle ecosystem (build.gradle, build.gradle.kts, version catalogs).
Swift
Swift Package Manager ecosystem (Package.swift).
NuGet
.NET NuGet ecosystem (.csproj/.fsproj/.vbproj, Directory.Packages.props, packages.config).
Deno
Deno ecosystem (deno.json/deno.jsonc), mixing jsr: and npm: specifiers.
GithubActions
GitHub Actions ecosystem (.github/workflows/*.yml/*.yaml).
GitlabCi
GitLab CI/CD ecosystem (.gitlab-ci.yml, .gitlab/ci/*.yml/*.yaml).
Implementations§
Source§impl EcosystemId
impl EcosystemId
Sourcepub const fn id(self) -> &'static str
pub const fn id(self) -> &'static str
Returns the canonical string identifier, matching Ecosystem::id for the
corresponding ecosystem implementation.
Sourcepub const fn osv_ecosystem(self) -> Option<&'static str>
pub const fn osv_ecosystem(self) -> Option<&'static str>
OSV.dev package.ecosystem value for this ecosystem, or None if
OSV has no equivalent.
An exhaustive match rather than a lookup table: adding a 12th
ecosystem becomes a compile error here instead of a silent
zero-results ecosystem in OSV queries. Every arm below was verified
live against https://api.osv.dev (each returned real advisories for
a known-vulnerable version) — see architecture.md §2.
§Examples
use deps_core::EcosystemId;
assert_eq!(EcosystemId::Cargo.osv_ecosystem(), Some("crates.io"));
assert_eq!(EcosystemId::Gradle.osv_ecosystem(), Some("Maven"));Trait Implementations§
Source§impl Clone for EcosystemId
impl Clone for EcosystemId
Source§fn clone(&self) -> EcosystemId
fn clone(&self) -> EcosystemId
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 EcosystemId
Source§impl Debug for EcosystemId
impl Debug for EcosystemId
Source§impl Display for EcosystemId
impl Display for EcosystemId
impl Eq for EcosystemId
Source§impl FromStr for EcosystemId
impl FromStr for EcosystemId
Source§impl Hash for EcosystemId
impl Hash for EcosystemId
Source§impl PartialEq for EcosystemId
impl PartialEq for EcosystemId
Source§fn eq(&self, other: &EcosystemId) -> bool
fn eq(&self, other: &EcosystemId) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for EcosystemId
Auto Trait Implementations§
impl Freeze for EcosystemId
impl RefUnwindSafe for EcosystemId
impl Send for EcosystemId
impl Sync for EcosystemId
impl Unpin for EcosystemId
impl UnsafeUnpin for EcosystemId
impl UnwindSafe for EcosystemId
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.