pub struct BumpScope<'a, A = Global, S = BumpSettings>where
S: BumpAllocatorSettings,{ /* private fields */ }Expand description
A bump allocation scope.
A BumpScope’s allocations are live for 'a, which is the lifetime of its associated BumpScopeGuard or scoped closure.
BumpScope has mostly same api as Bump.
This type is provided as a parameter to the closure of scoped, or created
by BumpScopeGuard::scope. A Bump can also be turned into a BumpScope using
as_scope, as_mut_scope or from / into.
Implementations§
Source§impl<A, S> BumpScope<'_, A, S>
impl<A, S> BumpScope<'_, A, S>
Sourcepub fn by_value(&mut self) -> BumpScope<'_, A, S>
pub fn by_value(&mut self) -> BumpScope<'_, A, S>
Returns this &mut BumpScope as a BumpScope.
This requires allocating a chunk if none has been allocated yet.
This method exists so you can have BumpScope<'a> function parameters and
struct fields instead of &'b mut BumpScope<'a> so you don’t have to deal with 'b.
It also enables more settings conversions since with_settings can do more than
borrow_mut_with_settings.
§Panics
Panics if the bump allocator is currently claimed.
Panics if the allocation fails.
Sourcepub fn try_by_value(&mut self) -> Result<BumpScope<'_, A, S>, AllocError>
pub fn try_by_value(&mut self) -> Result<BumpScope<'_, A, S>, AllocError>
Returns this &mut BumpScope as a BumpScope.
This requires allocating a chunk if none has been allocated yet.
This method exists so you can have BumpScope<'a> function parameters and
struct fields instead of &'b mut BumpScope<'a> so you don’t have to deal with 'b.
It also enables more settings conversions since with_settings can do more than
borrow_mut_with_settings.
§Errors
Errors if the bump allocator is currently claimed.
Errors if the allocation fails.
Source§impl<'a, A, S> BumpScope<'a, A, S>where
S: BumpAllocatorSettings,
impl<'a, A, S> BumpScope<'a, A, S>where
S: BumpAllocatorSettings,
Sourcepub fn stats(&self) -> Stats<'a, A, S>
pub fn stats(&self) -> Stats<'a, A, S>
Returns a type which provides statistics about the memory usage of the bump allocator.
Sourcepub fn with_settings<NewS>(self) -> BumpScope<'a, A, NewS>where
NewS: BumpAllocatorSettings,
pub fn with_settings<NewS>(self) -> BumpScope<'a, A, NewS>where
NewS: BumpAllocatorSettings,
Sourcepub fn borrow_with_settings<NewS>(&self) -> &BumpScope<'a, A, NewS>where
NewS: BumpAllocatorSettings,
pub fn borrow_with_settings<NewS>(&self) -> &BumpScope<'a, A, NewS>where
NewS: BumpAllocatorSettings,
Borrows this BumpScope with new settings.
This function will fail to compile if:
NewS::MIN_ALIGN != S::MIN_ALIGNNewS::UP != S::UPNewS::CLAIMABLE != S::CLAIMABLENewS::GUARANTEED_ALLOCATED > S::GUARANTEED_ALLOCATED
Sourcepub fn borrow_mut_with_settings<NewS>(&mut self) -> &mut BumpScope<'a, A, NewS>where
NewS: BumpAllocatorSettings,
pub fn borrow_mut_with_settings<NewS>(&mut self) -> &mut BumpScope<'a, A, NewS>where
NewS: BumpAllocatorSettings,
Borrows this BumpScope mutably with new settings.
This function will fail to compile if:
NewS::MIN_ALIGN < S::MIN_ALIGNNewS::UP != S::UPNewS::GUARANTEED_ALLOCATED != S::GUARANTEED_ALLOCATEDNewS::CLAIMABLE != S::CLAIMABLE
Source§impl<S> BumpScope<'_, Global, S>where
S: BumpAllocatorSettings,
impl<S> BumpScope<'_, Global, S>where
S: BumpAllocatorSettings,
Sourcepub fn into_raw(self) -> NonNull<()>
Available on crate feature alloc only.
pub fn into_raw(self) -> NonNull<()>
alloc only.Converts this BumpScope into a raw pointer.
Sourcepub unsafe fn from_raw(ptr: NonNull<()>) -> Self
Available on crate feature alloc only.
pub unsafe fn from_raw(ptr: NonNull<()>) -> Self
alloc only.Converts the raw pointer that was created with into_raw back into a BumpScope.
§Safety
This is highly unsafe, due to the number of invariants that aren’t checked:
ptrmust have been created withSelf::into_raw.- This function must only be called once with this
ptr. - Nothing must have been allocated since then.
- The lifetime must match the original one.
- The settings must match the original ones.
Source§impl<'a, A, S> BumpScope<'a, A, S>
Methods that forward to traits.
impl<'a, A, S> BumpScope<'a, A, S>
Methods that forward to traits.
Sourcepub fn allocator(&self) -> Option<&'a A>
pub fn allocator(&self) -> Option<&'a A>
Forwards to BumpAllocatorScope::allocator.
Sourcepub fn claim(&self) -> BumpClaimGuard<'_, 'a, A, S>
pub fn claim(&self) -> BumpClaimGuard<'_, 'a, A, S>
Forwards to BumpAllocatorScope::claim.
Sourcepub fn is_claimed(&self) -> bool
pub fn is_claimed(&self) -> bool
Forwards to BumpAllocatorCore::is_claimed.
Sourcepub fn scope_guard(&mut self) -> BumpScopeGuard<'_, A, S>
pub fn scope_guard(&mut self) -> BumpScopeGuard<'_, A, S>
Forwards to BumpAllocator::scope_guard.
Sourcepub fn scoped<R>(&mut self, f: impl FnOnce(&mut BumpScope<'_, A, S>) -> R) -> R
pub fn scoped<R>(&mut self, f: impl FnOnce(&mut BumpScope<'_, A, S>) -> R) -> R
Forwards to BumpAllocator::scoped.
Sourcepub fn scoped_aligned<const NEW_MIN_ALIGN: usize, R>(
&mut self,
f: impl FnOnce(&mut BumpScope<'_, A, S::WithMinimumAlignment<NEW_MIN_ALIGN>>) -> R,
) -> Rwhere
MinimumAlignment<NEW_MIN_ALIGN>: SupportedMinimumAlignment,
pub fn scoped_aligned<const NEW_MIN_ALIGN: usize, R>(
&mut self,
f: impl FnOnce(&mut BumpScope<'_, A, S::WithMinimumAlignment<NEW_MIN_ALIGN>>) -> R,
) -> Rwhere
MinimumAlignment<NEW_MIN_ALIGN>: SupportedMinimumAlignment,
Forwards to BumpAllocator::scoped_aligned.
Sourcepub fn aligned<const NEW_MIN_ALIGN: usize, R>(
&mut self,
f: impl FnOnce(&mut BumpScope<'a, A, S::WithMinimumAlignment<NEW_MIN_ALIGN>>) -> R,
) -> Rwhere
MinimumAlignment<NEW_MIN_ALIGN>: SupportedMinimumAlignment,
pub fn aligned<const NEW_MIN_ALIGN: usize, R>(
&mut self,
f: impl FnOnce(&mut BumpScope<'a, A, S::WithMinimumAlignment<NEW_MIN_ALIGN>>) -> R,
) -> Rwhere
MinimumAlignment<NEW_MIN_ALIGN>: SupportedMinimumAlignment,
Forwards to BumpAllocatorScope::aligned.
Sourcepub fn checkpoint(&self) -> Checkpoint
pub fn checkpoint(&self) -> Checkpoint
Forwards to BumpAllocatorCore::checkpoint.
Sourcepub unsafe fn reset_to(&self, checkpoint: Checkpoint)
pub unsafe fn reset_to(&self, checkpoint: Checkpoint)
Forwards to BumpAllocatorCore::reset_to.
Sourcepub fn alloc<T>(&self, value: T) -> BumpBox<'a, T> ⓘ
pub fn alloc<T>(&self, value: T) -> BumpBox<'a, T> ⓘ
Forwards to BumpAllocatorTypedScope::alloc.
Sourcepub fn try_alloc<T>(&self, value: T) -> Result<BumpBox<'a, T>, AllocError>
pub fn try_alloc<T>(&self, value: T) -> Result<BumpBox<'a, T>, AllocError>
Forwards to BumpAllocatorTypedScope::try_alloc.
Sourcepub fn alloc_with<T>(&self, f: impl FnOnce() -> T) -> BumpBox<'a, T> ⓘ
pub fn alloc_with<T>(&self, f: impl FnOnce() -> T) -> BumpBox<'a, T> ⓘ
Forwards to BumpAllocatorTypedScope::alloc_with.
Sourcepub fn try_alloc_with<T>(
&self,
f: impl FnOnce() -> T,
) -> Result<BumpBox<'a, T>, AllocError>
pub fn try_alloc_with<T>( &self, f: impl FnOnce() -> T, ) -> Result<BumpBox<'a, T>, AllocError>
Forwards to BumpAllocatorTypedScope::try_alloc_with.
Sourcepub fn alloc_default<T: Default>(&self) -> BumpBox<'a, T> ⓘ
pub fn alloc_default<T: Default>(&self) -> BumpBox<'a, T> ⓘ
Forwards to BumpAllocatorTypedScope::alloc_default.
Sourcepub fn try_alloc_default<T: Default>(
&self,
) -> Result<BumpBox<'a, T>, AllocError>
pub fn try_alloc_default<T: Default>( &self, ) -> Result<BumpBox<'a, T>, AllocError>
Forwards to BumpAllocatorTypedScope::try_alloc_default.
Sourcepub fn alloc_clone<T: CloneToUninit + ?Sized>(
&self,
value: &T,
) -> BumpBox<'a, T> ⓘ
Available on crate feature nightly-clone-to-uninit only.
pub fn alloc_clone<T: CloneToUninit + ?Sized>( &self, value: &T, ) -> BumpBox<'a, T> ⓘ
nightly-clone-to-uninit only.Forwards to BumpAllocatorTypedScope::alloc_clone.
Sourcepub fn try_alloc_clone<T: CloneToUninit + ?Sized>(
&self,
value: &T,
) -> Result<BumpBox<'a, T>, AllocError>
Available on crate feature nightly-clone-to-uninit only.
pub fn try_alloc_clone<T: CloneToUninit + ?Sized>( &self, value: &T, ) -> Result<BumpBox<'a, T>, AllocError>
nightly-clone-to-uninit only.Forwards to BumpAllocatorTypedScope::try_alloc_clone.
Sourcepub fn alloc_slice_move<T>(
&self,
slice: impl OwnedSlice<Item = T>,
) -> BumpBox<'a, [T]> ⓘ
pub fn alloc_slice_move<T>( &self, slice: impl OwnedSlice<Item = T>, ) -> BumpBox<'a, [T]> ⓘ
Forwards to BumpAllocatorTypedScope::alloc_slice_move.
Sourcepub fn try_alloc_slice_move<T>(
&self,
slice: impl OwnedSlice<Item = T>,
) -> Result<BumpBox<'a, [T]>, AllocError>
pub fn try_alloc_slice_move<T>( &self, slice: impl OwnedSlice<Item = T>, ) -> Result<BumpBox<'a, [T]>, AllocError>
Forwards to BumpAllocatorTypedScope::try_alloc_slice_move.
Sourcepub fn alloc_slice_copy<T: Copy>(&self, slice: &[T]) -> BumpBox<'a, [T]> ⓘ
pub fn alloc_slice_copy<T: Copy>(&self, slice: &[T]) -> BumpBox<'a, [T]> ⓘ
Forwards to BumpAllocatorTypedScope::alloc_slice_copy.
Sourcepub fn try_alloc_slice_copy<T: Copy>(
&self,
slice: &[T],
) -> Result<BumpBox<'a, [T]>, AllocError>
pub fn try_alloc_slice_copy<T: Copy>( &self, slice: &[T], ) -> Result<BumpBox<'a, [T]>, AllocError>
Forwards to BumpAllocatorTypedScope::try_alloc_slice_copy.
Sourcepub fn alloc_slice_clone<T: Clone>(&self, slice: &[T]) -> BumpBox<'a, [T]> ⓘ
pub fn alloc_slice_clone<T: Clone>(&self, slice: &[T]) -> BumpBox<'a, [T]> ⓘ
Forwards to BumpAllocatorTypedScope::alloc_slice_clone.
Sourcepub fn try_alloc_slice_clone<T: Clone>(
&self,
slice: &[T],
) -> Result<BumpBox<'a, [T]>, AllocError>
pub fn try_alloc_slice_clone<T: Clone>( &self, slice: &[T], ) -> Result<BumpBox<'a, [T]>, AllocError>
Forwards to BumpAllocatorTypedScope::try_alloc_slice_clone.
Sourcepub fn alloc_slice_fill<T: Clone>(
&self,
len: usize,
value: T,
) -> BumpBox<'a, [T]> ⓘ
pub fn alloc_slice_fill<T: Clone>( &self, len: usize, value: T, ) -> BumpBox<'a, [T]> ⓘ
Forwards to BumpAllocatorTypedScope::alloc_slice_fill.
Sourcepub fn try_alloc_slice_fill<T: Clone>(
&self,
len: usize,
value: T,
) -> Result<BumpBox<'a, [T]>, AllocError>
pub fn try_alloc_slice_fill<T: Clone>( &self, len: usize, value: T, ) -> Result<BumpBox<'a, [T]>, AllocError>
Forwards to BumpAllocatorTypedScope::try_alloc_slice_fill.
Sourcepub fn alloc_slice_fill_with<T>(
&self,
len: usize,
f: impl FnMut() -> T,
) -> BumpBox<'a, [T]> ⓘ
pub fn alloc_slice_fill_with<T>( &self, len: usize, f: impl FnMut() -> T, ) -> BumpBox<'a, [T]> ⓘ
Forwards to BumpAllocatorTypedScope::alloc_slice_fill_with.
Sourcepub fn try_alloc_slice_fill_with<T>(
&self,
len: usize,
f: impl FnMut() -> T,
) -> Result<BumpBox<'a, [T]>, AllocError>
pub fn try_alloc_slice_fill_with<T>( &self, len: usize, f: impl FnMut() -> T, ) -> Result<BumpBox<'a, [T]>, AllocError>
Forwards to BumpAllocatorTypedScope::try_alloc_slice_fill_with.
Sourcepub fn alloc_str(&self, src: &str) -> BumpBox<'a, str> ⓘ
pub fn alloc_str(&self, src: &str) -> BumpBox<'a, str> ⓘ
Forwards to BumpAllocatorTypedScope::alloc_str.
Sourcepub fn try_alloc_str(&self, src: &str) -> Result<BumpBox<'a, str>, AllocError>
pub fn try_alloc_str(&self, src: &str) -> Result<BumpBox<'a, str>, AllocError>
Forwards to BumpAllocatorTypedScope::try_alloc_str.
Sourcepub fn alloc_fmt(&self, args: Arguments<'_>) -> BumpBox<'a, str> ⓘ
pub fn alloc_fmt(&self, args: Arguments<'_>) -> BumpBox<'a, str> ⓘ
Forwards to BumpAllocatorTypedScope::alloc_fmt.
Sourcepub fn try_alloc_fmt(
&self,
args: Arguments<'_>,
) -> Result<BumpBox<'a, str>, AllocError>
pub fn try_alloc_fmt( &self, args: Arguments<'_>, ) -> Result<BumpBox<'a, str>, AllocError>
Forwards to BumpAllocatorTypedScope::try_alloc_fmt.
Sourcepub fn alloc_fmt_mut(&mut self, args: Arguments<'_>) -> BumpBox<'a, str> ⓘ
pub fn alloc_fmt_mut(&mut self, args: Arguments<'_>) -> BumpBox<'a, str> ⓘ
Forwards to MutBumpAllocatorTypedScope::alloc_fmt_mut.
Sourcepub fn try_alloc_fmt_mut(
&mut self,
args: Arguments<'_>,
) -> Result<BumpBox<'a, str>, AllocError>
pub fn try_alloc_fmt_mut( &mut self, args: Arguments<'_>, ) -> Result<BumpBox<'a, str>, AllocError>
Forwards to MutBumpAllocatorTypedScope::try_alloc_fmt_mut.
Sourcepub fn alloc_cstr(&self, src: &CStr) -> &'a CStr
pub fn alloc_cstr(&self, src: &CStr) -> &'a CStr
Forwards to BumpAllocatorTypedScope::alloc_cstr.
Sourcepub fn try_alloc_cstr(&self, src: &CStr) -> Result<&'a CStr, AllocError>
pub fn try_alloc_cstr(&self, src: &CStr) -> Result<&'a CStr, AllocError>
Forwards to BumpAllocatorTypedScope::try_alloc_cstr.
Sourcepub fn alloc_cstr_from_str(&self, src: &str) -> &'a CStr
pub fn alloc_cstr_from_str(&self, src: &str) -> &'a CStr
Forwards to BumpAllocatorTypedScope::alloc_cstr_from_str.
Sourcepub fn try_alloc_cstr_from_str(&self, src: &str) -> Result<&'a CStr, AllocError>
pub fn try_alloc_cstr_from_str(&self, src: &str) -> Result<&'a CStr, AllocError>
Forwards to BumpAllocatorTypedScope::try_alloc_cstr_from_str.
Sourcepub fn alloc_cstr_fmt(&self, args: Arguments<'_>) -> &'a CStr
pub fn alloc_cstr_fmt(&self, args: Arguments<'_>) -> &'a CStr
Forwards to BumpAllocatorTypedScope::alloc_cstr_fmt.
Sourcepub fn try_alloc_cstr_fmt(
&self,
args: Arguments<'_>,
) -> Result<&'a CStr, AllocError>
pub fn try_alloc_cstr_fmt( &self, args: Arguments<'_>, ) -> Result<&'a CStr, AllocError>
Forwards to BumpAllocatorTypedScope::try_alloc_cstr_fmt.
Sourcepub fn alloc_cstr_fmt_mut(&mut self, args: Arguments<'_>) -> &'a CStr
pub fn alloc_cstr_fmt_mut(&mut self, args: Arguments<'_>) -> &'a CStr
Forwards to MutBumpAllocatorTypedScope::alloc_cstr_fmt_mut.
Sourcepub fn try_alloc_cstr_fmt_mut(
&mut self,
args: Arguments<'_>,
) -> Result<&'a CStr, AllocError>
pub fn try_alloc_cstr_fmt_mut( &mut self, args: Arguments<'_>, ) -> Result<&'a CStr, AllocError>
Forwards to MutBumpAllocatorTypedScope::try_alloc_cstr_fmt_mut.
Sourcepub fn alloc_iter<T>(
&self,
iter: impl IntoIterator<Item = T>,
) -> BumpBox<'a, [T]> ⓘ
pub fn alloc_iter<T>( &self, iter: impl IntoIterator<Item = T>, ) -> BumpBox<'a, [T]> ⓘ
Forwards to BumpAllocatorTypedScope::alloc_iter.
Sourcepub fn try_alloc_iter<T>(
&self,
iter: impl IntoIterator<Item = T>,
) -> Result<BumpBox<'a, [T]>, AllocError>
pub fn try_alloc_iter<T>( &self, iter: impl IntoIterator<Item = T>, ) -> Result<BumpBox<'a, [T]>, AllocError>
Forwards to BumpAllocatorTypedScope::try_alloc_iter.
Sourcepub fn alloc_iter_exact<T, I>(
&self,
iter: impl IntoIterator<Item = T, IntoIter = I>,
) -> BumpBox<'a, [T]> ⓘwhere
I: ExactSizeIterator<Item = T>,
pub fn alloc_iter_exact<T, I>(
&self,
iter: impl IntoIterator<Item = T, IntoIter = I>,
) -> BumpBox<'a, [T]> ⓘwhere
I: ExactSizeIterator<Item = T>,
Forwards to BumpAllocatorTypedScope::alloc_iter_exact.
Sourcepub fn try_alloc_iter_exact<T, I>(
&self,
iter: impl IntoIterator<Item = T, IntoIter = I>,
) -> Result<BumpBox<'a, [T]>, AllocError>where
I: ExactSizeIterator<Item = T>,
pub fn try_alloc_iter_exact<T, I>(
&self,
iter: impl IntoIterator<Item = T, IntoIter = I>,
) -> Result<BumpBox<'a, [T]>, AllocError>where
I: ExactSizeIterator<Item = T>,
Forwards to BumpAllocatorTypedScope::try_alloc_iter_exact.
Sourcepub fn alloc_iter_mut<T>(
&mut self,
iter: impl IntoIterator<Item = T>,
) -> BumpBox<'a, [T]> ⓘ
pub fn alloc_iter_mut<T>( &mut self, iter: impl IntoIterator<Item = T>, ) -> BumpBox<'a, [T]> ⓘ
Forwards to MutBumpAllocatorTypedScope::alloc_iter_mut.
Sourcepub fn try_alloc_iter_mut<T>(
&mut self,
iter: impl IntoIterator<Item = T>,
) -> Result<BumpBox<'a, [T]>, AllocError>
pub fn try_alloc_iter_mut<T>( &mut self, iter: impl IntoIterator<Item = T>, ) -> Result<BumpBox<'a, [T]>, AllocError>
Forwards to MutBumpAllocatorTypedScope::try_alloc_iter_mut.
Sourcepub fn alloc_iter_mut_rev<T>(
&mut self,
iter: impl IntoIterator<Item = T>,
) -> BumpBox<'a, [T]> ⓘ
pub fn alloc_iter_mut_rev<T>( &mut self, iter: impl IntoIterator<Item = T>, ) -> BumpBox<'a, [T]> ⓘ
Forwards to MutBumpAllocatorTypedScope::alloc_iter_mut_rev.
Sourcepub fn try_alloc_iter_mut_rev<T>(
&mut self,
iter: impl IntoIterator<Item = T>,
) -> Result<BumpBox<'a, [T]>, AllocError>
pub fn try_alloc_iter_mut_rev<T>( &mut self, iter: impl IntoIterator<Item = T>, ) -> Result<BumpBox<'a, [T]>, AllocError>
Forwards to MutBumpAllocatorTypedScope::try_alloc_iter_mut_rev.
Sourcepub fn alloc_uninit<T>(&self) -> BumpBox<'a, MaybeUninit<T>> ⓘ
pub fn alloc_uninit<T>(&self) -> BumpBox<'a, MaybeUninit<T>> ⓘ
Forwards to BumpAllocatorTypedScope::alloc_uninit.
Sourcepub fn try_alloc_uninit<T>(
&self,
) -> Result<BumpBox<'a, MaybeUninit<T>>, AllocError>
pub fn try_alloc_uninit<T>( &self, ) -> Result<BumpBox<'a, MaybeUninit<T>>, AllocError>
Forwards to BumpAllocatorTypedScope::try_alloc_uninit.
Sourcepub fn alloc_uninit_slice<T>(&self, len: usize) -> BumpBox<'a, [MaybeUninit<T>]> ⓘ
pub fn alloc_uninit_slice<T>(&self, len: usize) -> BumpBox<'a, [MaybeUninit<T>]> ⓘ
Forwards to BumpAllocatorTypedScope::alloc_uninit_slice.
Sourcepub fn try_alloc_uninit_slice<T>(
&self,
len: usize,
) -> Result<BumpBox<'a, [MaybeUninit<T>]>, AllocError>
pub fn try_alloc_uninit_slice<T>( &self, len: usize, ) -> Result<BumpBox<'a, [MaybeUninit<T>]>, AllocError>
Forwards to BumpAllocatorTypedScope::try_alloc_uninit_slice.
Sourcepub fn alloc_uninit_slice_for<T>(
&self,
slice: &[T],
) -> BumpBox<'a, [MaybeUninit<T>]> ⓘ
pub fn alloc_uninit_slice_for<T>( &self, slice: &[T], ) -> BumpBox<'a, [MaybeUninit<T>]> ⓘ
Forwards to BumpAllocatorTypedScope::alloc_uninit_slice_for.
Sourcepub fn try_alloc_uninit_slice_for<T>(
&self,
slice: &[T],
) -> Result<BumpBox<'a, [MaybeUninit<T>]>, AllocError>
pub fn try_alloc_uninit_slice_for<T>( &self, slice: &[T], ) -> Result<BumpBox<'a, [MaybeUninit<T>]>, AllocError>
Forwards to BumpAllocatorTypedScope::try_alloc_uninit_slice_for.
Sourcepub fn dealloc<T: ?Sized>(&self, boxed: BumpBox<'_, T>)
pub fn dealloc<T: ?Sized>(&self, boxed: BumpBox<'_, T>)
Forwards to BumpAllocatorTyped::dealloc.
Sourcepub fn reserve(&self, additional: usize)
pub fn reserve(&self, additional: usize)
Forwards to BumpAllocatorTyped::reserve.
Sourcepub fn try_reserve(&self, additional: usize) -> Result<(), AllocError>
pub fn try_reserve(&self, additional: usize) -> Result<(), AllocError>
Forwards to BumpAllocatorTyped::try_reserve.
Source§impl<'a, A, S> BumpScope<'a, A, S>
Additional alloc methods that are not available in traits.
impl<'a, A, S> BumpScope<'a, A, S>
Additional alloc methods that are not available in traits.
Sourcepub fn alloc_try_with<T, E>(
&self,
f: impl FnOnce() -> Result<T, E>,
) -> Result<BumpBox<'a, T>, E>
pub fn alloc_try_with<T, E>( &self, f: impl FnOnce() -> Result<T, E>, ) -> Result<BumpBox<'a, T>, E>
Allocates the result of f in the bump allocator, then moves E out of it and deallocates the space it took up.
This can be more performant than allocating T after the fact, as Result<T, E> may be constructed in the bump allocators memory instead of on the stack and then copied over.
There is also alloc_try_with_mut, optimized for a mutable reference.
§Panics
Panics if the allocation fails.
§Examples
let result = bump.alloc_try_with(|| -> Result<i32, i32> { Ok(123) });
assert_eq!(result.unwrap(), 123);
assert_eq!(bump.stats().allocated(), offset_of!(Result<i32, i32>, Ok.0) + size_of::<i32>());let result = bump.alloc_try_with(|| -> Result<i32, i32> { Err(123) });
assert_eq!(result.unwrap_err(), 123);
assert_eq!(bump.stats().allocated(), 0);Sourcepub fn try_alloc_try_with<T, E>(
&self,
f: impl FnOnce() -> Result<T, E>,
) -> Result<Result<BumpBox<'a, T>, E>, AllocError>
pub fn try_alloc_try_with<T, E>( &self, f: impl FnOnce() -> Result<T, E>, ) -> Result<Result<BumpBox<'a, T>, E>, AllocError>
Allocates the result of f in the bump allocator, then moves E out of it and deallocates the space it took up.
This can be more performant than allocating T after the fact, as Result<T, E> may be constructed in the bump allocators memory instead of on the stack and then copied over.
There is also try_alloc_try_with_mut, optimized for a mutable reference.
§Errors
Errors if the allocation fails.
§Examples
let result = bump.try_alloc_try_with(|| -> Result<i32, i32> { Ok(123) })?;
assert_eq!(result.unwrap(), 123);
assert_eq!(bump.stats().allocated(), offset_of!(Result<i32, i32>, Ok.0) + size_of::<i32>());let result = bump.try_alloc_try_with(|| -> Result<i32, i32> { Err(123) })?;
assert_eq!(result.unwrap_err(), 123);
assert_eq!(bump.stats().allocated(), 0);Sourcepub fn alloc_try_with_mut<T, E>(
&mut self,
f: impl FnOnce() -> Result<T, E>,
) -> Result<BumpBox<'a, T>, E>
pub fn alloc_try_with_mut<T, E>( &mut self, f: impl FnOnce() -> Result<T, E>, ) -> Result<BumpBox<'a, T>, E>
Allocates the result of f in the bump allocator, then moves E out of it and deallocates the space it took up.
This can be more performant than allocating T after the fact, as Result<T, E> may be constructed in the bump allocators memory instead of on the stack and then copied over.
This is just like alloc_try_with, but optimized for a mutable reference.
§Panics
Panics if the allocation fails.
§Examples
let result = bump.alloc_try_with_mut(|| -> Result<i32, i32> { Ok(123) });
assert_eq!(result.unwrap(), 123);
assert_eq!(bump.stats().allocated(), offset_of!(Result<i32, i32>, Ok.0) + size_of::<i32>());let result = bump.alloc_try_with_mut(|| -> Result<i32, i32> { Err(123) });
assert_eq!(result.unwrap_err(), 123);
assert_eq!(bump.stats().allocated(), 0);Sourcepub fn try_alloc_try_with_mut<T, E>(
&mut self,
f: impl FnOnce() -> Result<T, E>,
) -> Result<Result<BumpBox<'a, T>, E>, AllocError>
pub fn try_alloc_try_with_mut<T, E>( &mut self, f: impl FnOnce() -> Result<T, E>, ) -> Result<Result<BumpBox<'a, T>, E>, AllocError>
Allocates the result of f in the bump allocator, then moves E out of it and deallocates the space it took up.
This can be more performant than allocating T after the fact, as Result<T, E> may be constructed in the bump allocators memory instead of on the stack and then copied over.
This is just like try_alloc_try_with, but optimized for a mutable reference.
§Errors
Errors if the allocation fails.
§Examples
let result = bump.try_alloc_try_with_mut(|| -> Result<i32, i32> { Ok(123) })?;
assert_eq!(result.unwrap(), 123);
assert_eq!(bump.stats().allocated(), offset_of!(Result<i32, i32>, Ok.0) + size_of::<i32>());let result = bump.try_alloc_try_with_mut(|| -> Result<i32, i32> { Err(123) })?;
assert_eq!(result.unwrap_err(), 123);
assert_eq!(bump.stats().allocated(), 0);Trait Implementations§
Source§impl<A, S> Allocator for &mut BumpScope<'_, A, S>
Available on crate feature allocator-api2-03 only.
impl<A, S> Allocator for &mut BumpScope<'_, A, S>
allocator-api2-03 only.Source§fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, TargetAllocError>
fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, TargetAllocError>
Source§unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: Layout)
unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: Layout)
ptr. Read moreSource§unsafe fn grow(
&self,
ptr: NonNull<u8>,
old_layout: Layout,
new_layout: Layout,
) -> Result<NonNull<[u8]>, TargetAllocError>
unsafe fn grow( &self, ptr: NonNull<u8>, old_layout: Layout, new_layout: Layout, ) -> Result<NonNull<[u8]>, TargetAllocError>
Source§unsafe fn grow_zeroed(
&self,
ptr: NonNull<u8>,
old_layout: Layout,
new_layout: Layout,
) -> Result<NonNull<[u8]>, TargetAllocError>
unsafe fn grow_zeroed( &self, ptr: NonNull<u8>, old_layout: Layout, new_layout: Layout, ) -> Result<NonNull<[u8]>, TargetAllocError>
grow, but also ensures that the new contents are set to zero before being
returned. Read moreSource§unsafe fn shrink(
&self,
ptr: NonNull<u8>,
old_layout: Layout,
new_layout: Layout,
) -> Result<NonNull<[u8]>, TargetAllocError>
unsafe fn shrink( &self, ptr: NonNull<u8>, old_layout: Layout, new_layout: Layout, ) -> Result<NonNull<[u8]>, TargetAllocError>
Source§fn allocate_zeroed(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
fn allocate_zeroed(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
allocate, but also ensures that the returned memory is zero-initialized. Read moreSource§impl<A, S> Allocator for BumpScope<'_, A, S>
impl<A, S> Allocator for BumpScope<'_, A, S>
Source§fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
Source§unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: Layout)
unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: Layout)
ptr. Read moreSource§unsafe fn grow(
&self,
ptr: NonNull<u8>,
old_layout: Layout,
new_layout: Layout,
) -> Result<NonNull<[u8]>, AllocError>
unsafe fn grow( &self, ptr: NonNull<u8>, old_layout: Layout, new_layout: Layout, ) -> Result<NonNull<[u8]>, AllocError>
Source§unsafe fn grow_zeroed(
&self,
ptr: NonNull<u8>,
old_layout: Layout,
new_layout: Layout,
) -> Result<NonNull<[u8]>, AllocError>
unsafe fn grow_zeroed( &self, ptr: NonNull<u8>, old_layout: Layout, new_layout: Layout, ) -> Result<NonNull<[u8]>, AllocError>
grow, but also ensures that the new contents are set to zero before being
returned. Read moreSource§unsafe fn shrink(
&self,
ptr: NonNull<u8>,
old_layout: Layout,
new_layout: Layout,
) -> Result<NonNull<[u8]>, AllocError>
unsafe fn shrink( &self, ptr: NonNull<u8>, old_layout: Layout, new_layout: Layout, ) -> Result<NonNull<[u8]>, AllocError>
Source§fn allocate_zeroed(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
fn allocate_zeroed(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
allocate, but also ensures that the returned memory is zero-initialized. Read moreSource§impl<A, S> Allocator for BumpScope<'_, A, S>
Available on crate feature nightly-allocator-api only.
impl<A, S> Allocator for BumpScope<'_, A, S>
nightly-allocator-api only.Source§fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, TargetAllocError>
fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, TargetAllocError>
allocator_api)Source§unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: Layout)
unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: Layout)
allocator_api)ptr. Read moreSource§unsafe fn grow(
&self,
ptr: NonNull<u8>,
old_layout: Layout,
new_layout: Layout,
) -> Result<NonNull<[u8]>, TargetAllocError>
unsafe fn grow( &self, ptr: NonNull<u8>, old_layout: Layout, new_layout: Layout, ) -> Result<NonNull<[u8]>, TargetAllocError>
allocator_api)Source§unsafe fn grow_zeroed(
&self,
ptr: NonNull<u8>,
old_layout: Layout,
new_layout: Layout,
) -> Result<NonNull<[u8]>, TargetAllocError>
unsafe fn grow_zeroed( &self, ptr: NonNull<u8>, old_layout: Layout, new_layout: Layout, ) -> Result<NonNull<[u8]>, TargetAllocError>
allocator_api)grow, but also ensures that the new contents are set to zero before being
returned. Read moreSource§unsafe fn shrink(
&self,
ptr: NonNull<u8>,
old_layout: Layout,
new_layout: Layout,
) -> Result<NonNull<[u8]>, TargetAllocError>
unsafe fn shrink( &self, ptr: NonNull<u8>, old_layout: Layout, new_layout: Layout, ) -> Result<NonNull<[u8]>, TargetAllocError>
allocator_api)Source§fn allocate_zeroed(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
fn allocate_zeroed(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
allocator_api)allocate, but also ensures that the returned memory is zero-initialized. Read moreSource§impl<A, S> Allocator for BumpScope<'_, A, S>
Available on crate feature allocator-api2-03 only.
impl<A, S> Allocator for BumpScope<'_, A, S>
allocator-api2-03 only.Source§fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, TargetAllocError>
fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, TargetAllocError>
Source§unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: Layout)
unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: Layout)
ptr. Read moreSource§unsafe fn grow(
&self,
ptr: NonNull<u8>,
old_layout: Layout,
new_layout: Layout,
) -> Result<NonNull<[u8]>, TargetAllocError>
unsafe fn grow( &self, ptr: NonNull<u8>, old_layout: Layout, new_layout: Layout, ) -> Result<NonNull<[u8]>, TargetAllocError>
Source§unsafe fn grow_zeroed(
&self,
ptr: NonNull<u8>,
old_layout: Layout,
new_layout: Layout,
) -> Result<NonNull<[u8]>, TargetAllocError>
unsafe fn grow_zeroed( &self, ptr: NonNull<u8>, old_layout: Layout, new_layout: Layout, ) -> Result<NonNull<[u8]>, TargetAllocError>
grow, but also ensures that the new contents are set to zero before being
returned. Read moreSource§unsafe fn shrink(
&self,
ptr: NonNull<u8>,
old_layout: Layout,
new_layout: Layout,
) -> Result<NonNull<[u8]>, TargetAllocError>
unsafe fn shrink( &self, ptr: NonNull<u8>, old_layout: Layout, new_layout: Layout, ) -> Result<NonNull<[u8]>, TargetAllocError>
Source§fn allocate_zeroed(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
fn allocate_zeroed(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
allocate, but also ensures that the returned memory is zero-initialized. Read moreSource§impl<A, S> Allocator for BumpScope<'_, A, S>
Available on crate feature allocator-api2-04 only.
impl<A, S> Allocator for BumpScope<'_, A, S>
allocator-api2-04 only.Source§fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, TargetAllocError>
fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, TargetAllocError>
Source§unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: Layout)
unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: Layout)
ptr. Read moreSource§unsafe fn grow(
&self,
ptr: NonNull<u8>,
old_layout: Layout,
new_layout: Layout,
) -> Result<NonNull<[u8]>, TargetAllocError>
unsafe fn grow( &self, ptr: NonNull<u8>, old_layout: Layout, new_layout: Layout, ) -> Result<NonNull<[u8]>, TargetAllocError>
Source§unsafe fn grow_zeroed(
&self,
ptr: NonNull<u8>,
old_layout: Layout,
new_layout: Layout,
) -> Result<NonNull<[u8]>, TargetAllocError>
unsafe fn grow_zeroed( &self, ptr: NonNull<u8>, old_layout: Layout, new_layout: Layout, ) -> Result<NonNull<[u8]>, TargetAllocError>
grow, but also ensures that the new contents are set to zero before being
returned. Read moreSource§unsafe fn shrink(
&self,
ptr: NonNull<u8>,
old_layout: Layout,
new_layout: Layout,
) -> Result<NonNull<[u8]>, TargetAllocError>
unsafe fn shrink( &self, ptr: NonNull<u8>, old_layout: Layout, new_layout: Layout, ) -> Result<NonNull<[u8]>, TargetAllocError>
Source§fn allocate_zeroed(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
fn allocate_zeroed(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
allocate, but also ensures that the returned memory is zero-initialized. Read moreSource§impl<A, S> BumpAllocator for BumpScope<'_, A, S>
impl<A, S> BumpAllocator for BumpScope<'_, A, S>
Source§fn as_scope(&self) -> &BumpScope<'_, Self::Allocator, Self::Settings>
fn as_scope(&self) -> &BumpScope<'_, Self::Allocator, Self::Settings>
&BumpScope.Source§fn as_mut_scope(
&mut self,
) -> &mut BumpScope<'_, Self::Allocator, Self::Settings>
fn as_mut_scope( &mut self, ) -> &mut BumpScope<'_, Self::Allocator, Self::Settings>
&mut BumpScope.Source§fn scope_guard(&mut self) -> BumpScopeGuard<'_, Self::Allocator, Self::Settings>
fn scope_guard(&mut self) -> BumpScopeGuard<'_, Self::Allocator, Self::Settings>
BumpScopeGuard. Read moreSource§fn scoped<R>(
&mut self,
f: impl FnOnce(&mut BumpScope<'_, Self::Allocator, Self::Settings>) -> R,
) -> R
fn scoped<R>( &mut self, f: impl FnOnce(&mut BumpScope<'_, Self::Allocator, Self::Settings>) -> R, ) -> R
f with a new child scope. Read moreSource§fn scoped_aligned<const NEW_MIN_ALIGN: usize, R>(
&mut self,
f: impl FnOnce(&mut BumpScope<'_, Self::Allocator, <Self::Settings as BumpAllocatorSettings>::WithMinimumAlignment<NEW_MIN_ALIGN>>) -> R,
) -> Rwhere
MinimumAlignment<NEW_MIN_ALIGN>: SupportedMinimumAlignment,
fn scoped_aligned<const NEW_MIN_ALIGN: usize, R>(
&mut self,
f: impl FnOnce(&mut BumpScope<'_, Self::Allocator, <Self::Settings as BumpAllocatorSettings>::WithMinimumAlignment<NEW_MIN_ALIGN>>) -> R,
) -> Rwhere
MinimumAlignment<NEW_MIN_ALIGN>: SupportedMinimumAlignment,
f with a new child scope of a new minimum alignment. Read moreSource§impl<A, S> BumpAllocatorCore for BumpScope<'_, A, S>
impl<A, S> BumpAllocatorCore for BumpScope<'_, A, S>
Source§fn any_stats(&self) -> AnyStats<'_>
fn any_stats(&self) -> AnyStats<'_>
Source§fn checkpoint(&self) -> Checkpoint
fn checkpoint(&self) -> Checkpoint
Source§unsafe fn reset_to(&self, checkpoint: Checkpoint)
unsafe fn reset_to(&self, checkpoint: Checkpoint)
Source§fn is_claimed(&self) -> bool
fn is_claimed(&self) -> bool
Source§fn prepare_allocation(
&self,
layout: Layout,
) -> Result<Range<NonNull<u8>>, AllocError>
fn prepare_allocation( &self, layout: Layout, ) -> Result<Range<NonNull<u8>>, AllocError>
layout.size(). Read moreSource§unsafe fn allocate_prepared(
&self,
layout: Layout,
range: Range<NonNull<u8>>,
) -> NonNull<u8>
unsafe fn allocate_prepared( &self, layout: Layout, range: Range<NonNull<u8>>, ) -> NonNull<u8>
prepare_allocation call. Read moreSource§fn prepare_allocation_rev(
&self,
layout: Layout,
) -> Result<Range<NonNull<u8>>, AllocError>
fn prepare_allocation_rev( &self, layout: Layout, ) -> Result<Range<NonNull<u8>>, AllocError>
layout.size(). Read moreSource§impl<'a, A, S> BumpAllocatorScope<'a> for BumpScope<'a, A, S>
impl<'a, A, S> BumpAllocatorScope<'a> for BumpScope<'a, A, S>
Source§fn claim(&self) -> BumpClaimGuard<'_, 'a, Self::Allocator, Self::Settings>
fn claim(&self) -> BumpClaimGuard<'_, 'a, Self::Allocator, Self::Settings>
Source§fn stats(&self) -> Stats<'a, Self::Allocator, Self::Settings>
fn stats(&self) -> Stats<'a, Self::Allocator, Self::Settings>
Source§fn aligned<const NEW_MIN_ALIGN: usize, R>(
&mut self,
f: impl FnOnce(&mut BumpScope<'a, Self::Allocator, <Self::Settings as BumpAllocatorSettings>::WithMinimumAlignment<NEW_MIN_ALIGN>>) -> R,
) -> Rwhere
MinimumAlignment<NEW_MIN_ALIGN>: SupportedMinimumAlignment,
fn aligned<const NEW_MIN_ALIGN: usize, R>(
&mut self,
f: impl FnOnce(&mut BumpScope<'a, Self::Allocator, <Self::Settings as BumpAllocatorSettings>::WithMinimumAlignment<NEW_MIN_ALIGN>>) -> R,
) -> Rwhere
MinimumAlignment<NEW_MIN_ALIGN>: SupportedMinimumAlignment,
f with this scope but with a new minimum alignment. Read moreSource§impl<A, S> BumpAllocatorTyped for BumpScope<'_, A, S>
impl<A, S> BumpAllocatorTyped for BumpScope<'_, A, S>
Source§type TypedStats<'b> = Stats<'b, A, S>
where
Self: 'b
type TypedStats<'b> = Stats<'b, A, S> where Self: 'b
Source§fn typed_stats(&self) -> Self::TypedStats<'_>
fn typed_stats(&self) -> Self::TypedStats<'_>
Source§fn try_allocate_layout(&self, layout: Layout) -> Result<NonNull<u8>, AllocError>
fn try_allocate_layout(&self, layout: Layout) -> Result<NonNull<u8>, AllocError>
Source§fn try_allocate_sized<T>(&self) -> Result<NonNull<T>, AllocError>
fn try_allocate_sized<T>(&self) -> Result<NonNull<T>, AllocError>
Source§fn allocate_slice<T>(&self, len: usize) -> NonNull<T>
fn allocate_slice<T>(&self, len: usize) -> NonNull<T>
Source§fn try_allocate_slice<T>(&self, len: usize) -> Result<NonNull<T>, AllocError>
fn try_allocate_slice<T>(&self, len: usize) -> Result<NonNull<T>, AllocError>
Source§fn allocate_slice_for<T>(&self, slice: &[T]) -> NonNull<T>
fn allocate_slice_for<T>(&self, slice: &[T]) -> NonNull<T>
Source§fn try_allocate_slice_for<T>(
&self,
slice: &[T],
) -> Result<NonNull<T>, AllocError>
fn try_allocate_slice_for<T>( &self, slice: &[T], ) -> Result<NonNull<T>, AllocError>
Source§unsafe fn shrink_slice<T>(
&self,
ptr: NonNull<T>,
old_len: usize,
new_len: usize,
) -> Option<NonNull<T>>
unsafe fn shrink_slice<T>( &self, ptr: NonNull<T>, old_len: usize, new_len: usize, ) -> Option<NonNull<T>>
Source§fn prepare_slice_allocation<T>(&self, len: usize) -> NonNull<[T]>
fn prepare_slice_allocation<T>(&self, len: usize) -> NonNull<[T]>
prepare_allocation. Read moreSource§fn try_prepare_slice_allocation<T>(
&self,
len: usize,
) -> Result<NonNull<[T]>, AllocError>
fn try_prepare_slice_allocation<T>( &self, len: usize, ) -> Result<NonNull<[T]>, AllocError>
prepare_allocation. Read moreSource§unsafe fn allocate_prepared_slice<T>(
&self,
start: NonNull<T>,
len: usize,
cap: usize,
) -> NonNull<[T]>
unsafe fn allocate_prepared_slice<T>( &self, start: NonNull<T>, len: usize, cap: usize, ) -> NonNull<[T]>
allocate_prepared. Read moreSource§fn prepare_slice_allocation_rev<T>(&self, len: usize) -> (NonNull<T>, usize)
fn prepare_slice_allocation_rev<T>(&self, len: usize) -> (NonNull<T>, usize)
prepare_allocation_rev. Read moreSource§fn try_prepare_slice_allocation_rev<T>(
&self,
len: usize,
) -> Result<(NonNull<T>, usize), AllocError>
fn try_prepare_slice_allocation_rev<T>( &self, len: usize, ) -> Result<(NonNull<T>, usize), AllocError>
prepare_allocation_rev. Read moreSource§unsafe fn allocate_prepared_slice_rev<T>(
&self,
end: NonNull<T>,
len: usize,
cap: usize,
) -> NonNull<[T]>
unsafe fn allocate_prepared_slice_rev<T>( &self, end: NonNull<T>, len: usize, cap: usize, ) -> NonNull<[T]>
allocate_prepared_rev. Read moreSource§fn reserve(&self, additional: usize)
fn reserve(&self, additional: usize)
additional more bytes to be bump allocated.
The bump allocator may reserve more space to avoid frequent reallocations.
After calling reserve, self.stats().remaining() will be greater than or equal to
additional. Does nothing if the capacity is already sufficient. Read moreSource§fn try_reserve(&self, additional: usize) -> Result<(), AllocError>
fn try_reserve(&self, additional: usize) -> Result<(), AllocError>
additional more bytes to be bump allocated.
The bump allocator may reserve more space to avoid frequent reallocations.
After calling reserve, self.stats().remaining() will be greater than or equal to
additional. Does nothing if the capacity is already sufficient. Read moreSource§impl<A, S> Debug for BumpScope<'_, A, S>where
S: BumpAllocatorSettings,
impl<A, S> Debug for BumpScope<'_, A, S>where
S: BumpAllocatorSettings,
impl<'a, A, S> BumpAllocatorCoreScope<'a> for BumpScope<'a, A, S>
impl<A, S> MutBumpAllocatorCore for BumpScope<'_, A, S>
impl<A, S> NoDrop for BumpScope<'_, A, S>where
S: BumpAllocatorSettings,
impl<A, S> RefUnwindSafe for BumpScope<'_, A, S>where
A: RefUnwindSafe,
S: BumpAllocatorSettings,
impl<A, S> UnwindSafe for BumpScope<'_, A, S>where
A: RefUnwindSafe,
S: BumpAllocatorSettings,
Auto Trait Implementations§
impl<'a, A = Global, S = BumpSettings> !Freeze for BumpScope<'a, A, S>
impl<'a, A = Global, S = BumpSettings> !Send for BumpScope<'a, A, S>
impl<'a, A = Global, S = BumpSettings> !Sync for BumpScope<'a, A, S>
impl<'a, A, S> Unpin for BumpScope<'a, A, S>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<'a, B> BumpAllocatorTypedScope<'a> for B
impl<'a, B> BumpAllocatorTypedScope<'a> for B
Source§fn try_alloc<T>(&self, value: T) -> Result<BumpBox<'a, T>, AllocError>
fn try_alloc<T>(&self, value: T) -> Result<BumpBox<'a, T>, AllocError>
Source§fn alloc_with<T>(&self, f: impl FnOnce() -> T) -> BumpBox<'a, T> ⓘ
fn alloc_with<T>(&self, f: impl FnOnce() -> T) -> BumpBox<'a, T> ⓘ
f to produce the
value to be put in that place. Read moreSource§fn try_alloc_with<T>(
&self,
f: impl FnOnce() -> T,
) -> Result<BumpBox<'a, T>, AllocError>
fn try_alloc_with<T>( &self, f: impl FnOnce() -> T, ) -> Result<BumpBox<'a, T>, AllocError>
f to produce the
value to be put in that place. Read moreSource§fn alloc_default<T: Default>(&self) -> BumpBox<'a, T> ⓘ
fn alloc_default<T: Default>(&self) -> BumpBox<'a, T> ⓘ
Source§fn try_alloc_default<T: Default>(&self) -> Result<BumpBox<'a, T>, AllocError>
fn try_alloc_default<T: Default>(&self) -> Result<BumpBox<'a, T>, AllocError>
Source§fn alloc_clone<T: CloneToUninit + ?Sized>(&self, value: &T) -> BumpBox<'a, T> ⓘ
fn alloc_clone<T: CloneToUninit + ?Sized>(&self, value: &T) -> BumpBox<'a, T> ⓘ
nightly-clone-to-uninit only.Source§fn try_alloc_clone<T: CloneToUninit + ?Sized>(
&self,
value: &T,
) -> Result<BumpBox<'a, T>, AllocError>
fn try_alloc_clone<T: CloneToUninit + ?Sized>( &self, value: &T, ) -> Result<BumpBox<'a, T>, AllocError>
nightly-clone-to-uninit only.Source§fn alloc_uninit<T>(&self) -> BumpBox<'a, MaybeUninit<T>> ⓘ
fn alloc_uninit<T>(&self) -> BumpBox<'a, MaybeUninit<T>> ⓘ
Source§fn try_alloc_uninit<T>(&self) -> Result<BumpBox<'a, MaybeUninit<T>>, AllocError>
fn try_alloc_uninit<T>(&self) -> Result<BumpBox<'a, MaybeUninit<T>>, AllocError>
Source§fn alloc_slice_move<T>(
&self,
slice: impl OwnedSlice<Item = T>,
) -> BumpBox<'a, [T]> ⓘ
fn alloc_slice_move<T>( &self, slice: impl OwnedSlice<Item = T>, ) -> BumpBox<'a, [T]> ⓘ
Source§fn try_alloc_slice_move<T>(
&self,
slice: impl OwnedSlice<Item = T>,
) -> Result<BumpBox<'a, [T]>, AllocError>
fn try_alloc_slice_move<T>( &self, slice: impl OwnedSlice<Item = T>, ) -> Result<BumpBox<'a, [T]>, AllocError>
Source§fn alloc_slice_copy<T: Copy>(&self, slice: &[T]) -> BumpBox<'a, [T]> ⓘ
fn alloc_slice_copy<T: Copy>(&self, slice: &[T]) -> BumpBox<'a, [T]> ⓘ
Copying elements from an existing slice. Read moreSource§fn try_alloc_slice_copy<T: Copy>(
&self,
slice: &[T],
) -> Result<BumpBox<'a, [T]>, AllocError>
fn try_alloc_slice_copy<T: Copy>( &self, slice: &[T], ) -> Result<BumpBox<'a, [T]>, AllocError>
Copying elements from an existing slice. Read moreSource§fn alloc_slice_clone<T: Clone>(&self, slice: &[T]) -> BumpBox<'a, [T]> ⓘ
fn alloc_slice_clone<T: Clone>(&self, slice: &[T]) -> BumpBox<'a, [T]> ⓘ
Cloneing elements from an existing slice. Read moreSource§fn try_alloc_slice_clone<T: Clone>(
&self,
slice: &[T],
) -> Result<BumpBox<'a, [T]>, AllocError>
fn try_alloc_slice_clone<T: Clone>( &self, slice: &[T], ) -> Result<BumpBox<'a, [T]>, AllocError>
Cloneing elements from an existing slice. Read moreSource§fn alloc_slice_fill<T: Clone>(&self, len: usize, value: T) -> BumpBox<'a, [T]> ⓘ
fn alloc_slice_fill<T: Clone>(&self, len: usize, value: T) -> BumpBox<'a, [T]> ⓘ
value. Read moreSource§fn try_alloc_slice_fill<T: Clone>(
&self,
len: usize,
value: T,
) -> Result<BumpBox<'a, [T]>, AllocError>
fn try_alloc_slice_fill<T: Clone>( &self, len: usize, value: T, ) -> Result<BumpBox<'a, [T]>, AllocError>
value. Read moreSource§fn alloc_slice_fill_with<T>(
&self,
len: usize,
f: impl FnMut() -> T,
) -> BumpBox<'a, [T]> ⓘ
fn alloc_slice_fill_with<T>( &self, len: usize, f: impl FnMut() -> T, ) -> BumpBox<'a, [T]> ⓘ
Source§fn try_alloc_slice_fill_with<T>(
&self,
len: usize,
f: impl FnMut() -> T,
) -> Result<BumpBox<'a, [T]>, AllocError>
fn try_alloc_slice_fill_with<T>( &self, len: usize, f: impl FnMut() -> T, ) -> Result<BumpBox<'a, [T]>, AllocError>
Source§fn alloc_uninit_slice<T>(&self, len: usize) -> BumpBox<'a, [MaybeUninit<T>]> ⓘ
fn alloc_uninit_slice<T>(&self, len: usize) -> BumpBox<'a, [MaybeUninit<T>]> ⓘ
Source§fn try_alloc_uninit_slice<T>(
&self,
len: usize,
) -> Result<BumpBox<'a, [MaybeUninit<T>]>, AllocError>
fn try_alloc_uninit_slice<T>( &self, len: usize, ) -> Result<BumpBox<'a, [MaybeUninit<T>]>, AllocError>
Source§fn alloc_uninit_slice_for<T>(
&self,
slice: &[T],
) -> BumpBox<'a, [MaybeUninit<T>]> ⓘ
fn alloc_uninit_slice_for<T>( &self, slice: &[T], ) -> BumpBox<'a, [MaybeUninit<T>]> ⓘ
Source§fn try_alloc_uninit_slice_for<T>(
&self,
slice: &[T],
) -> Result<BumpBox<'a, [MaybeUninit<T>]>, AllocError>
fn try_alloc_uninit_slice_for<T>( &self, slice: &[T], ) -> Result<BumpBox<'a, [MaybeUninit<T>]>, AllocError>
Source§fn try_alloc_str(&self, src: &str) -> Result<BumpBox<'a, str>, AllocError>
fn try_alloc_str(&self, src: &str) -> Result<BumpBox<'a, str>, AllocError>
str. Read moreSource§fn alloc_fmt(&self, args: Arguments<'_>) -> BumpBox<'a, str> ⓘ
fn alloc_fmt(&self, args: Arguments<'_>) -> BumpBox<'a, str> ⓘ
str from format arguments. Read moreSource§fn try_alloc_fmt(
&self,
args: Arguments<'_>,
) -> Result<BumpBox<'a, str>, AllocError>
fn try_alloc_fmt( &self, args: Arguments<'_>, ) -> Result<BumpBox<'a, str>, AllocError>
str from format arguments. Read moreSource§fn try_alloc_cstr(&self, src: &CStr) -> Result<&'a CStr, AllocError>
fn try_alloc_cstr(&self, src: &CStr) -> Result<&'a CStr, AllocError>
CStr. Read moreSource§fn try_alloc_cstr_from_str(&self, src: &str) -> Result<&'a CStr, AllocError>
fn try_alloc_cstr_from_str(&self, src: &str) -> Result<&'a CStr, AllocError>
Source§fn alloc_cstr_fmt(&self, args: Arguments<'_>) -> &'a CStr
fn alloc_cstr_fmt(&self, args: Arguments<'_>) -> &'a CStr
CStr from format arguments. Read moreSource§fn try_alloc_cstr_fmt(
&self,
args: Arguments<'_>,
) -> Result<&'a CStr, AllocError>
fn try_alloc_cstr_fmt( &self, args: Arguments<'_>, ) -> Result<&'a CStr, AllocError>
CStr from format arguments. Read moreSource§fn alloc_iter<T>(&self, iter: impl IntoIterator<Item = T>) -> BumpBox<'a, [T]> ⓘ
fn alloc_iter<T>(&self, iter: impl IntoIterator<Item = T>) -> BumpBox<'a, [T]> ⓘ
Source§fn try_alloc_iter<T>(
&self,
iter: impl IntoIterator<Item = T>,
) -> Result<BumpBox<'a, [T]>, AllocError>
fn try_alloc_iter<T>( &self, iter: impl IntoIterator<Item = T>, ) -> Result<BumpBox<'a, [T]>, AllocError>
Source§fn alloc_iter_exact<T, I>(
&self,
iter: impl IntoIterator<Item = T, IntoIter = I>,
) -> BumpBox<'a, [T]> ⓘwhere
I: ExactSizeIterator<Item = T>,
fn alloc_iter_exact<T, I>(
&self,
iter: impl IntoIterator<Item = T, IntoIter = I>,
) -> BumpBox<'a, [T]> ⓘwhere
I: ExactSizeIterator<Item = T>,
ExactSizeIterator into a slice. Read moreSource§fn try_alloc_iter_exact<T, I>(
&self,
iter: impl IntoIterator<Item = T, IntoIter = I>,
) -> Result<BumpBox<'a, [T]>, AllocError>where
I: ExactSizeIterator<Item = T>,
fn try_alloc_iter_exact<T, I>(
&self,
iter: impl IntoIterator<Item = T, IntoIter = I>,
) -> Result<BumpBox<'a, [T]>, AllocError>where
I: ExactSizeIterator<Item = T>,
ExactSizeIterator into a slice. Read moreSource§impl<'a, T> BumpAllocatorTypedScopeExt<'a> for Twhere
T: BumpAllocatorTypedScope<'a>,
impl<'a, T> BumpAllocatorTypedScopeExt<'a> for Twhere
T: BumpAllocatorTypedScope<'a>,
Source§fn alloc_zeroed<T>(&self) -> BumpBox<'a, T> ⓘwhere
T: Zeroable,
fn alloc_zeroed<T>(&self) -> BumpBox<'a, T> ⓘwhere
T: Zeroable,
Source§fn try_alloc_zeroed<T>(&self) -> Result<BumpBox<'a, T>, AllocError>where
T: Zeroable,
fn try_alloc_zeroed<T>(&self) -> Result<BumpBox<'a, T>, AllocError>where
T: Zeroable,
Source§fn alloc_zeroed_slice<T>(&self, len: usize) -> BumpBox<'a, [T]> ⓘwhere
T: Zeroable,
fn alloc_zeroed_slice<T>(&self, len: usize) -> BumpBox<'a, [T]> ⓘwhere
T: Zeroable,
Source§fn try_alloc_zeroed_slice<T>(
&self,
len: usize,
) -> Result<BumpBox<'a, [T]>, AllocError>where
T: Zeroable,
fn try_alloc_zeroed_slice<T>(
&self,
len: usize,
) -> Result<BumpBox<'a, [T]>, AllocError>where
T: Zeroable,
Source§impl<'a, T> BumpAllocatorTypedScopeExt<'a> for Twhere
T: BumpAllocatorTypedScope<'a>,
impl<'a, T> BumpAllocatorTypedScopeExt<'a> for Twhere
T: BumpAllocatorTypedScope<'a>,
Source§fn alloc_zeroed<T>(&self) -> BumpBox<'a, T> ⓘwhere
T: FromZeros,
fn alloc_zeroed<T>(&self) -> BumpBox<'a, T> ⓘwhere
T: FromZeros,
Source§fn try_alloc_zeroed<T>(&self) -> Result<BumpBox<'a, T>, AllocError>where
T: FromZeros,
fn try_alloc_zeroed<T>(&self) -> Result<BumpBox<'a, T>, AllocError>where
T: FromZeros,
Source§fn alloc_zeroed_slice<T>(&self, len: usize) -> BumpBox<'a, [T]> ⓘwhere
T: FromZeros,
fn alloc_zeroed_slice<T>(&self, len: usize) -> BumpBox<'a, [T]> ⓘwhere
T: FromZeros,
Source§fn try_alloc_zeroed_slice<T>(
&self,
len: usize,
) -> Result<BumpBox<'a, [T]>, AllocError>where
T: FromZeros,
fn try_alloc_zeroed_slice<T>(
&self,
len: usize,
) -> Result<BumpBox<'a, [T]>, AllocError>where
T: FromZeros,
Source§impl<'a, A> MutBumpAllocatorTypedScope<'a> for A
impl<'a, A> MutBumpAllocatorTypedScope<'a> for A
Source§fn alloc_iter_mut<T>(
&mut self,
iter: impl IntoIterator<Item = T>,
) -> BumpBox<'a, [T]> ⓘ
fn alloc_iter_mut<T>( &mut self, iter: impl IntoIterator<Item = T>, ) -> BumpBox<'a, [T]> ⓘ
Source§fn try_alloc_iter_mut<T>(
&mut self,
iter: impl IntoIterator<Item = T>,
) -> Result<BumpBox<'a, [T]>, AllocError>
fn try_alloc_iter_mut<T>( &mut self, iter: impl IntoIterator<Item = T>, ) -> Result<BumpBox<'a, [T]>, AllocError>
Source§fn alloc_iter_mut_rev<T>(
&mut self,
iter: impl IntoIterator<Item = T>,
) -> BumpBox<'a, [T]> ⓘ
fn alloc_iter_mut_rev<T>( &mut self, iter: impl IntoIterator<Item = T>, ) -> BumpBox<'a, [T]> ⓘ
Source§fn try_alloc_iter_mut_rev<T>(
&mut self,
iter: impl IntoIterator<Item = T>,
) -> Result<BumpBox<'a, [T]>, AllocError>
fn try_alloc_iter_mut_rev<T>( &mut self, iter: impl IntoIterator<Item = T>, ) -> Result<BumpBox<'a, [T]>, AllocError>
Source§fn alloc_fmt_mut(&mut self, args: Arguments<'_>) -> BumpBox<'a, str> ⓘ
fn alloc_fmt_mut(&mut self, args: Arguments<'_>) -> BumpBox<'a, str> ⓘ
str from format arguments. Read moreSource§fn try_alloc_fmt_mut(
&mut self,
args: Arguments<'_>,
) -> Result<BumpBox<'a, str>, AllocError>
fn try_alloc_fmt_mut( &mut self, args: Arguments<'_>, ) -> Result<BumpBox<'a, str>, AllocError>
str from format arguments. Read moreSource§fn alloc_cstr_fmt_mut(&mut self, args: Arguments<'_>) -> &'a CStr
fn alloc_cstr_fmt_mut(&mut self, args: Arguments<'_>) -> &'a CStr
CStr from format arguments. Read moreSource§fn try_alloc_cstr_fmt_mut(
&mut self,
args: Arguments<'_>,
) -> Result<&'a CStr, AllocError>
fn try_alloc_cstr_fmt_mut( &mut self, args: Arguments<'_>, ) -> Result<&'a CStr, AllocError>
CStr from format arguments. Read more