Skip to main content

get_source_id

Function get_source_id 

Source
pub(crate) fn get_source_id(
    gctx: &GlobalContext,
    reg_or_index: Option<&RegistryOrIndex>,
) -> CargoResult<RegistrySourceIds>
Expand description

Gets the SourceId for an index or registry setting.

The reg_or_index value is from the command-line or config settings. If it’s None, and no source-replacement is configured, returns the source for crates.io. If it’s None, and source replacement is configured, returns an error.

The source for crates.io may be GitHub, index.crates.io, or a test-only registry depending on configuration.

If reg_or_index is set, source replacement is not followed.

The return value is a pair of SourceIds: The first may be a built-in replacement of crates.io (such as index.crates.io), while the second is always the original source.