[][src]Struct memory_manager::allocate::MemoryChunk

pub struct MemoryChunk { /* fields omitted */ }

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]

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]

fn as_mut(&mut self) -> &mut [T][src]

Converts to a mutable slice of some type T.

Panics

Panics if data is not properly aligned for T.

impl<T> AsRef<[T]> for MemoryChunk[src]

fn as_ref(&self) -> &[T][src]

Converts to a slice of some type T.

Panics

Panics if data is not properly aligned for T.

impl Debug for MemoryChunk[src]

impl Drop for MemoryChunk[src]

impl Eq for MemoryChunk[src]

impl PartialEq<MemoryChunk> for MemoryChunk[src]

impl StructuralEq for MemoryChunk[src]

impl StructuralPartialEq for MemoryChunk[src]

Auto Trait Implementations

impl !Send for MemoryChunk

impl !Sync for MemoryChunk

impl Unpin for MemoryChunk

Blanket Implementations

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

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

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

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

impl<T, U> Into<U> for T where
    U: From<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.