pub struct EncodingStream { /* private fields */ }Expand description
Encodes a sequence of RISC-V instructions, turning them into bytes.
§Example
To use this you’ll want to create a stream using EncodingStream::new(),
then push each instruction in sequence using push(). When you’re done, you
can get the encoded bytes using bytes().
use riscy_isa::{Instruction, Opcode, OpImmFunction, EncodingStream, Register};
let mut stream = EncodingStream::new();
stream.push(&Instruction::I {
opcode: Opcode::OpImm(OpImmFunction::ADDI),
rd: Register::A0,
rs1: Register::Zero,
imm: 0,
});
assert_eq!(stream.bytes(), &[19, 5, 0, 0]);Implementations§
Auto Trait Implementations§
impl Freeze for EncodingStream
impl RefUnwindSafe for EncodingStream
impl Send for EncodingStream
impl Sync for EncodingStream
impl Unpin for EncodingStream
impl UnsafeUnpin for EncodingStream
impl UnwindSafe for EncodingStream
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