[−][src]Struct buddy_allocator::BuddyAllocator
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]
max_order: usize,
multiplier: usize,
max_idx: Option<usize>,
allocator: AR
) -> Result<Self, AllocErr>
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 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]
fn alloc(self, layout: Layout, init: AllocInit) -> Result<MemoryBlock, AllocErr>
[src]
unsafe fn dealloc(self, memory: MemoryBlock)
[src]
unsafe fn grow(
self,
memory: &mut MemoryBlock,
new_size: usize,
placement: ReallocPlacement,
init: AllocInit
) -> Result<(), AllocErr>
[src]
self,
memory: &mut MemoryBlock,
new_size: usize,
placement: ReallocPlacement,
init: AllocInit
) -> Result<(), AllocErr>
unsafe fn shrink(
self,
memory: &mut MemoryBlock,
new_size: usize,
_placement: ReallocPlacement
) -> Result<(), AllocErr>
[src]
self,
memory: &mut MemoryBlock,
new_size: usize,
_placement: ReallocPlacement
) -> Result<(), AllocErr>
impl<AR: AllocRef> Drop for BuddyAllocator<AR>
[src]
Auto Trait Implementations
impl<AR> RefUnwindSafe for BuddyAllocator<AR> where
AR: RefUnwindSafe,
AR: RefUnwindSafe,
impl<AR> Send for BuddyAllocator<AR> where
AR: Send,
AR: Send,
impl<AR> Sync for BuddyAllocator<AR> where
AR: Sync,
AR: Sync,
impl<AR> Unpin for BuddyAllocator<AR> where
AR: Unpin,
AR: Unpin,
impl<AR> UnwindSafe for BuddyAllocator<AR> where
AR: UnwindSafe,
AR: UnwindSafe,
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>,