[][src]Struct dynasmrt::mmap::ExecutableBuffer

pub struct ExecutableBuffer { /* fields omitted */ }

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]

impl Deref for ExecutableBuffer[src]

type Target = [u8]

The resulting type after dereferencing.

impl Debug for ExecutableBuffer[src]

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]