pub struct FreeingBumpHeapAllocator { /* private fields */ }
Expand description

An implementation of freeing bump allocator.

Refer to the module-level documentation for further details.

Implementations§

Creates a new allocation heap which follows a freeing-bump strategy.

Arguments
  • heap_base - the offset from the beginning of the linear memory where the heap starts.

Gets requested number of bytes to allocate and returns a pointer. The maximum size which can be allocated at once is 32 MiB. There is no minimum size, but whatever size is passed into this function is rounded to the next power of two. If the requested size is below 8 bytes it will be rounded up to 8 bytes.

The identity or the type of the passed memory object does not matter. However, the size of memory cannot shrink compared to the memory passed in previous invocations.

NOTE: Once the allocator has returned an error all subsequent requests will return an error.

Arguments
  • mem - a slice representing the linear memory on which this allocator operates.
  • size - size in bytes of the allocation request

Deallocates the space which was allocated for a pointer.

The identity or the type of the passed memory object does not matter. However, the size of memory cannot shrink compared to the memory passed in previous invocations.

NOTE: Once the allocator has returned an error all subsequent requests will return an error.

Arguments
  • mem - a slice representing the linear memory on which this allocator operates.
  • ptr - pointer to the allocated chunk

Returns the allocation stats for this allocator.

Trait Implementations§

Executes the destructor for this type. Read more

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
Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Get a reference to the inner from the outer.

Get a mutable reference to the inner from the outer.

Should always be Self
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.
The counterpart to unchecked_from.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more