pub struct ReprOptions {
pub int: Option<IntegerType>,
pub align: Option<Align>,
pub pack: Option<Align>,
pub flags: ReprFlags,
pub field_shuffle_seed: u64,
}
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: u64
The seed to be used for randomizing a type’s layout
Note: This could technically be a u128
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
impl ReprOptions
pub fn simd(&self) -> bool
pub fn c(&self) -> bool
pub fn packed(&self) -> bool
pub fn transparent(&self) -> bool
pub fn linear(&self) -> bool
Sourcepub fn discr_type(&self) -> IntegerType
pub fn discr_type(&self) -> IntegerType
Returns the discriminant type, given these repr
options.
This must only be called on enums!
Sourcepub fn inhibit_enum_layout_opt(&self) -> bool
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.
pub fn inhibit_newtype_abi_optimization(&self) -> bool
Sourcepub fn inhibit_struct_field_reordering(&self) -> bool
pub fn inhibit_struct_field_reordering(&self) -> bool
Returns true
if this #[repr()]
guarantees a fixed field order,
e.g. repr(C)
or repr(<int>)
.
Sourcepub fn can_randomize_type_layout(&self) -> bool
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.
Sourcepub fn inhibits_union_abi_opt(&self) -> bool
pub fn inhibits_union_abi_opt(&self) -> bool
Returns true
if this #[repr()]
should inhibit union ABI optimisations.
Trait Implementations§
Source§impl Clone for ReprOptions
impl Clone for ReprOptions
Source§fn clone(&self) -> ReprOptions
fn clone(&self) -> ReprOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more