[−][src]Struct dynasmrt::mmap::ExecutableBuffer
This module implements some wrappers around Mmap/MmapMut to also support a cheap "empty" variant.
Unfortunately Memmap itself doesn't support a cheap zero-length variant
A structure holding a buffer of executable memory. It also derefs to a &[u8]
.
This structure does not allocate when its size is 0.
Methods
impl ExecutableBuffer
[src]
pub fn ptr(&self, offset: AssemblyOffset) -> *const u8
[src]
Obtain a pointer into the executable memory from an offset into it.
When an offset returned from DynasmLabelApi::offset
is used, the resulting pointer
will point to the start of the first instruction after the offset call,
which can then be jumped or called to divert control flow into the executable
buffer. Note that if this buffer is accessed through an Executor, these pointers
will only be valid as long as its lock is held. When no locks are held,
The assembler is free to relocate the executable buffer when it requires
more memory than available.
pub fn new(size: usize) -> Result<ExecutableBuffer>
[src]
Create a new executable buffer, backed by a buffer of size size
.
It will start with an initialized length of 0.
pub fn size(&self) -> usize
[src]
Query the backing size of this executable buffer
pub fn make_mut(self) -> Result<MutableBuffer>
[src]
Change this executable buffer into a mutable buffer.
Trait Implementations
impl Default for ExecutableBuffer
[src]
fn default() -> ExecutableBuffer
[src]
impl Deref for ExecutableBuffer
[src]
impl Debug for ExecutableBuffer
[src]
Auto Trait Implementations
impl Sync for ExecutableBuffer
impl Send for ExecutableBuffer
impl Unpin for ExecutableBuffer
impl UnwindSafe for ExecutableBuffer
impl RefUnwindSafe for ExecutableBuffer
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,