[−][src]Trait without_alloc::alloc::LocalAllocLeakExt
Leak allocations into uninit regions.
Provided methods
fn alloc_layout(
&'alloc self,
layout: NonZeroLayout
) -> Option<LeakedAllocation<'alloc>>
&'alloc self,
layout: NonZeroLayout
) -> Option<LeakedAllocation<'alloc>>
Leak an allocation with detailed layout.
Provides an Uninit wrapping several aspects of initialization in a safe interface,
bound by the lifetime of the reference to the allocator.
fn alloc_t<V>(&'alloc self) -> Option<LeakedAllocation<'alloc, V>>
Leak an allocation for a specific type.
It is not yet initialized but provides a safe interface for that initialization. Note that the type can be a ZST in which case a dangling pointer is substituted for the true allocation.
Usage
use core::cell::{Ref, RefCell}; let slab: Bump<[Ref<'static, usize>; 1]> = Bump::uninit(); let data = RefCell::new(0xff); // We can place a `Ref` here but we did not yet. let alloc = slab.alloc_t::<Ref<usize>>().unwrap(); let cell_ref = alloc.uninit.init(data.borrow()); assert_eq!(**cell_ref, 0xff);
fn boxed<V>(&'alloc self, val: V) -> Option<Box<'alloc, V>>
Allocate a Box.
This will allocate some memory with the correct layout for a Box, then place the
provided value into the allocation by constructing an Box.
fn fixed_vec<V>(&'alloc self, capacity: usize) -> Option<FixedVec<'alloc, V>>
Allocate a FixedVec.
This will allocate some memory with the correct layout for a FixedVec of the given
capacity (in elements) and wrap it. Returns None if it is not possible to allocate the
layout.
fn rc<V>(&'alloc self, val: V) -> Option<Rc<'alloc, V>>
Implementors
impl<'alloc, T> LocalAllocLeakExt<'alloc> for T where
T: LocalAlloc<'alloc>, [src]
T: LocalAlloc<'alloc>,