Struct cargo::sources::config::SourceConfigMap
source · pub struct SourceConfigMap<'gctx> {
cfgs: HashMap<String, SourceConfig>,
id2name: HashMap<SourceId, String>,
overlays: HashMap<SourceId, SourceId>,
gctx: &'gctx GlobalContext,
}
Expand description
Represents the entire [source]
replacement table in Cargo configuration.
Fields§
§cfgs: HashMap<String, SourceConfig>
Mapping of source name to the toml configuration.
id2name: HashMap<SourceId, String>
Mapping of SourceId
to the source name.
overlays: HashMap<SourceId, SourceId>
Mapping of sources to local registries that will be overlaid on them.
gctx: &'gctx GlobalContext
Implementations§
source§impl<'gctx> SourceConfigMap<'gctx>
impl<'gctx> SourceConfigMap<'gctx>
sourcepub fn new(gctx: &'gctx GlobalContext) -> CargoResult<SourceConfigMap<'gctx>>
pub fn new(gctx: &'gctx GlobalContext) -> CargoResult<SourceConfigMap<'gctx>>
Like SourceConfigMap::empty
but includes sources from source
replacement configurations.
sourcepub fn new_with_overlays(
gctx: &'gctx GlobalContext,
overlays: impl IntoIterator<Item = (SourceId, SourceId)>,
) -> CargoResult<SourceConfigMap<'gctx>>
pub fn new_with_overlays( gctx: &'gctx GlobalContext, overlays: impl IntoIterator<Item = (SourceId, SourceId)>, ) -> CargoResult<SourceConfigMap<'gctx>>
Like SourceConfigMap::new
but includes sources from source
replacement configurations.
sourcepub fn empty(gctx: &'gctx GlobalContext) -> CargoResult<SourceConfigMap<'gctx>>
pub fn empty(gctx: &'gctx GlobalContext) -> CargoResult<SourceConfigMap<'gctx>>
Creates the default set of sources that doesn’t take [source]
replacement into account.
sourcepub fn gctx(&self) -> &'gctx GlobalContext
pub fn gctx(&self) -> &'gctx GlobalContext
Returns the GlobalContext
this source config map is associated with.
sourcepub fn load(
&self,
id: SourceId,
yanked_whitelist: &HashSet<PackageId>,
) -> CargoResult<Box<dyn Source + 'gctx>>
pub fn load( &self, id: SourceId, yanked_whitelist: &HashSet<PackageId>, ) -> CargoResult<Box<dyn Source + 'gctx>>
sourcefn load_overlaid(
&self,
id: SourceId,
yanked_whitelist: &HashSet<PackageId>,
) -> CargoResult<Box<dyn Source + 'gctx>>
fn load_overlaid( &self, id: SourceId, yanked_whitelist: &HashSet<PackageId>, ) -> CargoResult<Box<dyn Source + 'gctx>>
sourcefn add(&mut self, name: &str, cfg: SourceConfig) -> CargoResult<()>
fn add(&mut self, name: &str, cfg: SourceConfig) -> CargoResult<()>
Adds a source config with an associated name.
sourcefn add_config(&mut self, name: String, def: SourceConfigDef) -> CargoResult<()>
fn add_config(&mut self, name: String, def: SourceConfigDef) -> CargoResult<()>
Adds a source config from TOML definition.
Trait Implementations§
source§impl<'gctx> Clone for SourceConfigMap<'gctx>
impl<'gctx> Clone for SourceConfigMap<'gctx>
source§fn clone(&self) -> SourceConfigMap<'gctx>
fn clone(&self) -> SourceConfigMap<'gctx>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl<'gctx> Freeze for SourceConfigMap<'gctx>
impl<'gctx> !RefUnwindSafe for SourceConfigMap<'gctx>
impl<'gctx> !Send for SourceConfigMap<'gctx>
impl<'gctx> !Sync for SourceConfigMap<'gctx>
impl<'gctx> Unpin for SourceConfigMap<'gctx>
impl<'gctx> !UnwindSafe for SourceConfigMap<'gctx>
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§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>
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 152 bytes