Skip to main content

StaticSlabPool

Struct StaticSlabPool 

Source
pub struct StaticSlabPool<const PAGE_SIZE: usize = 4096, const N: usize = 1> { /* private fields */ }
Expand description

Default static slab-pool wrapper used by EII integrators.

Implementations§

Source§

impl<const PAGE_SIZE: usize, const N: usize> StaticSlabPool<PAGE_SIZE, N>

Source

pub const fn new( slabs: [PerCpuSlab<PAGE_SIZE>; N], current_cpu_id: fn() -> usize, ) -> Self

Create a static slab pool from pre-built per-CPU slabs and a CPU-id hook.

Trait Implementations§

Source§

impl<const PAGE_SIZE: usize, const N: usize> SlabPoolTrait for StaticSlabPool<PAGE_SIZE, N>

Source§

fn current_slab(&self) -> &dyn SlabTrait

Return the slab belonging to the current CPU.
Source§

fn owner_slab(&self, cpu_idx: usize) -> &dyn SlabTrait

Return the owner slab for the given CPU.
Source§

fn current_cpu_id(&self) -> usize

Logical CPU id of the current CPU.
Source§

fn alloc(&self, layout: Layout) -> AllocResult<SlabAllocResult>

Allocate one object from the current CPU’s slab.
Source§

fn add_slab(&self, size_class: SizeClass, base: usize, bytes: usize)

Register a freshly allocated slab page in the current CPU’s slab.
Source§

fn dealloc( &self, ptr: NonNull<u8>, layout: Layout, owner_cpu: usize, ) -> SlabPoolDeallocResult

Free an object, routing to local or remote slab ownership as needed.

Auto Trait Implementations§

§

impl<const PAGE_SIZE: usize = 4096, const N: usize = 1> !Freeze for StaticSlabPool<PAGE_SIZE, N>

§

impl<const PAGE_SIZE: usize = 4096, const N: usize = 1> !RefUnwindSafe for StaticSlabPool<PAGE_SIZE, N>

§

impl<const PAGE_SIZE: usize, const N: usize> Send for StaticSlabPool<PAGE_SIZE, N>

§

impl<const PAGE_SIZE: usize, const N: usize> Sync for StaticSlabPool<PAGE_SIZE, N>

§

impl<const PAGE_SIZE: usize, const N: usize> Unpin for StaticSlabPool<PAGE_SIZE, N>

§

impl<const PAGE_SIZE: usize, const N: usize> UnsafeUnpin for StaticSlabPool<PAGE_SIZE, N>

§

impl<const PAGE_SIZE: usize, const N: usize> UnwindSafe for StaticSlabPool<PAGE_SIZE, N>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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> SlabPoolExt for T
where T: SlabPoolTrait + ?Sized,

Source§

fn with_current_slab<R>(&self, f: impl FnOnce(&dyn SlabTrait) -> R) -> R

Access the current CPU’s slab via a callback.
Source§

fn with_owner_slab<R>( &self, cpu_idx: usize, f: impl FnOnce(&dyn SlabTrait) -> R, ) -> R

Access the given owner’s slab via a callback.
Source§

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

Source§

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 T
where U: TryFrom<T>,

Source§

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.