pub struct UnsafeBytecodeStream(/* private fields */);decode only.Expand description
An unsafe bytecode stream.
This is a wrapper over a raw pointer to bytecode somewhere in memory.
Implementations§
Source§impl UnsafeBytecodeStream
 
impl UnsafeBytecodeStream
Sourcepub unsafe fn new(pc: NonNull<u8>) -> Self
 
pub unsafe fn new(pc: NonNull<u8>) -> Self
Construct a new UnsafeBytecodeStream pointing at the given PC.
§Safety
The given pc must point to valid Pulley bytecode, and it is the
caller’s responsibility to ensure that the resulting
UnsafeBytecodeStream is only used to access the valid bytecode. For
example, if the current bytecode instruction unconditionally jumps to a
new PC, this stream must not be used to read just after the
unconditional jump instruction because there is no guarantee that that
memory is part of the bytecode stream or not.
Sourcepub unsafe fn offset(&self, offset: isize) -> Self
 
pub unsafe fn offset(&self, offset: isize) -> Self
Get a new UnsafeBytecodeStream pointing at the bytecode that is at the
given relative offset from this stream’s current position.
§Safety
Same as the new constructor. May only be used when it is guaranteed
that the address at self._as_ptr() + offset contains valid Pulley
bytecode.
Trait Implementations§
Source§impl BytecodeStream for UnsafeBytecodeStream
 
impl BytecodeStream for UnsafeBytecodeStream
Source§type Error = Uninhabited
 
type Error = Uninhabited
Source§fn read<const N: usize>(&mut self) -> Result<[u8; N], Self::Error>
 
fn read<const N: usize>(&mut self) -> Result<[u8; N], Self::Error>
N bytes from this bytecode stream, advancing the stream’s
position at the same time.Source§fn unexpected_eof(&self) -> Self::Error
 
fn unexpected_eof(&self) -> Self::Error
Source§fn invalid_opcode(&self, _code: u8) -> Self::Error
 
fn invalid_opcode(&self, _code: u8) -> Self::Error
Source§fn invalid_extended_opcode(&self, _code: u16) -> Self::Error
 
fn invalid_extended_opcode(&self, _code: u16) -> Self::Error
Source§fn invalid_reg(&self, _reg: u8) -> Self::Error
 
fn invalid_reg(&self, _reg: u8) -> Self::Error
Source§impl Clone for UnsafeBytecodeStream
 
impl Clone for UnsafeBytecodeStream
Source§fn clone(&self) -> UnsafeBytecodeStream
 
fn clone(&self) -> UnsafeBytecodeStream
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
 
fn clone_from(&mut self, source: &Self)
source. Read more