Struct proc_macro::bridge::arena::Arena
source · pub(crate) struct Arena {
start: Cell<*mut MaybeUninit<u8>>,
end: Cell<*mut MaybeUninit<u8>>,
chunks: RefCell<Vec<Box<[MaybeUninit<u8>]>>>,
}🔬This is a nightly-only experimental API. (
proc_macro_internals #27812)Expand description
A minimal arena allocator inspired by rustc_arena::DroplessArena.
This is unfortunately a complete re-implementation rather than a dependency
as it is difficult to depend on crates from within proc_macro, due to it
being built at the same time as std.
This arena doesn’t have support for allocating anything other than byte slices, as that is all that is necessary.
Fields§
§start: Cell<*mut MaybeUninit<u8>>🔬This is a nightly-only experimental API. (
§proc_macro_internals #27812)end: Cell<*mut MaybeUninit<u8>>🔬This is a nightly-only experimental API. (
§proc_macro_internals #27812)chunks: RefCell<Vec<Box<[MaybeUninit<u8>]>>>🔬This is a nightly-only experimental API. (
proc_macro_internals #27812)Implementations§
source§impl Arena
impl Arena
pub(crate) fn new() -> Self
🔬This is a nightly-only experimental API. (
proc_macro_internals #27812)sourcefn grow(&self, additional: usize)
🔬This is a nightly-only experimental API. (proc_macro_internals #27812)
fn grow(&self, additional: usize)
proc_macro_internals #27812)Add a new chunk with at least additional free bytes.
sourcefn alloc_raw_without_grow(&self, bytes: usize) -> Option<&mut [MaybeUninit<u8>]>
🔬This is a nightly-only experimental API. (proc_macro_internals #27812)
fn alloc_raw_without_grow(&self, bytes: usize) -> Option<&mut [MaybeUninit<u8>]>
proc_macro_internals #27812)Allocates a byte slice with specified size from the current memory
chunk. Returns None if there is no free space left to satisfy the
request.
fn alloc_raw(&self, bytes: usize) -> &mut [MaybeUninit<u8>]
🔬This is a nightly-only experimental API. (
proc_macro_internals #27812)pub(crate) fn alloc_str<'a>(&'a self, string: &str) -> &'a mut str
🔬This is a nightly-only experimental API. (
proc_macro_internals #27812)Auto Trait Implementations§
impl !RefUnwindSafe for Arena
impl !Send for Arena
impl !Sync for Arena
impl Unpin for Arena
impl UnwindSafe for Arena
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more