pub struct CompileTarget { /* private fields */ }
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.
Implementations
sourceimpl CompileTarget
impl CompileTarget
pub fn new(name: &str) -> CargoResult<CompileTarget>
sourcepub fn rustc_target(&self) -> &str
pub fn rustc_target(&self) -> &str
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
sourceimpl Clone for CompileTarget
impl Clone for CompileTarget
sourcefn clone(&self) -> CompileTarget
fn clone(&self) -> CompileTarget
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 CompileTarget
impl Debug for CompileTarget
sourceimpl Hash for CompileTarget
impl Hash for CompileTarget
sourceimpl Ord for CompileTarget
impl Ord for CompileTarget
sourceimpl PartialEq<CompileTarget> for CompileTarget
impl PartialEq<CompileTarget> for CompileTarget
sourcefn eq(&self, other: &CompileTarget) -> bool
fn eq(&self, other: &CompileTarget) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &CompileTarget) -> bool
fn ne(&self, other: &CompileTarget) -> bool
This method tests for !=
.
sourceimpl PartialOrd<CompileTarget> for CompileTarget
impl PartialOrd<CompileTarget> for CompileTarget
sourcefn partial_cmp(&self, other: &CompileTarget) -> Option<Ordering>
fn partial_cmp(&self, other: &CompileTarget) -> 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 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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
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.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more