pub struct PypiIndexConfig { /* private fields */ }Expand description
Resolved index configuration for one requirements.txt/pyproject.toml file.
Built once per parse (two-pass for requirements.txt — see parser::requirements’s
module doc; single-pass for pyproject.toml, whose TOML tree is fully available before any
dependency is resolved), consulted per-dependency via Self::resolve_source_for.
Implementations§
Source§impl PypiIndexConfig
impl PypiIndexConfig
Sourcepub fn new() -> Self
pub fn new() -> Self
An empty config — every dependency resolves to plain DependencySource::Registry,
byte-identical to today (US-004).
Sourcepub fn set_primary(&mut self, raw: &str, policy: &RegistryAccessPolicy)
pub fn set_primary(&mut self, raw: &str, policy: &RegistryAccessPolicy)
FR-002: sets (overwriting any prior value) the explicit --index-url/Poetry
primary-equivalent primary. Matches pip’s own argparse store semantics for
--index-url (not append, unlike --extra-index-url) — the last occurrence in a
file wins.
Sourcepub fn add_extra(&mut self, raw: &str, policy: &RegistryAccessPolicy)
pub fn add_extra(&mut self, raw: &str, policy: &RegistryAccessPolicy)
FR-003: appends an --extra-index-url/Poetry supplemental-priority/uv non-default
entry to the fallback chain, in declaration order.
Sourcepub fn resolve_source_for(&self, named_source: Option<&str>) -> DependencySource
pub fn resolve_source_for(&self, named_source: Option<&str>) -> DependencySource
FR-002/FR-003/FR-005/FR-006/FR-007/FR-013: resolves one dependency’s
DependencySource.
named_source is Some("internal") for a dependency declaring source = "internal"
(Poetry) or an index = "internal" uv-sources binding; None for every other
dependency (routes through primary/extras/tail_hop per FR-005 instead).
- A named-source reference resolves to that source’s own URL, or
DependencySource::CustomRegistryif the name is unresolved or the source is invalid (fail-closed, never a silentpypi.orgfallback — FR-006). - No override anywhere (no primary, no case-(b) declaration) -> plain
DependencySource::Registry(US-004). - An explicit primary present but invalid ->
DependencySource::CustomRegistry(fail-closed — never falls through to the extras chain, matching an explicit--index-url’s replace, not add, semantics). - Otherwise ->
DependencySource::AlternateRegistrypointing at the chainResolvedChain::keythis same config’sSelf::resolved_chainsregisters.
Sourcepub fn resolved_chains(&self) -> Vec<ResolvedChain>
pub fn resolved_chains(&self) -> Vec<ResolvedChain>
Every chain this config implies, ready for registration — FR-005(a)/(b) resolved to
concrete hop lists, plus one single-hop chain per valid named source. Empty when the
file declares nothing (US-004) or when every case-(b) hop turned out invalid with no
explicit primary (N5’s zero-hop case — Self::resolve_source_for returns plain
Registry in that case, and there is nothing to register).
Trait Implementations§
Source§impl Debug for PypiIndexConfig
impl Debug for PypiIndexConfig
Source§impl Default for PypiIndexConfig
impl Default for PypiIndexConfig
Source§fn default() -> PypiIndexConfig
fn default() -> PypiIndexConfig
Auto Trait Implementations§
impl Freeze for PypiIndexConfig
impl RefUnwindSafe for PypiIndexConfig
impl Send for PypiIndexConfig
impl Sync for PypiIndexConfig
impl Unpin for PypiIndexConfig
impl UnsafeUnpin for PypiIndexConfig
impl UnwindSafe for PypiIndexConfig
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
§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