pub enum Primitive {
Int(Integer, bool),
F32,
F64,
Pointer(AddressSpace),
}
Expand description
Fundamental unit of memory access and layout.
Variants§
Int(Integer, bool)
The bool
is the signedness of the Integer
type.
One would think we would not care about such details this low down, but some ABIs are described in terms of C types and ISAs where the integer arithmetic is done on {sign,zero}-extended registers, e.g. a negative integer passed by zero-extension will appear positive in the callee, and most operations on it will produce the wrong values.
F32
F64
Pointer(AddressSpace)
Implementations§
source§impl Primitive
impl Primitive
pub fn size<C: HasDataLayout>(self, cx: &C) -> Size
pub fn align<C: HasDataLayout>(self, cx: &C) -> AbiAndPrefAlign
Trait Implementations§
source§impl<__CTX> HashStable<__CTX> for Primitivewhere
__CTX: HashStableContext,
impl<__CTX> HashStable<__CTX> for Primitivewhere __CTX: HashStableContext,
fn hash_stable(&self, __hcx: &mut __CTX, __hasher: &mut StableHasher)
source§impl PartialEq<Primitive> for Primitive
impl PartialEq<Primitive> for Primitive
impl Copy for Primitive
impl Eq for Primitive
impl StructuralEq for Primitive
impl StructuralPartialEq for Primitive
Auto Trait Implementations§
impl RefUnwindSafe for Primitive
impl Send for Primitive
impl Sync for Primitive
impl Unpin for Primitive
impl UnwindSafe for Primitive
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 8 bytes
Size for each variant:
Int
: 2 bytesF32
: 0 bytesF64
: 0 bytesPointer
: 7 bytes