pub enum CompileKind {
Host,
Target(CompileTarget),
}
Expand description
Indicator for how a unit is being compiled.
This is used primarily for organizing cross compilations vs host
compilations, where cross compilations happen at the request of --target
and host compilations happen for things like build scripts and procedural
macros.
Variants
Host
Attached to a unit that is compiled for the “host” system or otherwise
is compiled without a --target
flag. This is used for procedural
macros and build scripts, or if the --target
flag isn’t passed.
Target(CompileTarget)
Attached to a unit to be compiled for a particular target. This is used
for units when the --target
flag is passed.
Implementations
sourceimpl CompileKind
impl CompileKind
pub fn is_host(&self) -> bool
pub fn for_target(self, target: &Target) -> CompileKind
sourcepub fn from_requested_targets(
config: &Config,
targets: &[String]
) -> CargoResult<Vec<CompileKind>>
pub fn from_requested_targets(
config: &Config,
targets: &[String]
) -> CargoResult<Vec<CompileKind>>
Creates a new list of CompileKind
based on the requested list of
targets.
If no targets are given then this returns a single-element vector with
CompileKind::Host
.
sourcepub fn fingerprint_hash(&self) -> u64
pub fn fingerprint_hash(&self) -> u64
Hash used for fingerprinting.
Metadata hashing uses the normal Hash trait, which does not
differentiate on .json
file contents. The fingerprint hash does
check the contents.
Trait Implementations
sourceimpl Clone for CompileKind
impl Clone for CompileKind
sourcefn clone(&self) -> CompileKind
fn clone(&self) -> CompileKind
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for CompileKind
impl Debug for CompileKind
sourceimpl Hash for CompileKind
impl Hash for CompileKind
sourceimpl Ord for CompileKind
impl Ord for CompileKind
sourceimpl PartialEq<CompileKind> for CompileKind
impl PartialEq<CompileKind> for CompileKind
sourcefn eq(&self, other: &CompileKind) -> bool
fn eq(&self, other: &CompileKind) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &CompileKind) -> bool
fn ne(&self, other: &CompileKind) -> bool
This method tests for !=
.
sourceimpl PartialOrd<CompileKind> for CompileKind
impl PartialOrd<CompileKind> for CompileKind
sourcefn partial_cmp(&self, other: &CompileKind) -> Option<Ordering>
fn partial_cmp(&self, other: &CompileKind) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl Serialize for CompileKind
impl Serialize for CompileKind
impl Copy for CompileKind
impl Eq for CompileKind
impl StructuralEq for CompileKind
impl StructuralPartialEq for CompileKind
Auto Trait Implementations
impl RefUnwindSafe for CompileKind
impl Send for CompileKind
impl Sync for CompileKind
impl Unpin for CompileKind
impl UnwindSafe for CompileKind
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
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
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more