Library guide · API index and notation
This page is generated from the bundled library in this checkout. Signatures and adjacent source comments are reproduced below; the linked guide explains usage, storage, failures, and platform support.
import "alloc/shared_arena"
Names used in signatures
Unqualified names denote this package’s types (including other source files in the same package), language built-ins, or generic parameters such as T. Qualified names use the import aliases below. These aliases belong to the library source; import a dependency yourself to use its alias in your program.
| Alias | Package | Source file |
|---|---|---|
block |
alloc/block |
shared_arena.dodo |
error |
alloc/error |
shared_arena.dodo |
layout |
alloc/layout |
shared_arena.dodo |
mem |
core/mem |
shared_arena.dodo |
ptr |
core/ptr |
shared_arena.dodo |
SharedArena
Struct · Source
Single-threaded caller-backed allocator. The cursor lives in an aligned, reserved part of backing memory, never in storage exposed by a checked view. Shared handles keep the arena AND its complete backing dependency alive. This is not a synchronization primitive; OS/thread adapters must not share it concurrently. No callback occurs while allocator metadata is being changed.
pub struct SharedArena {
// Private implementation fields omitted.
}
SharedArena.new
Function · Source
pub fn new(backing: &mut[u8]) -> SharedArena!error.AllocError from(backing)
SharedArena.handle
Function · Source
pub fn handle(&self) -> Handle from(self)
SharedArena.capacity
Function · Source
pub fn capacity(&self) -> usize
SharedArena.used
Function · Source
pub fn used(&self) -> usize
SharedArena.remaining
Function · Source
pub fn remaining(&self) -> usize
SharedArena.reset
Function · Source
Exclusive self prevents any live checked handle or container from using reset. Raw Blocks/pointers still require the ordinary unsafe obligation.
pub unsafe fn reset(&mut self)
Requires an unsafe context. Follow the source safety preconditions and the linked guide before calling this API.
Handle
Struct · Source
pub struct Handle {
// Private implementation fields omitted.
}
Handle.clone
Function · Source
pub fn clone(&self) -> Handle from(self)
Handle.allocate
Function · Source
pub fn allocate(&self, requested: &layout.Layout) -> block.Block!error.AllocError
Handle.deallocate
Function · Source
SAFETY: block is a currently live descriptor from this arena, released at most once; its initialized values have been destroyed and views ended. Individual frees do not reclaim bump storage. Reset reclaims all storage.
pub unsafe fn deallocate(&self, allocated: block.Block)
Requires an unsafe context. Follow the source safety preconditions and the linked guide before calling this API.