Struct bump_scope::WithLifetime
source · pub struct WithLifetime<'a, A> { /* private fields */ }
Expand description
Associates a lifetime to a wrapped type.
This is used for BumpBox::into_box
to attach a lifetime to the Box
.
Implementations§
source§impl<'a, A> WithLifetime<'a, A>
impl<'a, A> WithLifetime<'a, A>
pub fn new(inner: A) -> Self
pub fn into_inner(self) -> A
Trait Implementations§
source§impl<'a, A: Allocator> Allocator for WithLifetime<'a, A>
impl<'a, A: Allocator> Allocator for WithLifetime<'a, A>
source§fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
🔬This is a nightly-only experimental API. (
allocator_api
)Attempts to allocate a block of memory. Read more
source§fn allocate_zeroed(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
fn allocate_zeroed(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
🔬This is a nightly-only experimental API. (
allocator_api
)Behaves like
allocate
, but also ensures that the returned memory is zero-initialized. Read moresource§unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: Layout)
unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: Layout)
🔬This is a nightly-only experimental API. (
allocator_api
)Deallocates the memory referenced by
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>
🔬This is a nightly-only experimental API. (
allocator_api
)Attempts to extend the memory block. Read more
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>
🔬This is a nightly-only experimental API. (
allocator_api
)Behaves like
grow
, but also ensures that the new contents are set to zero before being
returned. Read moresource§impl<'a, A: Clone> Clone for WithLifetime<'a, A>
impl<'a, A: Clone> Clone for WithLifetime<'a, A>
source§fn clone(&self) -> WithLifetime<'a, A>
fn clone(&self) -> WithLifetime<'a, A>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl<'a, A> Freeze for WithLifetime<'a, A>where
A: Freeze,
impl<'a, A> RefUnwindSafe for WithLifetime<'a, A>where
A: RefUnwindSafe,
impl<'a, A> Send for WithLifetime<'a, A>where
A: Send,
impl<'a, A> Sync for WithLifetime<'a, A>where
A: Sync,
impl<'a, A> Unpin for WithLifetime<'a, A>where
A: Unpin,
impl<'a, A> !UnwindSafe for WithLifetime<'a, A>
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
Mutably borrows from an owned value. Read more