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(
gctx: &GlobalContext,
targets: &[String],
) -> CargoResult<Vec<CompileKind>>
pub fn from_requested_targets( gctx: &GlobalContext, 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 for CompileKind
impl PartialEq for CompileKind
Source§impl PartialOrd for CompileKind
impl PartialOrd for CompileKind
Source§impl Serialize for CompileKind
impl Serialize for CompileKind
impl Copy for CompileKind
impl Eq for CompileKind
impl StructuralPartialEq for CompileKind
Auto Trait Implementations§
impl Freeze for CompileKind
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> Serialize for T
impl<T> Serialize for T
fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>
fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§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>,
§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