pub struct FunctionVariants<'a> { /* private fields */ }
Expand description

Class representing the LC_FUNCTION_VARIANTS load command.

Introduced publicly in dyld-1284.13 (April 2025), this command supports function multiversioning, the ability to associate multiple implementations of the same function, each optimized for a specific platform, architecture, or runtime context.

At runtime, the system dispatches the most appropriate variant based on hardware capabilities or execution environment.

For example:

FUNCTION_VARIANT_TABLE(my_function,
  { (void*)my_function$Rosetta,  "rosetta" }, // Rosetta translation
  { (void*)my_function$Haswell,  "haswell" }, // Haswell-optimized
  { (void*)my_function$Base,     "default" }  // Default fallback
);

Implementations§

§

impl FunctionVariants<'_>

pub fn data_offset(&self) -> u32

Offset in the __LINKEDIT segment where the payload is located

pub fn data_size(&self) -> u32

Size of the payload

pub fn content(&self) -> &[u8]

Raw payload as a slice of bytes

pub fn runtime_table(&self) -> RuntimeTables<'_>

Iterator over the different RuntimeTable entries located in the content of this __LINKEDIT command

Trait Implementations§

§

impl Command for FunctionVariants<'_>

§

fn size(&self) -> u32

Size of the command (should be greater than sizeof(load_command))
§

fn offset(&self) -> u64

Offset of the command within the Load Command Table
§

fn command_type(&self) -> LoadCommandTypes

The command’s type
§

fn data(&self) -> &[u8]

The raw command as a slice of bytes
§

impl Debug for FunctionVariants<'_>

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for FunctionVariants<'a>

§

impl<'a> !Send for FunctionVariants<'a>

§

impl<'a> !Sync for FunctionVariants<'a>

§

impl<'a> Unpin for FunctionVariants<'a>

§

impl<'a> !UnwindSafe for FunctionVariants<'a>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.