Enum midenc_hir_type::TypeRepr
source · pub enum TypeRepr {
Default,
Align(NonZeroU16),
Packed(NonZeroU16),
Transparent,
}Expand description
This represents metadata about how a structured type will be represented in memory
Variants§
Default
This corresponds to the C ABI representation for a given type
Align(NonZeroU16)
This modifies the default representation, by raising the minimum alignment.
The alignment must be a power of two, e.g. 32, and values from 1 to 2^16 are allowed.
The alignment must be greater than the default minimum alignment of the type or this representation has no effect.
Packed(NonZeroU16)
This modifies the default representation, by lowering the minimum alignment of a type, and in the case of structs, changes the alignments of the fields to be the smaller of the specified alignment and the default alignment. This has the effect of changing the layout of a struct.
Notably, Packed(1) will result in a struct that has no alignment requirement,
and no padding between fields.
The alignment must be a power of two, e.g. 32, and values from 1 to 2^16 are allowed.
The alignment must be smaller than the default alignment, or this representation has no effect.
Transparent
This may only be used on structs with no more than one non-zero sized field, and indicates that the representation of that field should be used for the struct.
Implementations§
source§impl TypeRepr
impl TypeRepr
Trait Implementations§
source§impl PartialEq for TypeRepr
impl PartialEq for TypeRepr
impl Copy for TypeRepr
impl Eq for TypeRepr
impl StructuralPartialEq for TypeRepr
Auto Trait Implementations§
impl Freeze for TypeRepr
impl RefUnwindSafe for TypeRepr
impl Send for TypeRepr
impl Sync for TypeRepr
impl Unpin for TypeRepr
impl UnwindSafe for TypeRepr
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: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)