Struct cargo::core::compiler::compile_kind::CompileTarget
source · pub struct CompileTarget {
name: InternedString,
}
Expand description
Abstraction for the representation of a compilation target that Cargo has.
Compilation targets are one of two things right now:
- A raw target string, like
x86_64-unknown-linux-gnu
. - The path to a JSON file, such as
/path/to/my-target.json
.
Raw target strings are typically dictated by rustc
itself and represent
built-in targets. Custom JSON files are somewhat unstable, but supported
here in Cargo. Note that for JSON target files this CompileTarget
stores a
full canonicalized path to the target.
The main reason for this existence is to handle JSON target files where when we call rustc we pass full paths but when we use it for Cargo’s purposes like naming directories or looking up configuration keys we only check the file stem of JSON target files. For built-in rustc targets this is just an uninterpreted string basically.
Fields§
§name: InternedString
Implementations§
source§impl CompileTarget
impl CompileTarget
pub fn new(name: &str) -> CargoResult<CompileTarget>
sourcepub fn rustc_target(&self) -> InternedString
pub fn rustc_target(&self) -> InternedString
Returns the full unqualified name of this target, suitable for passing
to rustc
directly.
Typically this is pretty much the same as short_name
, but for the case
of JSON target files this will be a full canonicalized path name for the
current filesystem.
sourcepub fn short_name(&self) -> &str
pub fn short_name(&self) -> &str
Returns a “short” version of the target name suitable for usage within Cargo for configuration and such.
This is typically the same as rustc_target
, or the full name, but for
JSON target files this returns just the file stem (e.g. foo
out of
foo.json
) instead of the full path.
sourcepub fn fingerprint_hash(&self) -> u64
pub fn fingerprint_hash(&self) -> u64
Trait Implementations§
source§impl Clone for CompileTarget
impl Clone for CompileTarget
source§fn clone(&self) -> CompileTarget
fn clone(&self) -> CompileTarget
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for CompileTarget
impl Debug for CompileTarget
source§impl Hash for CompileTarget
impl Hash for CompileTarget
source§impl Ord for CompileTarget
impl Ord for CompileTarget
source§fn cmp(&self, other: &CompileTarget) -> Ordering
fn cmp(&self, other: &CompileTarget) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
source§impl PartialEq<CompileTarget> for CompileTarget
impl PartialEq<CompileTarget> for CompileTarget
source§fn eq(&self, other: &CompileTarget) -> bool
fn eq(&self, other: &CompileTarget) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<CompileTarget> for CompileTarget
impl PartialOrd<CompileTarget> for CompileTarget
source§fn partial_cmp(&self, other: &CompileTarget) -> Option<Ordering>
fn partial_cmp(&self, other: &CompileTarget) -> 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 CompileTarget
impl Serialize for CompileTarget
impl Copy for CompileTarget
impl Eq for CompileTarget
impl StructuralEq for CompileTarget
impl StructuralPartialEq for CompileTarget
Auto Trait Implementations§
impl RefUnwindSafe for CompileTarget
impl Send for CompileTarget
impl Sync for CompileTarget
impl Unpin for CompileTarget
impl UnwindSafe for CompileTarget
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