pub struct CargoContext {
pub package_name: String,
pub package_version: String,
pub package_id: String,
pub manifest_path: PathBuf,
pub workspace_root: PathBuf,
pub target_directory: PathBuf,
pub targets: Vec<CargoTarget>,
pub active_features: Vec<String>,
pub candle_versions: BTreeMap<String, String>,
pub dependency_aliases: BTreeMap<String, String>,
pub cfgs: Vec<String>,
}Expand description
Deterministic snapshot of the Cargo package / workspace / feature / cfg context.
Fields§
§package_name: String§package_version: String§package_id: String§manifest_path: PathBuf§workspace_root: PathBuf§target_directory: PathBuf§targets: Vec<CargoTarget>Targets of the selected package, sorted by (name, kind, src_path).
active_features: Vec<String>Resolved active features for the selected package, sorted.
candle_versions: BTreeMap<String, String>Versions of every package whose name starts with candle-, keyed by name.
dependency_aliases: BTreeMap<String, String>Rust crate identifier (including dependency renames) to Cargo package name.
cfgs: Vec<String>Active rustc --print cfg lines plus feature="…" for each active feature, sorted.
Implementations§
Source§impl CargoContext
impl CargoContext
Sourcepub fn discover(path: impl AsRef<Path>, options: &CargoOptions) -> Result<Self>
pub fn discover(path: impl AsRef<Path>, options: &CargoOptions) -> Result<Self>
Discover Cargo context for path, which may be a crate root or a nested source directory.
Sourcepub fn selected_source_roots(
&self,
requested: Option<&str>,
) -> Result<Vec<PathBuf>>
pub fn selected_source_roots( &self, requested: Option<&str>, ) -> Result<Vec<PathBuf>>
Crate roots selected for source analysis.
By default a library target is preferred because binaries normally consume it. Packages without a library select their first ordinary binary. Tests/examples/benches are included only when explicitly selected by target name.
Trait Implementations§
Source§impl Clone for CargoContext
impl Clone for CargoContext
Source§fn clone(&self) -> CargoContext
fn clone(&self) -> CargoContext
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more