Struct fixed_bump::RcBump[][src]

pub struct RcBump<Size, Align = Size>(pub Rc<Bump<Size, Align>>);
Expand description

A wrapper around Rc<Bump>.

This type exists mainly so that Allocator can be implemented for it.

Tuple Fields

0: Rc<Bump<Size, Align>>

Implementations

Creates a new RcBump. This simply returns RcBump(Rc::new(Bump::new()).

Methods from Deref<Target = Bump<Size, Align>>

Tries to allocate memory with a size and alignment matching layout.

Returns a pointer to the memory on success, or None on failure. The memory is valid until the Bump is dropped. Note that the returned memory could be larger than layout.size().

This method is similar to Allocator::allocate, except it returns an Option instead of a Result.

Allocation is guaranteed to succeed, assuming the global allocator succeeds, if layout.size() is less than or equal to mem::size_of::<Size>() and layout.align() is less than or equal to mem::align_of::<Align>().

Allocation may fail, but is not guaranteed to fail, if layout.align() is greater than mem::align_of::<Align>(). Allocation is guaranteed to fail if layout.size() is greater than mem::size_of::<Size>().

Allocates a value of type T.

The memory is initialized with value and a reference to the value is returned. Note that the value’s destructor will not be called automatically.

Panics

Panics if Self::allocate is not able to allocate memory matching Layout::new::<T>(). See Self::allocate for details regarding the circumstances in which allocation can fail.

For a non-panicking equivalent, see Self::try_alloc_value.

Tries to allocate a value of type T.

If the allocation succeeds, the memory is initialized with value and a reference to the value is returned. Note that the value’s destructor will not be called automatically.

Allocation succeeds if and only if Self::allocate is able to allocate memory matching Layout::new::<T>(). See Self::allocate for details regarding the circumstances in which allocation can fail.

Errors

If allocation fails, Err(value) is returned.

Trait Implementations

🔬 This is a nightly-only experimental API. (allocator_api)

Attempts to allocate a block of memory. Read more

🔬 This is a nightly-only experimental API. (allocator_api)

Deallocates the memory referenced by ptr. Read more

🔬 This is a nightly-only experimental API. (allocator_api)

Behaves like allocate, but also ensures that the returned memory is zero-initialized. Read more

🔬 This is a nightly-only experimental API. (allocator_api)

Attempts to extend the memory block. Read more

🔬 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 more

🔬 This is a nightly-only experimental API. (allocator_api)

Attempts to shrink the memory block. Read more

🔬 This is a nightly-only experimental API. (allocator_api)

Creates a “by reference” adapter for this instance of Allocator. Read more

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Returns the “default value” for a type. Read more

The resulting type after dereferencing.

Dereferences the value.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.