pub enum Target {
X86_64Linux,
Aarch64Linux,
Aarch64Macos,
}Expand description
A compilation target consisting of an architecture and operating system.
Variants§
X86_64Linux
x86-64 Linux (System V AMD64 ABI)
Aarch64Linux
AArch64 Linux (AAPCS64 ABI)
Aarch64Macos
AArch64 macOS (Apple Silicon, AAPCS64 with Apple extensions)
Implementations§
Source§impl Target
impl Target
Sourcepub fn host() -> Target
pub fn host() -> Target
Detect the host target at compile time.
Returns the target that matches the current compilation environment. This is useful for defaulting to native compilation.
Sourcepub fn elf_machine(&self) -> Option<u16>
pub fn elf_machine(&self) -> Option<u16>
Returns the ELF e_machine value for this target, if it uses ELF format.
This is used when generating ELF object files and executables.
Returns None for targets that don’t use ELF (e.g., macOS uses Mach-O).
Sourcepub fn page_size(&self) -> u64
pub fn page_size(&self) -> u64
Returns the default page size for this target in bytes.
This is used for executable segment alignment.
Sourcepub fn default_base_addr(&self) -> u64
pub fn default_base_addr(&self) -> u64
Returns the default base address for executables on this target.
This is the virtual address where the executable is loaded.
Sourcepub fn pointer_size(&self) -> u32
pub fn pointer_size(&self) -> u32
Returns the pointer size in bytes for this target.
Sourcepub fn stack_alignment(&self) -> u32
pub fn stack_alignment(&self) -> u32
Returns the required stack alignment in bytes for this target.
This is the alignment required at function call boundaries.
Sourcepub fn triple(&self) -> &'static str
pub fn triple(&self) -> &'static str
Returns the triple string for this target (e.g., “x86_64-unknown-linux-gnu”).
This can be useful for invoking external tools like system linkers.
Sourcepub fn macos_min_version(&self) -> Option<u32>
pub fn macos_min_version(&self) -> Option<u32>
Returns the minimum macOS version for this target, encoded for Mach-O.
The version is encoded as 0x00XXYYPP where XX is major, YY is minor, PP is patch.
For example, macOS 11.0.0 (Big Sur) is encoded as 0x000B0000.
Returns None for non-macOS targets.
Note: macOS 11.0 (Big Sur) was the first version to support Apple Silicon (ARM64),
which is why it’s the minimum for Aarch64Macos.
Trait Implementations§
impl Copy for Target
impl Eq for Target
impl StructuralPartialEq for Target
Auto Trait Implementations§
impl Freeze for Target
impl RefUnwindSafe for Target
impl Send for Target
impl Sync for Target
impl Unpin for Target
impl UnwindSafe for Target
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> 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>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<'src, T> IntoMaybe<'src, T> for Twhere
T: 'src,
impl<'src, T> IntoMaybe<'src, T> for Twhere
T: 'src,
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
§type Iter<'a> = Once<&'a T>
where
T: 'a
type Iter<'a> = Once<&'a T> where T: 'a
§fn contains(&self, val: &T) -> boolwhere
T: PartialEq,
fn contains(&self, val: &T) -> boolwhere
T: PartialEq,
§fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>where
'p: 'b,
fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>where
'p: 'b,
MaybeRef].