[][src]Struct slice_arena::SliceArena

pub struct SliceArena<T = u8> { /* fields omitted */ }

Thread-safe memory arena.

Methods

impl<T: Clone> SliceArena<T>[src]

pub fn new() -> Self[src]

New arena with ~64KB of initial capacity (which will grow exponentially as needed).

It works with any cloneable element type, but SliceArena<u8> is the default (it's like Vec<u8>).

pub fn with_capacity(capacity: usize) -> Self[src]

New arena with memory reserved for the initial number of elements.

Arena grows expomnentially, so once this capacity is exhausted, a double of that size will be allocated.

Capacity should be much much larger than sizes of slices pushed. Pushing a slice larger than the capacity leaves previous capacity unused.

pub fn push<'arena>(&'arena self, slice: &[T]) -> &'arena mut [T][src]

Copy a slice into the arena. Returns arena-allocated slice.

impl SliceArena<u8>[src]

pub fn push_str<'arena>(&'arena self, s: impl AsRef<str>) -> &'arena str[src]

Store a string slice in the arena.

pub fn push_os_str<'arena>(&'arena self, s: &OsStr) -> &'arena OsStr[src]

Store a Unix OsStr in the arena. This function does not exist on Windows.

pub fn push_path<'arena>(&'arena self, str: impl AsRef<Path>) -> &'arena Path[src]

Store a Unix Path in the arena. This function does not exist on Windows.

Auto Trait Implementations

impl<T> RefUnwindSafe for SliceArena<T>

impl<T> Send for SliceArena<T> where
    T: Send

impl<T> Sync for SliceArena<T> where
    T: Send

impl<T> Unpin for SliceArena<T> where
    T: Unpin

impl<T> UnwindSafe for SliceArena<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, 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.