#[repr(C)]
pub struct ObjectPage8k { /* private fields */ }
Expand description

Holds allocated data within 2 4-KiB pages.

Has a data-section where objects are allocated from and a small amount of meta-data in the form of a bitmap to track allocations at the end of the page.

Notes

An object of this type will be exactly 8 KiB. It is marked repr(C) because we rely on a well defined order of struct members (e.g., dealloc does a cast to find the bitfield).

Trait Implementations§

source§

impl AllocablePage for ObjectPage8k

source§

fn clear_metadata(&mut self)

clears the metadata section of the page

source§

fn first_fit(&self, layout: Layout) -> Option<(usize, usize)>

Tries to find a free block within data that satisfies alignment requirement.

source§

fn allocate(&mut self, layout: Layout) -> *mut u8

Tries to allocate an object within this page.

In case the slab is full, returns a null ptr.

source§

fn is_full(&self) -> bool

Checks if we can still allocate more objects of a given layout within the page.

source§

fn is_empty(&self, relevant_bits: usize) -> bool

Checks if the page has currently no allocations.

source§

fn deallocate( &self, ptr: NonNull<u8>, layout: Layout ) -> Result<(), &'static str>

Deallocates a memory object within this page.

source§

const SIZE: usize = 8_192usize

The total size (in bytes) of the page. Read more
source§

const METADATA_SIZE: usize = 80usize

source§

const HEAP_ID_OFFSET: usize = 8_112usize

source§

fn bitfield(&self) -> &[AtomicU64; 8]

source§

fn bitfield_mut(&mut self) -> &mut [AtomicU64; 8]

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.