pub struct ReadableProcessSlice { /* private fields */ }
Expand description

Readable and accessible slice of memory of a process buffer.

The only way to obtain this struct is through a ReadWriteProcessBuffer or ReadOnlyProcessBuffer.

Slices provide a more convenient, traditional interface to process memory. These slices are transient, as the underlying buffer must be checked each time a slice is created. This is usually enforced by the anonymous lifetime defined by the creation of the slice.

Implementations§

source§

impl ReadableProcessSlice

source

pub fn copy_to_slice(&self, dest: &mut [u8])

Copy the contents of a ReadableProcessSlice into a mutable slice reference.

The length of self must be the same as dest. Subslicing can be used to obtain a slice of matching length.

Panics

This function will panic if self.len() != dest.len().

source

pub fn copy_to_slice_or_err(&self, dest: &mut [u8]) -> Result<(), ErrorCode>

Copy the contents of a ReadableProcessSlice into a mutable slice reference.

The length of self must be the same as dest. Subslicing can be used to obtain a slice of matching length.

source

pub fn len(&self) -> usize

Return the length of the slice in bytes.

source

pub fn iter(&self) -> Iter<'_, ReadableProcessByte>

Return an iterator over the bytes of the slice.

source

pub fn chunks( &self, chunk_size: usize ) -> impl Iterator<Item = &ReadableProcessSlice>

Iterate the slice in chunks.

source

pub fn get(&self, range: Range<usize>) -> Option<&ReadableProcessSlice>

Access a portion of the slice with bounds checking. If the access is not within the slice then None is returned.

source

pub fn get_from(&self, range: RangeFrom<usize>) -> Option<&ReadableProcessSlice>

Access a portion of the slice with bounds checking. If the access is not within the slice then None is returned.

source

pub fn get_to(&self, range: RangeTo<usize>) -> Option<&ReadableProcessSlice>

Access a portion of the slice with bounds checking. If the access is not within the slice then None is returned.

Trait Implementations§

source§

impl<'a> From<&'a [u8]> for &'a ReadableProcessSlice

source§

fn from(val: &'a [u8]) -> Self

Converts to this type from the input type.
source§

impl<'a> From<&'a mut [u8]> for &'a ReadableProcessSlice

source§

fn from(val: &'a mut [u8]) -> Self

Converts to this type from the input type.
source§

impl Index<Range<usize>> for ReadableProcessSlice

§

type Output = ReadableProcessSlice

The returned type after indexing.
source§

fn index(&self, idx: Range<usize>) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl Index<RangeFrom<usize>> for ReadableProcessSlice

§

type Output = ReadableProcessSlice

The returned type after indexing.
source§

fn index(&self, idx: RangeFrom<usize>) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl Index<RangeTo<usize>> for ReadableProcessSlice

§

type Output = ReadableProcessSlice

The returned type after indexing.
source§

fn index(&self, idx: RangeTo<usize>) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl Index<usize> for ReadableProcessSlice

§

type Output = ReadableProcessByte

The returned type after indexing.
source§

fn index(&self, idx: usize) -> &Self::Output

Performs the indexing (container[index]) operation. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more