[−][src]Trait xalloc::arena::UnsafeArena
Homogeneous memory arena types supporting operations that do not guarantee memory safety.
Methods prefixed with _unchecked
all assume given pointers are valid;
specifically, they assumes that:
- The pointers were constructed by the same instance of
UnsafeArena
. - The pointers have not been removed from the arena yet.
Associated Types
type Ptr: Debug + Clone + Default + PartialEq + Eq
[src]
Pointer type.
Ptr::clone(p)
returns a pointer that points the same object.Ptr::default()
returns an uninitialized pointer with a well-defined value (e.g., null pointer).Ptr::eq(x, y)
checks the equality of two pointers. Both pointers must originate from the same arena. Otherwise, the returned value does not make sense.
Required methods
pub fn insert(&mut self, x: T) -> Self::Ptr
[src]
Insert a value into the arena.
Returns a pointer that points the inserted value.
pub unsafe fn get_unchecked(&self, ptr: &Self::Ptr) -> &T
[src]
Get a reference to a contained value, without a pointer validity check.
pub unsafe fn get_unchecked_mut(&mut self, ptr: &Self::Ptr) -> &mut T
[src]
Get a mutable reference to a contained value, without a pointer validity check.
pub unsafe fn remove_unchecked(&mut self, ptr: &Self::Ptr) -> T
[src]
Remove a value from the arena, without a pointer validity check.
Returns the removed value.
Provided methods
pub fn reserve(&mut self, _additional: usize)
[src]
Reserves capacity for at least additional
values to be inserted in the arena.
Implementors
impl<T> UnsafeArena<T> for CheckedArena<T>
[src]
type Ptr = Ptr
pub fn insert(&mut self, x: T) -> Self::Ptr
[src]
pub unsafe fn get_unchecked(&self, ptr: &Self::Ptr) -> &T
[src]
pub unsafe fn get_unchecked_mut(&mut self, ptr: &Self::Ptr) -> &mut T
[src]
pub unsafe fn remove_unchecked(&mut self, ptr: &Self::Ptr) -> T
[src]
impl<T> UnsafeArena<T> for SysAllocator
[src]
type Ptr = Ptr
pub fn insert(&mut self, x: T) -> Self::Ptr
[src]
pub unsafe fn get_unchecked(&self, ptr: &Self::Ptr) -> &T
[src]
pub unsafe fn get_unchecked_mut(&mut self, ptr: &Self::Ptr) -> &mut T
[src]
pub unsafe fn remove_unchecked(&mut self, ptr: &Self::Ptr) -> T
[src]
impl<T, A, P> UnsafeArena<T> for PooledArena<T, A, P> where
A: UnsafeArena<Entry<T, P>, Ptr = P>,
P: Clone + Default + PartialEq + Eq + Debug,
[src]
A: UnsafeArena<Entry<T, P>, Ptr = P>,
P: Clone + Default + PartialEq + Eq + Debug,