Allocators.
trait Allocator : Leak {
type Pool;
/* Required methods */
unsafe fn allocate_raw(pool: &mut <Self as Allocator>::Pool, size: usize, alignment: usize) -> Result<*mut u8, Errno>
unsafe fn free_raw(pool: &mut <Self as Allocator>::Pool, ptr: *mut u8, size: usize, alignment: usize) -> ()
unsafe fn reallocate_raw(pool: &mut <Self as Allocator>::Pool, ptr: *mut u8, oldsize: usize, newsize: usize, alignment: usize) -> Result<*mut u8, Errno>
/* Provided methods */
unsafe fn allocate<T>(pool: &mut <Self as Allocator>::Pool) -> Result<*mut T, Errno>
unsafe fn allocate_array<T>(pool: &mut <Self as Allocator>::Pool, num: usize) -> Result<*mut T, Errno>
unsafe fn free<T>(pool: &mut <Self as Allocator>::Pool, ptr: *mut T) -> ()
unsafe fn free_array<T>(pool: &mut <Self as Allocator>::Pool, ptr: *mut T, num: usize) -> ()
unsafe fn reallocate_array<T>(pool: &mut <Self as Allocator>::Pool, ptr: *mut T, oldnum: usize, newnum: usize) -> Result<*mut T, Errno>
}| Name | Description |
|---|---|
| Pool | The memory pool used by this type. |
| Receiver | Name | Description |
|---|---|---|
| allocate | Allocates an object of the specified type. |
| allocate_array | Allocates an array of the specified type. |
| allocate_raw | Allocates a chunk of bytes with the specified properties. |
| free | Frees an object. |
| free_array | Frees an array. |
| free_raw | Deallocates a chunk of bytes with the specified properties. |
| reallocate_array | Reallocates an array. |
| reallocate_raw | Reallocates a chunk of bytes. |
This needs better documentation.