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

Tool for allocating additional memory regions in a process’s grant region.

This is optionally provided along with a grant so that if a capsule needs per-process dynamic allocation it can allocate additional memory.

Implementations

Allocates a new CustomGrant initialized using the given closure.

The closure will be called exactly once, and the result will be used to initialize the owned value.

This interface was chosen instead of a simple alloc(val) as it’s much more likely to optimize out all stack intermediates. This helps to prevent stack overflows when allocating large values.

Panic Safety

If init panics, the freshly allocated memory may leak.

Allocates a slice of n instances of a given type. Each instance is initialized using the provided function.

The provided function will be called exactly n times, and will be passed the index it’s initializing, from 0 through NUM_ITEMS - 1.

Panic Safety

If val_func panics, the freshly allocated memory and any values already written will be leaked.

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

Returns the argument unchanged.

Calls U::from(self).

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

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.