pub trait BumpExt {
Show 14 methods
// Required methods
fn used_bytes(&self) -> usize;
fn alloc_as_slice<T>(&self, value: T) -> &mut [T];
fn alloc_from_iter<T>(&self, iter: impl Iterator<Item = T>) -> &mut [T];
fn alloc_vec<T>(&self, values: Vec<T>) -> &mut [T];
fn alloc_smallvec<A: Array>(&self, values: SmallVec<A>) -> &mut [A::Item];
fn alloc_array<T, const N: usize>(&self, values: [T; N]) -> &mut [T];
unsafe fn alloc_slice_unchecked<'a, T>(&'a self, slice: &[T]) -> &'a mut [T];
fn alloc_as_thin_slice<H, T>(
&self,
header: H,
value: T,
) -> &mut RawThinSlice<H, T>;
fn alloc_from_iter_thin<H, T>(
&self,
header: H,
iter: impl Iterator<Item = T>,
) -> &mut RawThinSlice<H, T>;
fn alloc_vec_thin<H, T>(
&self,
header: H,
values: Vec<T>,
) -> &mut RawThinSlice<H, T>;
fn alloc_smallvec_thin<H, A: Array>(
&self,
header: H,
values: SmallVec<A>,
) -> &mut RawThinSlice<H, A::Item>;
fn alloc_array_thin<H, T, const N: usize>(
&self,
header: H,
values: [T; N],
) -> &mut RawThinSlice<H, T>;
unsafe fn alloc_thin_slice_unchecked<'a, H, T>(
&'a self,
header: H,
src: &[T],
) -> &'a mut RawThinSlice<H, T>;
// Provided method
fn alloc_thin_slice_copy<'a, H, T: Copy>(
&'a self,
header: H,
src: &[T],
) -> &'a mut RawThinSlice<H, T> { ... }
}Expand description
Extension trait for Bump.
Required Methods§
Sourcefn used_bytes(&self) -> usize
fn used_bytes(&self) -> usize
Returns the number of bytes currently in use.
Sourcefn alloc_as_slice<T>(&self, value: T) -> &mut [T]
fn alloc_as_slice<T>(&self, value: T) -> &mut [T]
Allocates a value as a slice of length 1.
Sourcefn alloc_from_iter<T>(&self, iter: impl Iterator<Item = T>) -> &mut [T]
fn alloc_from_iter<T>(&self, iter: impl Iterator<Item = T>) -> &mut [T]
Allocates an iterator by first collecting it into a (possibly stack-allocated) vector.
Does not collect if the iterator is exact size, meaning size_hint returns equal values.
Sourcefn alloc_vec<T>(&self, values: Vec<T>) -> &mut [T]
fn alloc_vec<T>(&self, values: Vec<T>) -> &mut [T]
Allocates a vector of items on the arena.
NOTE: This method does not drop the values, so you likely want to wrap the result in a
[bumpalo::boxed::Box] if T: Drop.
Sourcefn alloc_smallvec<A: Array>(&self, values: SmallVec<A>) -> &mut [A::Item]
fn alloc_smallvec<A: Array>(&self, values: SmallVec<A>) -> &mut [A::Item]
Allocates a SmallVector of items on the arena.
NOTE: This method does not drop the values, so you likely want to wrap the result in a
[bumpalo::boxed::Box] if T: Drop.
Sourcefn alloc_array<T, const N: usize>(&self, values: [T; N]) -> &mut [T]
fn alloc_array<T, const N: usize>(&self, values: [T; N]) -> &mut [T]
Allocates an array of items on the arena.
NOTE: This method does not drop the values, so you likely want to wrap the result in a
[bumpalo::boxed::Box] if T: Drop.
Sourceunsafe fn alloc_slice_unchecked<'a, T>(&'a self, slice: &[T]) -> &'a mut [T]
unsafe fn alloc_slice_unchecked<'a, T>(&'a self, slice: &[T]) -> &'a mut [T]
Sourcefn alloc_as_thin_slice<H, T>(
&self,
header: H,
value: T,
) -> &mut RawThinSlice<H, T>
fn alloc_as_thin_slice<H, T>( &self, header: H, value: T, ) -> &mut RawThinSlice<H, T>
See alloc_as_slice.
Sourcefn alloc_from_iter_thin<H, T>(
&self,
header: H,
iter: impl Iterator<Item = T>,
) -> &mut RawThinSlice<H, T>
fn alloc_from_iter_thin<H, T>( &self, header: H, iter: impl Iterator<Item = T>, ) -> &mut RawThinSlice<H, T>
See alloc_from_iter.
Sourcefn alloc_vec_thin<H, T>(
&self,
header: H,
values: Vec<T>,
) -> &mut RawThinSlice<H, T>
fn alloc_vec_thin<H, T>( &self, header: H, values: Vec<T>, ) -> &mut RawThinSlice<H, T>
See alloc_vec.
Sourcefn alloc_smallvec_thin<H, A: Array>(
&self,
header: H,
values: SmallVec<A>,
) -> &mut RawThinSlice<H, A::Item>
fn alloc_smallvec_thin<H, A: Array>( &self, header: H, values: SmallVec<A>, ) -> &mut RawThinSlice<H, A::Item>
See alloc_smallvec.
Sourcefn alloc_array_thin<H, T, const N: usize>(
&self,
header: H,
values: [T; N],
) -> &mut RawThinSlice<H, T>
fn alloc_array_thin<H, T, const N: usize>( &self, header: H, values: [T; N], ) -> &mut RawThinSlice<H, T>
See alloc_array.
Sourceunsafe fn alloc_thin_slice_unchecked<'a, H, T>(
&'a self,
header: H,
src: &[T],
) -> &'a mut RawThinSlice<H, T>
unsafe fn alloc_thin_slice_unchecked<'a, H, T>( &'a self, header: H, src: &[T], ) -> &'a mut RawThinSlice<H, T>
Provided Methods§
Sourcefn alloc_thin_slice_copy<'a, H, T: Copy>(
&'a self,
header: H,
src: &[T],
) -> &'a mut RawThinSlice<H, T>
fn alloc_thin_slice_copy<'a, H, T: Copy>( &'a self, header: H, src: &[T], ) -> &'a mut RawThinSlice<H, T>
See alloc_slice_copy.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.