pub struct SourceReplacementSettings {
pub entries: BTreeMap<SourceLocator, SourceReplacementEntry>,
}Expand description
Collection of source-replacement entries plus typed resolution / cycle detection.
Built by cabin-config’s merger from the highest-priority
config file’s [source-replacement] table; lower-priority
files contribute additional entries when their original
key is not already covered, so the resulting map preserves
the same “higher level overrides” semantics the rest of the
config layer uses.
Fields§
§entries: BTreeMap<SourceLocator, SourceReplacementEntry>(original -> entry) keyed by the source being
replaced. BTreeMap keeps iteration deterministic for
metadata + lockfile serialization.
Implementations§
Source§impl SourceReplacementSettings
impl SourceReplacementSettings
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Whether the table carries no entries. Used by the workspace loader / metadata view to skip emitting empty blocks.
Sourcepub fn resolve(
&self,
initial: &SourceLocator,
) -> Result<SourceReplacementResolution, SourceReplacementError>
pub fn resolve( &self, initial: &SourceLocator, ) -> Result<SourceReplacementResolution, SourceReplacementError>
Resolve initial through the replacement chain. Returns
the terminal source plus the chain of intermediate
originals (in walk order) so the lockfile / metadata view
can record the full hop list.
Cycles surface a SourceReplacementError::Cycle
carrying the offending hop list so users see exactly
which entries form the loop.
§Errors
Returns SourceReplacementError::Cycle when the replacement chain
revisits a source, carrying the hop list up to and including the
repeated entry.
Sourcepub fn replaces(&self, original: &SourceLocator) -> bool
pub fn replaces(&self, original: &SourceLocator) -> bool
Whether the supplied original source has a replacement
declared. Useful when the orchestration layer wants to
know if applying replacement changed anything (so the
metadata / lockfile view can show “unchanged” cleanly).
Trait Implementations§
Source§impl Clone for SourceReplacementSettings
impl Clone for SourceReplacementSettings
Source§fn clone(&self) -> SourceReplacementSettings
fn clone(&self) -> SourceReplacementSettings
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SourceReplacementSettings
impl Debug for SourceReplacementSettings
Source§impl Default for SourceReplacementSettings
impl Default for SourceReplacementSettings
Source§fn default() -> SourceReplacementSettings
fn default() -> SourceReplacementSettings
Source§impl<'de> Deserialize<'de> for SourceReplacementSettings
impl<'de> Deserialize<'de> for SourceReplacementSettings
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for SourceReplacementSettings
impl PartialEq for SourceReplacementSettings
Source§fn eq(&self, other: &SourceReplacementSettings) -> bool
fn eq(&self, other: &SourceReplacementSettings) -> bool
self and other values to be equal, and is used by ==.impl Eq for SourceReplacementSettings
impl StructuralPartialEq for SourceReplacementSettings
Auto Trait Implementations§
impl Freeze for SourceReplacementSettings
impl RefUnwindSafe for SourceReplacementSettings
impl Send for SourceReplacementSettings
impl Sync for SourceReplacementSettings
impl Unpin for SourceReplacementSettings
impl UnsafeUnpin for SourceReplacementSettings
impl UnwindSafe for SourceReplacementSettings
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.