[][src]Struct buddy_allocator::BuddyAllocator

pub struct BuddyAllocator<AR: AllocRef> { /* fields omitted */ }

Methods

impl<AR: AllocRef> BuddyAllocator<AR>[src]

pub fn try_new(
    max_order: usize,
    multiplier: usize,
    max_idx: Option<usize>,
    allocator: AR
) -> Result<Self, AllocErr>
[src]

try to create a new buddy allocator

see Buddies::new

use alloc_wg::alloc::Global;
use alloc_wg::boxed::Box;
use buddy_allocator::BuddyAllocator;

let allocator = BuddyAllocator::try_new(5, 16, None, Global).unwrap();
let boxed = Box::new_in(123, &allocator);

pub fn try_with_capacity(
    capacity: usize,
    multiplier: usize,
    allocator: AR
) -> Result<Self, AllocErr>
[src]

try to create a new buddy allocator

see Buddies::with_capacity

use alloc_wg::alloc::Global;
use alloc_wg::boxed::Box;
use buddy_allocator::BuddyAllocator;

let allocator = BuddyAllocator::try_with_capacity(320, 16, Global).unwrap();
let boxed = Box::new_in(16, &allocator);

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

get the base ptr

use alloc_wg::alloc::Global;
use buddy_allocator::BuddyAllocator;

let allocator = BuddyAllocator::try_new(5, 16, None, Global).unwrap();
allocator.base_ptr();

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

get the capacitiy

use alloc_wg::alloc::Global;
use buddy_allocator::BuddyAllocator;

let allocator = BuddyAllocator::try_new(5, 16, None, Global).unwrap();
assert_eq!(allocator.capacitiy(), 256);

Trait Implementations

impl<'_, AR: AllocRef> AllocRef for &'_ BuddyAllocator<AR>[src]

impl<AR: AllocRef> Drop for BuddyAllocator<AR>[src]

Auto Trait Implementations

impl<AR> RefUnwindSafe for BuddyAllocator<AR> where
    AR: RefUnwindSafe

impl<AR> Send for BuddyAllocator<AR> where
    AR: Send

impl<AR> Sync for BuddyAllocator<AR> where
    AR: Sync

impl<AR> Unpin for BuddyAllocator<AR> where
    AR: Unpin

impl<AR> UnwindSafe for BuddyAllocator<AR> 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.