Enum rustc_target::abi::FieldsShape[−][src]

pub enum FieldsShape {
    Primitive,
    Union(NonZeroUsize),
    Array {
        stride: Size,
        count: u64,
    },
    Arbitrary {
        offsets: Vec<Size>,
        memory_index: Vec<u32>,
    },
}
Expand description

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

Variants

Primitive
Expand description

Scalar primitives and !, which never have fields.

Union(NonZeroUsize)
Expand description

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

Array
Expand description

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

Show fields

Fields of Array

stride: Sizecount: u64
Arbitrary
Expand description

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.

Show fields

Fields of Arbitrary

offsets: Vec<Size>
Expand description

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>
Expand description

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.

Implementations

impl FieldsShape[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 Debug for FieldsShape[src]

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

Formats the value using the given formatter. Read more

impl Hash for FieldsShape[src]

fn hash<__H: Hasher>(&self, state: &mut __H)[src]

Feeds this value into the given Hasher. Read more

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher, 
1.3.0[src]

Feeds a slice of this type into the given Hasher. Read more

impl<__CTX> HashStable<__CTX> for FieldsShape where
    __CTX: HashStableContext, 
[src]

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

impl PartialEq<FieldsShape> for FieldsShape[src]

fn eq(&self, other: &FieldsShape) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &FieldsShape) -> bool[src]

This method tests for !=.

impl Eq for FieldsShape[src]

impl StructuralEq for FieldsShape[src]

impl StructuralPartialEq for FieldsShape[src]

Auto Trait Implementations

impl RefUnwindSafe for FieldsShape

impl Send for FieldsShape

impl Sync for FieldsShape

impl Unpin for FieldsShape

impl UnwindSafe for FieldsShape

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

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

type Error = !

pub fn from(Result<T, <T as MaybeResult<T>>::Error>) -> T[src]

pub fn to_result(Self) -> Result<T, <T as MaybeResult<T>>::Error>[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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.