pub struct Fixed<R, const E: u8>(pub R);
Expand description
A fixed register.
Some operands are implicit to the instruction and thus use a fixed register
for execution. Because this assembler is generic over any register type
(R
), this wrapper provides a way to record the fixed register encoding we
expect to use (E
).
let fixed = Fixed::<u8, { gpr::enc::RAX }>(valid_reg);
assert_eq!(fixed.enc(), gpr::enc::RAX);
ⓘ
let fixed = Fixed::<u8, { gpr::enc::RAX }>(invalid_reg);
fixed.enc(); // Will panic because `invalid_reg` does not match `RAX`.
Tuple Fields§
§0: R
Implementations§
Trait Implementations§
Source§impl<R: AsReg, const E: u8> Arbitrary<'_> for Fixed<R, E>
impl<R: AsReg, const E: u8> Arbitrary<'_> for Fixed<R, E>
Source§fn arbitrary(_: &mut Unstructured<'_>) -> Result<Self>
fn arbitrary(_: &mut Unstructured<'_>) -> Result<Self>
Generate an arbitrary value of
Self
from the given unstructured data. Read more§fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
Generate an arbitrary value of
Self
from the entirety of the given
unstructured data. Read moreAuto Trait Implementations§
impl<R, const E: u8> Freeze for Fixed<R, E>where
R: Freeze,
impl<R, const E: u8> RefUnwindSafe for Fixed<R, E>where
R: RefUnwindSafe,
impl<R, const E: u8> Send for Fixed<R, E>where
R: Send,
impl<R, const E: u8> Sync for Fixed<R, E>where
R: Sync,
impl<R, const E: u8> Unpin for Fixed<R, E>where
R: Unpin,
impl<R, const E: u8> UnwindSafe for Fixed<R, E>where
R: UnwindSafe,
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