pub struct PatchRegion { /* private fields */ }
Expand description
A region in the MachBuffer
code buffer that can be edited prior to finalization. An example
of where you might want to use this is for patching instructions that mention constants that
won’t be known until later: MachBuffer::start_patchable
can be used to begin the patchable
region, instructions can be emitted with placeholder constants, and the PatchRegion
token
can be produced by MachBuffer::end_patchable
. Once the values of those constants are known,
the PatchRegion::patch
function can be used to get a mutable buffer to the instruction
bytes, and the constants uses can be updated directly.
Implementations§
source§impl PatchRegion
impl PatchRegion
sourcepub fn patch<I: VCodeInst>(self, buffer: &mut MachBuffer<I>) -> &mut [u8] ⓘ
pub fn patch<I: VCodeInst>(self, buffer: &mut MachBuffer<I>) -> &mut [u8] ⓘ
Consume the patch region to yield a mutable slice of the MachBuffer
data buffer.
Auto Trait Implementations§
impl Freeze for PatchRegion
impl RefUnwindSafe for PatchRegion
impl Send for PatchRegion
impl Sync for PatchRegion
impl Unpin for PatchRegion
impl UnwindSafe for PatchRegion
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