[−][src]Struct memory_manager::block::BlockDescriptor
Memory block: collection of objects.
Block Layout
┏━━━━━━━━━━┯━━━━━━━━━━┯━━━━━┯━━━━━━━━━━┯━━━━━━━━━━━━━━┓
┃ reserved │ object 0 │ ... │ object N │ not used yet ┃
┗━━━━━━━━━━┷━━━━━━━━━━┷━━━━━┷━━━━━━━━━━┷━━━━━━━━━━━━━━┛
↑ ↑
│ │
start free
- Reserved space: we may reserved some space to avoid
malloc
, etc. - object 1 ~ N: objects managed by this
memory-manager
. - not used yet: for future allocation, or wasted due to fragmentation.
Fields
start: *mut u8
The starting address for this block.
Invariant: unless start == free
, at start
there is a valid ObjectDescriptor
.
free: *mut u8
The first free address in this block.
Invariant: no pointers in the same block is after free
.
Implementations
impl<'a> BlockDescriptor<'a>
[src]
pub const SIZE: usize
[src]
Size of a Block
.
pub const SIZE_IN_WORDS: usize
[src]
Size of a Block
in Word
s (usize
s).
pub fn new(start: *mut u8) -> Self
[src]
Constructor for BlockDescriptor
.
pub fn objects(&self) -> ObjectIterator<'a>
[src]
Iterate on the objects in this block.
Trait Implementations
impl<'a> Clone for BlockDescriptor<'a>
[src]
fn clone(&self) -> BlockDescriptor<'a>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<'a> Copy for BlockDescriptor<'a>
[src]
Auto Trait Implementations
impl<'a> !Send for BlockDescriptor<'a>
impl<'a> !Sync for BlockDescriptor<'a>
impl<'a> Unpin for BlockDescriptor<'a>
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>,