Struct cargo::core::compiler::TargetInfo

source ·
pub struct TargetInfo {
    crate_type_process: ProcessBuilder,
    crate_types: RefCell<HashMap<CrateType, Option<(String, String)>>>,
    cfg: Vec<Cfg>,
    support_split_debuginfo: Vec<String>,
    pub sysroot: PathBuf,
    pub sysroot_host_libdir: PathBuf,
    pub sysroot_target_libdir: PathBuf,
    pub rustflags: Vec<String>,
    pub rustdocflags: Vec<String>,
}
Expand description

Information about the platform target gleaned from querying rustc.

RustcTargetData keeps several of these, one for the host and the others for other specified targets. If no target is specified, it uses a clone from the host.

Fields§

§crate_type_process: ProcessBuilder

A base process builder for discovering crate type information. In particular, this is used to determine the output filename prefix and suffix for a crate type.

§crate_types: RefCell<HashMap<CrateType, Option<(String, String)>>>

Cache of output filename prefixes and suffixes.

The key is the crate type name (like cdylib) and the value is Some((prefix, suffix)), for example libcargo.so would be Some(("lib", ".so")). The value is None` if the crate type is not supported.

§cfg: Vec<Cfg>

cfg information extracted from rustc --print=cfg.

§support_split_debuginfo: Vec<String>

Supported values for -Csplit-debuginfo= flag, queried from rustc

§sysroot: PathBuf

Path to the sysroot.

§sysroot_host_libdir: PathBuf

Path to the “lib” or “bin” directory that rustc uses for its dynamic libraries.

§sysroot_target_libdir: PathBuf

Path to the “lib” directory in the sysroot which rustc uses for linking target libraries.

§rustflags: Vec<String>

Extra flags to pass to rustc, see extra_args.

§rustdocflags: Vec<String>

Extra flags to pass to rustdoc, see extra_args.

Implementations§

Learns the information of target platform from rustc invocation(s).

Generally, the first time calling this function is expensive, as it may query rustc several times. To reduce the cost, output of each rustc invocation is cached by Rustc::cached_output.

Search Tricky to learn why querying rustc several times is needed.

All the target Cfg settings.

Returns the list of file types generated by the given crate type.

Returns None if the target does not support the given crate type.

Returns all the file types generated by rustc for the given mode/target_kind.

The first value is a Vec of file types generated, the second value is a list of CrateTypes that are not supported by the given target.

Checks if the debuginfo-split value is supported by this target

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.

Size: 384 bytes