[−][src]Struct memory_manager::allocate::MemoryChunk
Memory chunk.
Automatically deallocates the memory when dropped.
use memory_manager::allocate::{MemoryChunk, Protection}; use memory_manager::primitives::get_minimum_alignment; let a = get_minimum_alignment()?; let chunk = MemoryChunk::new(a, 4096, Protection::NONE)?; // memory is deallocated here
Implementations
impl MemoryChunk
[src]
pub fn new(
alignment: usize,
size: usize,
protection: BitFlags<Protection>
) -> Result<Self>
[src]
alignment: usize,
size: usize,
protection: BitFlags<Protection>
) -> Result<Self>
Allocate a memory chunk with the provided alignment
, size
, and protection
.
pub unsafe fn data(&self) -> Address
[src]
Pointer to the starting address of this chunk.
pub fn size(&self) -> usize
[src]
Length of this chunk.
Trait Implementations
impl<T> AsMut<[T]> for MemoryChunk
[src]
impl<T> AsRef<[T]> for MemoryChunk
[src]
impl Debug for MemoryChunk
[src]
impl Drop for MemoryChunk
[src]
impl Eq for MemoryChunk
[src]
impl PartialEq<MemoryChunk> for MemoryChunk
[src]
fn eq(&self, other: &MemoryChunk) -> bool
[src]
fn ne(&self, other: &MemoryChunk) -> bool
[src]
impl StructuralEq for MemoryChunk
[src]
impl StructuralPartialEq for MemoryChunk
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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>,