## 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 `index` and `reg` values are from the command-line or config settings. If both are None, and no source-replacement is configured, returns the source for crates.io. If both are 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` is set, source replacement is not followed.

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