pub trait ReadableProcessBuffer {
    // Required methods
    fn len(&self) -> usize;
    fn ptr(&self) -> *const u8;
    fn enter<F, R>(&self, fun: F) -> Result<R, Error>
       where F: FnOnce(&ReadableProcessSlice) -> R;
}
Expand description

A readable region of userspace process memory.

This trait can be used to gain read-only access to memory regions wrapped in either a ReadOnlyProcessBuffer or a ReadWriteProcessBuffer type.

Required Methods§

source

fn len(&self) -> usize

Length of the memory region.

If the process is no longer alive and the memory has been reclaimed, this method must return 0.

Default Process Buffer

A default instance of a process buffer must return 0.

source

fn ptr(&self) -> *const u8

Pointer to the first byte of the userspace memory region.

If the length of the initially shared memory region (irrespective of the return value of len) is 0, this function returns a pointer to address 0x0. This is because processes may allow buffers with length 0 to share no memory with the kernel. Because these buffers have zero length, they may have any pointer value. However, these dummy addresses should not be leaked, so this method returns 0 for zero-length slices.

Default Process Buffer

A default instance of a process buffer must return a pointer to address 0x0.

source

fn enter<F, R>(&self, fun: F) -> Result<R, Error>
where F: FnOnce(&ReadableProcessSlice) -> R,

Applies a function to the (read only) process slice reference pointed to by the process buffer.

If the process is no longer alive and the memory has been reclaimed, this method must return Err(process::Error::NoSuchApp).

Default Process Buffer

A default instance of a process buffer must return Err(process::Error::NoSuchApp) without executing the passed closure.

Object Safety§

This trait is not object safe.

Implementors§