[][src]Struct shared_arena::ArenaBox

pub struct ArenaBox<T> { /* fields omitted */ }

A pointer to T in the arena

ArenaBox implements DerefMut so it is directly mutable (without mutex or other synchronization methods).

It is not clonable and can be sent to others threads.

Deref & DerefMut behavior

ArenaBox<T> automatically dereferences to T, so you can call T's methods on a value of type ArenaBox<T>.

let arena = SharedArena::new();
let mut my_opt: ArenaBox<Option<i32>> = arena.alloc(Some(10));

assert!(my_opt.is_some());
assert_eq!(my_opt.take(), Some(10));
assert!(my_opt.is_none());

Trait Implementations

impl<T: Debug> Debug for ArenaBox<T>[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

let arena = SharedArena::new();
let my_opt: ArenaBox<Option<i32>> = arena.alloc(Some(10));

println!("{:?}", my_opt);

impl<T> Deref for ArenaBox<T>[src]

type Target = T

The resulting type after dereferencing.

fn deref(&self) -> &T[src]

let arena = SharedArena::new();
let mut my_opt: ArenaBox<Option<i32>> = arena.alloc(Some(10));

assert!(my_opt.is_some());

impl<T> DerefMut for ArenaBox<T>[src]

fn deref_mut(&mut self) -> &mut T[src]

let arena = SharedArena::new();
let mut my_opt: ArenaBox<Option<i32>> = arena.alloc(Some(10));

assert_eq!(my_opt.take(), Some(10));

impl<T: Display> Display for ArenaBox<T>[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

let arena = SharedArena::new();
let my_num = arena.alloc(10);

println!("{}", my_num);

impl<T> Drop for ArenaBox<T>[src]

Drop the ArenaBox

The value pointed by this ArenaBox is also dropped

fn drop(&mut self)[src]

let arena = SharedArena::new();
let mut my_num = arena.alloc(10);

assert_eq!(arena.stats(), (1, 62));
std::mem::drop(my_num);
assert_eq!(arena.stats(), (0, 63));

impl<T> Pointer for ArenaBox<T>[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

let arena = SharedArena::new();
let my_num = arena.alloc(10);

println!("{:p}", my_num);

impl<T: Send> Send for ArenaBox<T>[src]

impl<T: Send + Sync> Sync for ArenaBox<T>[src]

Auto Trait Implementations

impl<T> !RefUnwindSafe for ArenaBox<T>

impl<T> Unpin for ArenaBox<T>

impl<T> !UnwindSafe for ArenaBox<T>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.