[−][src]Struct slice_arena::SliceArena
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,
T: Send,
impl<T> Sync for SliceArena<T> where
T: Send,
T: Send,
impl<T> Unpin for SliceArena<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for SliceArena<T>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,