Enum rustc_target::abi::FieldPlacement [−][src]
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.
ArrayArray/vector-like placement, with all fields of identical types.
Fields of Array
stride: Size | |
count: u64 |
ArbitraryStruct-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 how fields were permuted. |
Methods
impl FieldPlacement[src]
impl FieldPlacementpub fn count(&self) -> usize[src]
pub fn count(&self) -> usizepub fn offset(&self, i: usize) -> Size[src]
pub fn offset(&self, i: usize) -> Sizepub fn memory_index(&self, i: usize) -> usize[src]
pub fn memory_index(&self, i: usize) -> usizepub fn index_by_increasing_offset<'a>(
&'a self
) -> impl Iterator<Item = usize> + 'a[src]
pub fn index_by_increasing_offset<'a>(
&'a self
) -> impl Iterator<Item = usize> + 'aGet source indices of the fields by increasing offsets.
Trait Implementations
impl PartialEq for FieldPlacement[src]
impl PartialEq for FieldPlacementfn eq(&self, other: &FieldPlacement) -> bool[src]
fn eq(&self, other: &FieldPlacement) -> boolThis method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, other: &FieldPlacement) -> bool[src]
fn ne(&self, other: &FieldPlacement) -> boolThis method tests for !=.
impl Eq for FieldPlacement[src]
impl Eq for FieldPlacementimpl Hash for FieldPlacement[src]
impl Hash for FieldPlacementfn hash<__H: Hasher>(&self, state: &mut __H)[src]
fn hash<__H: Hasher>(&self, state: &mut __H)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]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, Feeds a slice of this type into the given [Hasher]. Read more
impl Debug for FieldPlacement[src]
impl Debug for FieldPlacementAuto Trait Implementations
impl Send for FieldPlacement
impl Send for FieldPlacementimpl Sync for FieldPlacement
impl Sync for FieldPlacement