pub enum Type<'a> {
Word,
Long,
Single,
Double,
Zero,
Byte,
SignedByte,
UnsignedByte,
Halfword,
SignedHalfword,
UnsignedHalfword,
Aggregate(&'a TypeDef<'a>),
}Expand description
QBE types used to specify the size and representation of values.
QBE has a minimal type system with base types and extended types. Base types are used for temporaries, while extended types can be used in aggregate types and data definitions.
§Examples
use qbe::Type;
// Base types
let word = Type::Word; // 32-bit integer
let long = Type::Long; // 64-bit integer
let single = Type::Single; // 32-bit float
let double = Type::Double; // 64-bit float
// Extended types
let byte = Type::Byte; // 8-bit value
let halfword = Type::Halfword; // 16-bit value
// Get type sizes in bytes
assert_eq!(word.size(), 4);
assert_eq!(byte.size(), 1);§Type Conversions
use qbe::Type;
// Convert extended type to corresponding base type
let base = Type::Byte.into_base();
assert_eq!(base, Type::Word);
// Convert to ABI-compatible type for function parameters
let abi = Type::SignedByte.into_abi();
assert_eq!(abi, Type::Word);Variants§
Word
Long
Single
Double
Zero
Byte
SignedByte
UnsignedByte
Halfword
SignedHalfword
UnsignedHalfword
Aggregate(&'a TypeDef<'a>)
Aggregate type with a specified name
Implementations§
Trait Implementations§
Source§impl<'a> Ord for Type<'a>
impl<'a> Ord for Type<'a>
Source§impl<'a> PartialOrd for Type<'a>
impl<'a> PartialOrd for Type<'a>
impl<'a> Eq for Type<'a>
impl<'a> StructuralPartialEq for Type<'a>
Auto Trait Implementations§
impl<'a> Freeze for Type<'a>
impl<'a> RefUnwindSafe for Type<'a>
impl<'a> Send for Type<'a>
impl<'a> Sync for Type<'a>
impl<'a> Unpin for Type<'a>
impl<'a> UnwindSafe for Type<'a>
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