Skip to main content

DependencySource

Enum DependencySource 

Source
#[non_exhaustive]
pub enum DependencySource { Registry, Git { url: String, rev: Option<String>, }, Path { path: String, }, Url { url: String, }, Sdk { sdk: String, }, Workspace, CustomRegistry { url: String, }, AlternateRegistry { index: String, mirrors_crates_io: bool, }, }
Expand description

Dependency source location (shared across all ecosystems).

Covers the union of all source types across Cargo, npm, PyPI, Go, Dart, Bundler, Maven, and Gradle ecosystems.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Registry

Default package registry (crates.io, npm, PyPI, pub.dev, rubygems.org, Maven Central).

§

Git

Git repository dependency.

Fields

§rev: Option<String>

Git ref: commit SHA, tag, or branch name (ecosystem-specific semantics).

§

Path

Local filesystem path dependency.

Fields

§path: String
§

Url

Direct URL to artifact (PyPI wheels, npm tarballs).

Fields

§

Sdk

SDK-provided dependency (Dart: sdk: flutter).

Fields

§

Workspace

Workspace-inherited dependency (Cargo: workspace = true).

§

CustomRegistry

Custom/alternative registry, named by an unresolved alias or raw index URL (Bundler custom sources, an unresolved Cargo registry = "my-corp").

This variant’s meaning is unchanged by AlternateRegistry’s addition: it always means “not yet resolved to a concrete index this LSP can query” — url may hold a bare alias ("my-corp") or a URL string, but never a value this LSP has validated and can fetch against. See AlternateRegistry for the resolved counterpart.

url is never redacted (unlike every tracing::warn! naming the same raw value — see deps_core::net_policy::redact_userinfo’s doc, #536): a literal registry-index carrying user:pass@ userinfo that fails to resolve lands here verbatim. Currently latent — nothing renders CustomRegistry::url in hover/diagnostics text today — but a future caller surfacing it must redact first, matching every logging call site.

Fields

§

AlternateRegistry

A custom/alternative registry resolved to a concrete, fetchable index URL.

Distinct from CustomRegistry so “resolved” is a type-level state instead of string-sniffing an unresolved alias vs. a URL. Produced only by a parser that validated index against its own registry-configuration source (e.g. deps-cargo’s .cargo/config.toml resolution) — deps-core itself never constructs this variant. index is the sparse+ prefix-stripped, https-only index URL; it carries no credential and is not itself an authorization decision — see the originating crate’s config-resolution module for how (and whether) a request against it is authenticated.

Fields

§index: String

The resolved index URL, validated and normalized by the originating parser.

§mirrors_crates_io: bool

true exactly when this source was reached via a [source.crates-io] replace-with chain (Cargo [source] mirroring, spec .local/specs/023-cargo-custom-registries/plan-1b.md §1.3) — as opposed to an explicit registry/registry-index naming a genuinely different, private registry.

Affects presentation and advisory gating only, never routing: Cargo verifies per-version checksum equality against crates.io for a mirror, so its content is exactly as trustworthy as crates.io’s own for vulnerability-scanning and hover-link purposes, even though the fetch itself still goes to index, not to crates.io. See crate::lsp_helpers::SourcePolicy::source_is_public_registry_content.

Implementations§

Source§

impl DependencySource

Source

pub fn is_registry(&self) -> bool

Returns true if this dependency comes from any registry (default or custom).

Registry dependencies support version fetching and update checks. Git, Path, Url, Sdk, and Workspace dependencies do not.

Source

pub fn is_version_resolvable(&self) -> bool

Returns true if this LSP can resolve version data for this source against the registry client it actually queries.

Registry resolves to the ecosystem’s default public registry (crates.io, npm, PyPI, …), which every deps-* crate implements a client for. CustomRegistry names a private/alternative registry (e.g. Bundler source "https://gems.mycorp.com", Cargo registry = "my-corp") that this LSP has no client for — known limitation, tracked until private-registry client support exists. Diagnostics and hover must not silently fall back to checking a CustomRegistry dependency’s name against the public registry, so this deliberately diverges from is_registry() and returns false for it, alongside Git/Path/Url/Sdk/Workspace sources.

Also false for AlternateRegistry, even though it is resolved: this method answers “does the generic Registry trait (crates.io-shaped, one client per ecosystem) resolve this”, not “is version data reachable at all”. An ecosystem whose registry implements per-source routing (deps-cargo’s CargoRegistry) must use crate::lsp_helpers::SourcePolicy::can_resolve_source instead, which defaults to this method and is the only override point — see that method’s docs.

Trait Implementations§

Source§

impl Clone for DependencySource

Source§

fn clone(&self) -> DependencySource

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DependencySource

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Eq for DependencySource

Source§

impl PartialEq for DependencySource

Source§

fn eq(&self, other: &DependencySource) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for DependencySource

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more