Struct kalloc::buddy::Allocator[][src]

pub struct Allocator<P> { /* fields omitted */ }
Expand description

A thread-safe allocator with multiple buddy systems.

Implementations

impl<P: Unsigned + PowerOfTwo + 'static> Allocator<P>[src]

pub const fn new() -> Self[src]

Create a allocator with empty memory.

pub unsafe fn add_zone(&mut self, begin: usize, end: usize)[src]

Add free memory [begin, end) to this allocator.

Trait Implementations

impl<P: Unsigned + PowerOfTwo + 'static> GlobalAlloc for Allocator<P>[src]

unsafe fn alloc(&self, layout: Layout) -> *mut u8[src]

Allocate memory as described by the given layout. Read more

unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout)[src]

Deallocate the block of memory at the given ptr pointer with the given layout. Read more

unsafe fn alloc_zeroed(&self, layout: Layout) -> *mut u81.28.0[src]

Behaves like alloc, but also ensures that the contents are set to zero before being returned. Read more

unsafe fn realloc(
    &self,
    ptr: *mut u8,
    layout: Layout,
    new_size: usize
) -> *mut u8
1.28.0[src]

Shrink or grow a block of memory to the given new_size. The block is described by the given ptr pointer and layout. Read more

Auto Trait Implementations

impl<P> !RefUnwindSafe for Allocator<P>

impl<P> !Send for Allocator<P>

impl<P> !Sync for Allocator<P>

impl<P> Unpin for Allocator<P>

impl<P> UnwindSafe for Allocator<P>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.