pub struct IntPair(/* private fields */);Expand description
The modifier byte of the bit-level conversions
(Zext, Sext,
Trunc), which never raise an error and so carry
no policy.
Layout: bits 0–2 source IntTy, bits 3–5 destination IntTy, bits
6–7 zero.
§Examples
use bytecode_lang::{IntPair, IntTy};
let p = IntPair::new(IntTy::I8, IntTy::I64);
assert_eq!((p.from(), p.to()), (IntTy::I8, IntTy::I64));
assert_eq!(p.to_string(), "i8.i64");
assert_eq!(IntPair::from_bits(0b0100_0000), None);Implementations§
Source§impl IntPair
impl IntPair
Sourcepub const fn new(from: IntTy, to: IntTy) -> Self
pub const fn new(from: IntTy, to: IntTy) -> Self
The pair from → to.
§Examples
use bytecode_lang::{IntPair, IntTy};
assert_eq!(IntPair::new(IntTy::U8, IntTy::U32).to(), IntTy::U32);Sourcepub const fn from(self) -> IntTy
pub const fn from(self) -> IntTy
The source type.
§Examples
use bytecode_lang::{IntPair, IntTy};
assert_eq!(IntPair::new(IntTy::U8, IntTy::U32).from(), IntTy::U8);Sourcepub const fn to(self) -> IntTy
pub const fn to(self) -> IntTy
The destination type.
§Examples
use bytecode_lang::{IntPair, IntTy};
assert_eq!(IntPair::new(IntTy::I64, IntTy::I16).to(), IntTy::I16);Trait Implementations§
impl Copy for IntPair
impl Eq for IntPair
Source§impl Ord for IntPair
impl Ord for IntPair
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for IntPair
impl PartialOrd for IntPair
impl StructuralPartialEq for IntPair
Auto Trait Implementations§
impl Freeze for IntPair
impl RefUnwindSafe for IntPair
impl Send for IntPair
impl Sync for IntPair
impl Unpin for IntPair
impl UnsafeUnpin for IntPair
impl UnwindSafe for IntPair
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