Cargo: How to programmatically get replaced registry source?

Hi,

I use a mirror (with source.crates-io.replace-with) for the crates.io index due to some network conditions. That works fine on the command line.

When using the cargo crate, cargo::core::SourceId::crates_io() will always give the crates.io source without regard to config. crate::Config::load_values() does show there's a replace-with entry, but it doesn't seem to affect the result.

How can I get such replaced source? Thanks.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.