pub struct Config { /* private fields */ }
Expand description
Configuration information for cargo. This is not specific to a build, it is information relating to cargo itself.
This struct implements Default
: all fields can be inferred.
Implementations
sourceimpl Config
impl Config
pub fn new(shell: Shell, cwd: PathBuf, homedir: PathBuf) -> Config
pub fn default() -> CargoResult<Config>
sourcepub fn home(&self) -> &Filesystem
pub fn home(&self) -> &Filesystem
The user’s cargo home directory (OS-dependent)
sourcepub fn git_path(&self) -> Filesystem
pub fn git_path(&self) -> Filesystem
The cargo git directory (<cargo_home>/git
)
sourcepub fn registry_index_path(&self) -> Filesystem
pub fn registry_index_path(&self) -> Filesystem
The cargo registry index directory (<cargo_home>/registry/index
)
sourcepub fn registry_cache_path(&self) -> Filesystem
pub fn registry_cache_path(&self) -> Filesystem
The cargo registry cache directory (<cargo_home>/registry/path
)
sourcepub fn registry_source_path(&self) -> Filesystem
pub fn registry_source_path(&self) -> Filesystem
The cargo registry source directory (<cargo_home>/registry/src
)
sourcepub fn default_registry(&self) -> CargoResult<Option<String>>
pub fn default_registry(&self) -> CargoResult<Option<String>>
The default cargo registry (alternative-registry
)
sourcepub fn shell(&self) -> RefMut<'_, Shell>
pub fn shell(&self) -> RefMut<'_, Shell>
Get a reference to the shell, for e.g. writing error messages
sourcepub fn rustdoc(&self) -> CargoResult<&Path>
pub fn rustdoc(&self) -> CargoResult<&Path>
Get the path to the rustdoc
executable
sourcepub fn rustc(&self, ws: Option<&Workspace<'_>>) -> CargoResult<Rustc>
pub fn rustc(&self, ws: Option<&Workspace<'_>>) -> CargoResult<Rustc>
Get the path to the rustc
executable
sourcepub fn cargo_exe(&self) -> CargoResult<&Path>
pub fn cargo_exe(&self) -> CargoResult<&Path>
Get the path to the cargo
executable
pub fn profiles(&self) -> CargoResult<&ConfigProfiles>
pub fn values(&self) -> CargoResult<&HashMap<String, ConfigValue>>
pub fn set_values(&self, values: HashMap<String, ConfigValue>) -> CargoResult<()>
pub fn reload_rooted_at_cargo_home(&mut self) -> CargoResult<()>
pub fn cwd(&self) -> &Path
pub fn target_dir(&self) -> CargoResult<Option<Filesystem>>
pub fn set_env(&mut self, env: HashMap<String, String>)
pub fn get_string(&self, key: &str) -> CargoResult<OptValue<String>>
pub fn get_bool(&self, key: &str) -> CargoResult<OptValue<bool>>
pub fn get_path(&self, key: &str) -> CargoResult<OptValue<PathBuf>>
pub fn get_path_and_args(
&self,
key: &str
) -> CargoResult<OptValue<(PathBuf, Vec<String>)>>
pub fn get_list(
&self,
key: &str
) -> CargoResult<OptValue<Vec<(String, PathBuf)>>>
pub fn get_list_or_split_string(
&self,
key: &str
) -> CargoResult<OptValue<Vec<String>>>
pub fn get_table(&self, key: &str) -> CargoResult<OptValue<HashMap<String, CV>>>
pub fn get_i64(&self, key: &str) -> CargoResult<OptValue<i64>>
pub fn configure(
&mut self,
verbose: u32,
quiet: Option<bool>,
color: &Option<String>,
frozen: bool,
locked: bool,
target_dir: &Option<PathBuf>,
unstable_flags: &[String]
) -> CargoResult<()>
pub fn cli_unstable(&self) -> &CliUnstable
pub fn extra_verbose(&self) -> bool
pub fn network_allowed(&self) -> bool
pub fn frozen(&self) -> bool
pub fn lock_update_allowed(&self) -> bool
sourcepub fn load_values(&self) -> CargoResult<HashMap<String, ConfigValue>>
pub fn load_values(&self) -> CargoResult<HashMap<String, ConfigValue>>
Loads configuration from the filesystem
sourcepub fn get_registry_index(&self, registry: &str) -> CargoResult<Url>
pub fn get_registry_index(&self, registry: &str) -> CargoResult<Url>
Gets the index for a registry.
pub fn jobserver_from_env(&self) -> Option<&Client>
pub fn http(&self) -> CargoResult<&RefCell<Easy>>
pub fn crates_io_source_id<F>(&self, f: F) -> CargoResult<SourceId>where
F: FnMut() -> CargoResult<SourceId>,
pub fn creation_time(&self) -> Instant
pub fn get<'de, T: Deserialize<'de>>(&self, key: &str) -> CargoResult<T>
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Config
impl !Send for Config
impl !Sync for Config
impl Unpin for Config
impl !UnwindSafe for Config
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more