Struct TypeLayout

Source
pub struct TypeLayout {
    pub size_bits: u64,
    pub field_alignment_bits: u64,
    pub pointer_alignment_bits: u64,
    pub required_alignment_bits: u64,
}
Expand description

The computed layout of a type.

Fields§

§size_bits: u64

The size of the type in bits.

This is the value returned by sizeof and C and std::mem::size_of in Rust (but in bits instead of bytes). This is a multiple of pointer_alignment_bits.

§field_alignment_bits: u64

The alignment of the type, in bits, when used as a field in a record.

This is usually the value returned by _Alignof in C, but there are some edge cases in GCC where _Alignof returns a smaller value.

§pointer_alignment_bits: u64

The alignment, in bits, of valid pointers to this type.

This is the value returned by std::mem::align_of in Rust (but in bits instead of bytes). size_bits is a multiple of this value.

§required_alignment_bits: u64

The required alignment of the type in bits.

This value is only used by MSVC targets. It is 8 on all other targets. On MSVC targets, this value restricts the effects of #pragma pack except in some cases involving bit-fields.

Trait Implementations§

Source§

impl Clone for TypeLayout

Source§

fn clone(&self) -> TypeLayout

Returns a duplicate 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 TypeLayout

Source§

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

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

impl Default for TypeLayout

Source§

fn default() -> TypeLayout

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

impl Into<()> for TypeLayout

Source§

fn into(self)

Converts this type into the (usually inferred) input type.
Source§

impl Layout for TypeLayout

Source§

type TypeLayout = TypeLayout

The type used to encode the layout of the type itself.
Source§

type FieldLayout = FieldLayout

The type used to encode the layout of a field in a record.
Source§

type OpaqueLayout = TypeLayout

The type used to encode the layout of an opaque type.
Source§

impl PartialEq for TypeLayout

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for TypeLayout

Source§

impl Eq for TypeLayout

Source§

impl StructuralPartialEq for TypeLayout

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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 T
where 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 T
where T: Clone,

Source§

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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.