Struct kernel::common::memory::Memory [] [src]

pub struct Memory<T> {
    pub ptr: *mut T,
}
[]

A wrapper around raw pointers

Fields

ptr

Methods

impl<T> Memory<T>

fn new(count: usize) -> Option<Self>[]

Create an empty

fn new_align(count: usize, align: usize) -> Option<Self>

fn renew(&mut self, count: usize) -> bool[]

Renew the memory

fn size(&self) -> usize[]

Get the size in bytes

fn length(&self) -> usize[]

Get the length in T elements

unsafe fn address(&self) -> usize[]

Get the address

unsafe fn read(&self, i: usize) -> T[]

Read the memory

unsafe fn load(&self, i: usize) -> T[]

Load the memory

unsafe fn write(&mut self, i: usize, value: T)[]

Overwrite the memory

unsafe fn store(&mut self, i: usize, value: T)[]

Store the memory

unsafe fn into_raw(&mut self) -> *mut T[]

Convert into a raw pointer

Trait Implementations

impl<T> Drop for Memory<T>

fn drop(&mut self)

impl<T> Index<usize> for Memory<T>

type Output = T

fn index<'a>(&'a self, _index: usize) -> &'a T

impl<T> IndexMut<usize> for Memory<T>

fn index_mut<'a>(&'a mut self, _index: usize) -> &'a mut T