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 for CompileTarget
impl PartialEq for CompileTarget
Source§impl PartialOrd for CompileTarget
impl PartialOrd for CompileTarget
Source§impl Serialize for CompileTarget
impl Serialize for CompileTarget
impl Copy for CompileTarget
impl Eq for CompileTarget
impl StructuralPartialEq for CompileTarget
Auto Trait Implementations§
impl Freeze for CompileTarget
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
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