[][src]Struct buddy_allocator::BuddyAllocator

pub struct BuddyAllocator<AR: AllocRef, const BLOCK_SIZE: usize, const ORDER: usize> { /* fields omitted */ }

Methods

impl<AR: AllocRef, const BLOCK_SIZE: usize, const ORDER: usize> BuddyAllocator<AR, BLOCK_SIZE, ORDER>[src]

pub fn try_new(allocator: AR) -> Result<Self, AllocErr>[src]

try to create a new buddy allocator

use alloc_wg::alloc::System;
use buddy_allocator::BuddyAllocator;
let allocator: BuddyAllocator<_, 16usize, 5usize> = BuddyAllocator::try_new(System).unwrap();

pub unsafe fn is_unused(&self) -> bool[src]

check if the allocator is unused

Safety

calling this method is equivalent to trying to allocate the entire memory inside thus rendering the allocator useless after it returned true

pub fn base_address(&self) -> NonNull<u8>[src]

get the base address

pub fn capacitiy(&self) -> usize[src]

get the capacitiy

Trait Implementations

impl<'_, AR: AllocRef, const BLOCK_SIZE: usize, const ORDER: usize> AllocRef for &'_ BuddyAllocator<AR, BLOCK_SIZE, ORDER>[src]

impl<AR: AllocRef, const BLOCK_SIZE: usize, const ORDER: usize> Drop for BuddyAllocator<AR, BLOCK_SIZE, ORDER>[src]

Auto Trait Implementations

impl<const BLOCK_SIZE: usize, const ORDER: usize, AR> RefUnwindSafe for BuddyAllocator<AR, BLOCK_SIZE, ORDER> where
    AR: RefUnwindSafe

impl<const BLOCK_SIZE: usize, const ORDER: usize, AR> Send for BuddyAllocator<AR, BLOCK_SIZE, ORDER> where
    AR: Send

impl<const BLOCK_SIZE: usize, const ORDER: usize, AR> Sync for BuddyAllocator<AR, BLOCK_SIZE, ORDER> where
    AR: Sync

impl<const BLOCK_SIZE: usize, const ORDER: usize, AR> Unpin for BuddyAllocator<AR, BLOCK_SIZE, ORDER> where
    AR: Unpin

impl<const BLOCK_SIZE: usize, const ORDER: usize, AR> UnwindSafe for BuddyAllocator<AR, BLOCK_SIZE, ORDER> where
    AR: UnwindSafe

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.