Enum rustc::ty::layout::Layout
[−]
[src]
pub enum Layout {
Scalar {
value: Primitive,
non_zero: bool,
},
Vector {
element: Primitive,
count: u64,
},
Array {
sized: bool,
align: Align,
size: Size,
},
FatPointer {
metadata: Primitive,
non_zero: bool,
},
CEnum {
discr: Integer,
signed: bool,
min: u64,
max: u64,
},
Univariant {
variant: Struct,
non_zero: bool,
},
General {
discr: Integer,
variants: Vec<Struct>,
size: Size,
align: Align,
},
RawNullablePointer {
nndiscr: u64,
value: Primitive,
},
StructWrappedNullablePointer {
nndiscr: u64,
nonnull: Struct,
discrfield: FieldPath,
},
}rustc_private)Type layout, from which size and alignment can be cheaply computed. For ADTs, it also includes field placement and enum optimizations. NOTE: Because Layout is interned, redundant information should be kept to a minimum, e.g. it includes no sub-component Ty or Layout.
Variants
Scalarrustc_private)TyBool, TyChar, TyInt, TyUint, TyFloat, TyRawPtr, TyRef or TyFnPtr.
Fields
value: Primitive | Unstable ( rustc_private) |
non_zero: bool | Unstable ( rustc_private) |
Vectorrustc_private)SIMD vectors, from TyStruct marked with #[repr(simd)].
Fields
element: Primitive | Unstable ( rustc_private) |
count: u64 | Unstable ( rustc_private) |
Arrayrustc_private)TyArray, TySlice or TyStr.
Fields
sized: bool | Unstable ( rustc_private)If true, the size is exact, otherwise it's only a lower bound. |
align: Align | Unstable ( rustc_private) |
size: Size | Unstable ( rustc_private) |
FatPointerrustc_private)TyRawPtr or TyRef with a !Sized pointee.
Fields
metadata: Primitive | Unstable ( rustc_private) |
non_zero: bool | Unstable ( rustc_private) |
CEnumrustc_private)C-like enums; basically an integer.
Fields
discr: Integer | Unstable ( rustc_private) |
signed: bool | Unstable ( rustc_private) |
min: u64 | Unstable ( rustc_private) |
max: u64 | Unstable ( rustc_private) |
Univariantrustc_private)Single-case enums, and structs/tuples.
Fields
variant: Struct | Unstable ( rustc_private) |
non_zero: bool | Unstable ( rustc_private) |
Generalrustc_private)General-case enums: for each case there is a struct, and they all start with a field for the discriminant.
Fields
discr: Integer | Unstable ( rustc_private) |
variants: Vec<Struct> | Unstable ( rustc_private) |
size: Size | Unstable ( rustc_private) |
align: Align | Unstable ( rustc_private) |
RawNullablePointerrustc_private)Two cases distinguished by a nullable pointer: the case with discriminant
nndiscr must have single field which is known to be nonnull due to its type.
The other case is known to be zero sized. Hence we represent the enum
as simply a nullable pointer: if not null it indicates the nndiscr variant,
otherwise it indicates the other case.
For example, std::option::Option instantiated at a safe pointer type
is represented such that None is a null pointer and Some is the
identity function.
Fields
nndiscr: u64 | Unstable ( rustc_private) |
value: Primitive | Unstable ( rustc_private) |
StructWrappedNullablePointerrustc_private)Two cases distinguished by a nullable pointer: the case with discriminant
nndiscr is represented by the struct nonnull, where the discrfieldth
field is known to be nonnull due to its type; if that field is null, then
it represents the other case, which is known to be zero sized.
Fields
nndiscr: u64 | Unstable ( rustc_private) |
nonnull: Struct | Unstable ( rustc_private) |
discrfield: FieldPath | Unstable ( rustc_private) |
Methods
impl<'a, 'gcx, 'tcx> Layout[src]
fn compute_uncached(ty: Ty<'gcx>, infcx: &InferCtxt<'a, 'gcx, 'tcx>) -> Result<Layout, LayoutError<'gcx>>
fn is_unsized(&self) -> bool
rustc_private)Returns true if the layout corresponds to an unsized type.
fn size(&self, dl: &TargetDataLayout) -> Size
fn align(&self, dl: &TargetDataLayout) -> Align
Trait Implementations
Derived Implementations
impl Hash for Layout[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
Feeds this value into the state given, updating the hasher as necessary.
fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher1.3.0
Feeds a slice of this type into the state provided.
impl Eq for Layout[src]
impl PartialEq for Layout[src]
fn eq(&self, __arg_0: &Layout) -> bool
This method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, __arg_0: &Layout) -> bool
This method tests for !=.