Enum cargo::core::compiler::CompileKind
source · 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§
source§impl 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§
source§impl Clone for CompileKind
impl Clone for CompileKind
source§fn clone(&self) -> CompileKind
fn clone(&self) -> CompileKind
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for CompileKind
impl Debug for CompileKind
source§impl Hash for CompileKind
impl Hash for CompileKind
source§impl Ord for CompileKind
impl Ord for CompileKind
source§fn cmp(&self, other: &CompileKind) -> Ordering
fn cmp(&self, other: &CompileKind) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
source§impl PartialEq<CompileKind> for CompileKind
impl PartialEq<CompileKind> for CompileKind
source§fn eq(&self, other: &CompileKind) -> bool
fn eq(&self, other: &CompileKind) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<CompileKind> for CompileKind
impl PartialOrd<CompileKind> for CompileKind
source§fn partial_cmp(&self, other: &CompileKind) -> Option<Ordering>
fn partial_cmp(&self, other: &CompileKind) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl 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§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> Serialize for Twhere
T: Serialize + ?Sized,
impl<T> Serialize for Twhere T: Serialize + ?Sized,
fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<Ok, Error>
source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,
source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
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: 16 bytes
Size for each variant:
Host
: 0 bytesTarget
: 16 bytes