pub struct MemoryArea {
pub start: usize,
pub end: usize,
}
Fields§
§start: usize
§end: usize
Implementations§
Source§impl MemoryArea
impl MemoryArea
Sourcepub fn new(start: usize, end: usize) -> Self
pub fn new(start: usize, end: usize) -> Self
Creates a new memory area with the given start and end addresses
Sourcepub fn from_ptr(ptr: *const u8, size: usize) -> Self
pub fn from_ptr(ptr: *const u8, size: usize) -> Self
Creates a new memory area from a pointer and size
Sourcepub unsafe fn as_slice(&self) -> &[u8]
pub unsafe fn as_slice(&self) -> &[u8]
Returns a slice reference to the memory area
§Safety
This function assumes that the start and end of MemoryArea point to valid memory ranges. If not, undefined behavior may occur. Therefore, make sure that MemoryArea points to a valid range before using this function.
§Returns
A slice reference to the memory area
Sourcepub unsafe fn as_slice_mut(&self) -> &mut [u8]
pub unsafe fn as_slice_mut(&self) -> &mut [u8]
Returns a mutable slice reference to the memory area
§Safety
This function assumes that the start and end of MemoryArea point to valid memory ranges. If not, undefined behavior may occur. Therefore, make sure that MemoryArea points to a valid range before using this function.
§Returns
A mutable slice reference to the memory area
Trait Implementations§
Source§impl Clone for MemoryArea
impl Clone for MemoryArea
Source§fn clone(&self) -> MemoryArea
fn clone(&self) -> MemoryArea
Returns a copy of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for MemoryArea
impl Debug for MemoryArea
Source§impl PartialEq for MemoryArea
impl PartialEq for MemoryArea
impl Copy for MemoryArea
impl StructuralPartialEq for MemoryArea
Auto Trait Implementations§
impl Freeze for MemoryArea
impl RefUnwindSafe for MemoryArea
impl Send for MemoryArea
impl Sync for MemoryArea
impl Unpin for MemoryArea
impl UnwindSafe for MemoryArea
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)