[][src]Enum rustc_target::abi::FieldPlacement

pub enum FieldPlacement {
    Union(usize),
    Array {
        stride: Size,
        count: u64,
    },
    Arbitrary {
        offsets: Vec<Size>,
        memory_index: Vec<u32>,
    },
}

Describes how the fields of a type are located in memory.

Variants

Union(usize)

All fields start at no offset. The usize is the field count.

In the case of primitives the number of fields is 0.

Array

Array/vector-like placement, with all fields of identical types.

Fields of Array

stride: Sizecount: u64
Arbitrary

Struct-like placement, with precomputed offsets.

Fields are guaranteed to not overlap, but note that gaps before, between and after all the fields are NOT always padding, and as such their contents may not be discarded. For example, enum variants leave a gap at the start, where the discriminant field in the enum layout goes.

Fields of Arbitrary

offsets: Vec<Size>

Offsets for the first byte of each field, ordered to match the source definition order. This vector does not go in increasing order.

memory_index: Vec<u32>

Maps source order field indices to memory order indices, depending on how the fields were reordered (if at all). This is a permutation, with both the source order and the memory order using the same (0..n) index ranges.

Note that during computation of memory_index, sometimes it is easier to operate on the inverse mapping (that is, from memory order to source order), and that is usually named inverse_memory_index.

Methods

impl FieldPlacement[src]

pub fn count(&self) -> usize[src]

pub fn offset(&self, i: usize) -> Size[src]

pub fn memory_index(&self, i: usize) -> usize[src]

pub fn index_by_increasing_offset<'a>(
    &'a self
) -> impl Iterator<Item = usize> + 'a
[src]

Gets source indices of the fields by increasing offsets.

Trait Implementations

impl Eq for FieldPlacement[src]

impl PartialEq<FieldPlacement> for FieldPlacement[src]

impl Hash for FieldPlacement[src]

impl Debug for FieldPlacement[src]

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Erased for T[src]

impl<E> SpecializationError for E[src]

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]