Struct rustc_abi::ReprOptions

source ·
pub struct ReprOptions {
    pub int: Option<IntegerType>,
    pub align: Option<Align>,
    pub pack: Option<Align>,
    pub flags: ReprFlags,
    pub field_shuffle_seed: Hash64,
}
Expand description

Represents the repr options provided by the user.

Fields§

§int: Option<IntegerType>§align: Option<Align>§pack: Option<Align>§flags: ReprFlags§field_shuffle_seed: Hash64

The seed to be used for randomizing a type’s layout

Note: This could technically be a Hash128 which would be the “most accurate” hash as it’d encompass the item and crate hash without loss, but it does pay the price of being larger. Everything’s a tradeoff, a 64-bit seed should be sufficient for our purposes (primarily -Z randomize-layout)

Implementations§

source§

impl ReprOptions

source

pub fn simd(&self) -> bool

source

pub fn c(&self) -> bool

source

pub fn packed(&self) -> bool

source

pub fn transparent(&self) -> bool

source

pub fn linear(&self) -> bool

source

pub fn discr_type(&self) -> IntegerType

Returns the discriminant type, given these repr options. This must only be called on enums!

source

pub fn inhibit_enum_layout_opt(&self) -> bool

Returns true if this #[repr()] should inhabit “smart enum layout” optimizations, such as representing Foo<&T> as a single pointer.

source

pub fn inhibit_struct_field_reordering_opt(&self) -> bool

Returns true if this #[repr()] should inhibit struct field reordering optimizations, such as with repr(C), repr(packed(1)), or repr(<int>).

source

pub fn can_randomize_type_layout(&self) -> bool

Returns true if this type is valid for reordering and -Z randomize-layout was enabled for its declaration crate.

source

pub fn inhibit_union_abi_opt(&self) -> bool

Returns true if this #[repr()] should inhibit union ABI optimisations.

Trait Implementations§

source§

impl Clone for ReprOptions

source§

fn clone(&self) -> ReprOptions

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for ReprOptions

source§

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

Formats the value using the given formatter. Read more
source§

impl<__D: Decoder> Decodable<__D> for ReprOptions

source§

fn decode(__decoder: &mut __D) -> Self

source§

impl Default for ReprOptions

source§

fn default() -> ReprOptions

Returns the “default value” for a type. Read more
source§

impl<__E: Encoder> Encodable<__E> for ReprOptions

source§

fn encode(&self, __encoder: &mut __E)

source§

impl<__CTX> HashStable<__CTX> for ReprOptionswhere __CTX: HashStableContext,

source§

fn hash_stable(&self, __hcx: &mut __CTX, __hasher: &mut StableHasher)

source§

impl PartialEq<ReprOptions> for ReprOptions

source§

fn eq(&self, other: &ReprOptions) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for ReprOptions

source§

impl Eq for ReprOptions

source§

impl StructuralEq for ReprOptions

source§

impl StructuralPartialEq for ReprOptions

Auto Trait Implementations§

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> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.

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