[−][src]Struct buddy_allocator::BuddyAllocator
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]
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, 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,
AR: RefUnwindSafe,
impl<const BLOCK_SIZE: usize, const ORDER: usize, AR> Send for BuddyAllocator<AR, BLOCK_SIZE, ORDER> where
AR: Send,
AR: Send,
impl<const BLOCK_SIZE: usize, const ORDER: usize, AR> Sync for BuddyAllocator<AR, BLOCK_SIZE, ORDER> where
AR: Sync,
AR: Sync,
impl<const BLOCK_SIZE: usize, const ORDER: usize, AR> Unpin for BuddyAllocator<AR, BLOCK_SIZE, ORDER> where
AR: Unpin,
AR: Unpin,
impl<const BLOCK_SIZE: usize, const ORDER: usize, AR> UnwindSafe for BuddyAllocator<AR, BLOCK_SIZE, ORDER> 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>,