Skip to main content

BumpAllocatorSettings

Trait BumpAllocatorSettings 

Source
pub trait BumpAllocatorSettings: Sealed {
Show 20 associated items type MinimumAlignment: SupportedMinimumAlignment; type Up: Boolean; type GuaranteedAllocated: Boolean; type Claimable: Boolean; type Deallocates: Boolean; type Shrinks: Boolean; type WithMinimumAlignment<const NEW_MIN_ALIGN: usize>: BumpAllocatorSettings<MinimumAlignment = MinimumAlignment<NEW_MIN_ALIGN>, Up = Self::Up, GuaranteedAllocated = Self::GuaranteedAllocated, Claimable = Self::Claimable, Deallocates = Self::Deallocates, Shrinks = Self::Shrinks> where MinimumAlignment<NEW_MIN_ALIGN>: SupportedMinimumAlignment; type WithUp<const VALUE: bool>: BumpAllocatorSettings<MinimumAlignment = Self::MinimumAlignment, Up = Bool<VALUE>, GuaranteedAllocated = Self::GuaranteedAllocated, Claimable = Self::Claimable, Deallocates = Self::Deallocates, Shrinks = Self::Shrinks>; type WithGuaranteedAllocated<const VALUE: bool>: BumpAllocatorSettings<MinimumAlignment = Self::MinimumAlignment, Up = Self::Up, GuaranteedAllocated = Bool<VALUE>, Claimable = Self::Claimable, Deallocates = Self::Deallocates, Shrinks = Self::Shrinks>; type WithClaimable<const VALUE: bool>: BumpAllocatorSettings<MinimumAlignment = Self::MinimumAlignment, Up = Self::Up, GuaranteedAllocated = Self::GuaranteedAllocated, Claimable = Bool<VALUE>, Deallocates = Self::Deallocates, Shrinks = Self::Shrinks>; type WithDeallocates<const VALUE: bool>: BumpAllocatorSettings<MinimumAlignment = Self::MinimumAlignment, Up = Self::Up, GuaranteedAllocated = Self::GuaranteedAllocated, Claimable = Self::Claimable, Deallocates = Bool<VALUE>, Shrinks = Self::Shrinks>; type WithShrinks<const VALUE: bool>: BumpAllocatorSettings<MinimumAlignment = Self::MinimumAlignment, Up = Self::Up, GuaranteedAllocated = Self::GuaranteedAllocated, Claimable = Self::Claimable, Deallocates = Self::Deallocates, Shrinks = Bool<VALUE>>; type WithMinimumChunkSize<const VALUE: usize>: BumpAllocatorSettings<MinimumAlignment = Self::MinimumAlignment, Up = Self::Up, GuaranteedAllocated = Self::GuaranteedAllocated, Claimable = Self::Claimable, Deallocates = Self::Deallocates, Shrinks = Self::Shrinks>; const MINIMUM_CHUNK_SIZE: usize; const MIN_ALIGN: usize = <Self::MinimumAlignment>::VALUE; const UP: bool = <Self::Up>::VALUE; const GUARANTEED_ALLOCATED: bool = <Self::GuaranteedAllocated>::VALUE; const CLAIMABLE: bool = <Self::Claimable>::VALUE; const DEALLOCATES: bool = <Self::Deallocates>::VALUE; const SHRINKS: bool = <Self::Shrinks>::VALUE;
}
Expand description

The trait powering bump allocator configuration.

Read the module documentation to learn about the settings.

The setting values are provided as associated constants.

Additionally they are provided as types so they can be used in equality bounds like this:

S: BumpAllocatorSettings<GuaranteedAllocated = True>

Doing the same with associated constants is not (yet) possible:

// won't compile on stable
S: BumpAllocatorSettings<GUARANTEED_ALLOCATED = true>

In the future this trait could be simplified when the following features are stabilized:

Required Associated Constants§

Source

const MINIMUM_CHUNK_SIZE: usize

The minimum size for bump allocation chunk.

Provided Associated Constants§

Source

const MIN_ALIGN: usize = <Self::MinimumAlignment>::VALUE

The minimum alignment.

Source

const UP: bool = <Self::Up>::VALUE

The bump direction.

Source

const GUARANTEED_ALLOCATED: bool = <Self::GuaranteedAllocated>::VALUE

Whether the allocator is guaranteed to have a chunk allocated and thus is allowed to create scopes.

Source

const CLAIMABLE: bool = <Self::Claimable>::VALUE

Whether the allocator can be claimed.

Source

const DEALLOCATES: bool = <Self::Deallocates>::VALUE

Whether the allocator tries to free allocations.

Source

const SHRINKS: bool = <Self::Shrinks>::VALUE

Whether the allocator tries to shrink allocations.

Required Associated Types§

Source

type MinimumAlignment: SupportedMinimumAlignment

The minimum alignment.

Source

type Up: Boolean

The bump direction.

Source

type GuaranteedAllocated: Boolean

Whether the allocator is guaranteed to have a chunk allocated and thus is allowed to create scopes.

Source

type Claimable: Boolean

Whether the allocator can be claimed.

Source

type Deallocates: Boolean

Whether the allocator tries to free allocations.

Source

type Shrinks: Boolean

Whether the allocator tries to shrink allocations.

Source

type WithMinimumAlignment<const NEW_MIN_ALIGN: usize>: BumpAllocatorSettings<MinimumAlignment = MinimumAlignment<NEW_MIN_ALIGN>, Up = Self::Up, GuaranteedAllocated = Self::GuaranteedAllocated, Claimable = Self::Claimable, Deallocates = Self::Deallocates, Shrinks = Self::Shrinks> where MinimumAlignment<NEW_MIN_ALIGN>: SupportedMinimumAlignment

Changes the minimum alignment.

Source

type WithUp<const VALUE: bool>: BumpAllocatorSettings<MinimumAlignment = Self::MinimumAlignment, Up = Bool<VALUE>, GuaranteedAllocated = Self::GuaranteedAllocated, Claimable = Self::Claimable, Deallocates = Self::Deallocates, Shrinks = Self::Shrinks>

Changes the bump direction.

Source

type WithGuaranteedAllocated<const VALUE: bool>: BumpAllocatorSettings<MinimumAlignment = Self::MinimumAlignment, Up = Self::Up, GuaranteedAllocated = Bool<VALUE>, Claimable = Self::Claimable, Deallocates = Self::Deallocates, Shrinks = Self::Shrinks>

Changes whether the allocator is guaranteed to have a chunk allocated and thus is allowed to create scopes.

Source

type WithClaimable<const VALUE: bool>: BumpAllocatorSettings<MinimumAlignment = Self::MinimumAlignment, Up = Self::Up, GuaranteedAllocated = Self::GuaranteedAllocated, Claimable = Bool<VALUE>, Deallocates = Self::Deallocates, Shrinks = Self::Shrinks>

Changes whether the allocator can be claimed.

Source

type WithDeallocates<const VALUE: bool>: BumpAllocatorSettings<MinimumAlignment = Self::MinimumAlignment, Up = Self::Up, GuaranteedAllocated = Self::GuaranteedAllocated, Claimable = Self::Claimable, Deallocates = Bool<VALUE>, Shrinks = Self::Shrinks>

Changes whether the allocator tries to free allocations.

Source

type WithShrinks<const VALUE: bool>: BumpAllocatorSettings<MinimumAlignment = Self::MinimumAlignment, Up = Self::Up, GuaranteedAllocated = Self::GuaranteedAllocated, Claimable = Self::Claimable, Deallocates = Self::Deallocates, Shrinks = Bool<VALUE>>

Changes whether the allocator tries to shrink allocations.

Source

type WithMinimumChunkSize<const VALUE: usize>: BumpAllocatorSettings<MinimumAlignment = Self::MinimumAlignment, Up = Self::Up, GuaranteedAllocated = Self::GuaranteedAllocated, Claimable = Self::Claimable, Deallocates = Self::Deallocates, Shrinks = Self::Shrinks>

Changes the minimum chunk size.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<const MIN_ALIGN: usize, const UP: bool, const GUARANTEED_ALLOCATED: bool, const CLAIMABLE: bool, const DEALLOCATES: bool, const SHRINKS: bool, const MINIMUM_CHUNK_SIZE: usize> BumpAllocatorSettings for BumpSettings<MIN_ALIGN, UP, GUARANTEED_ALLOCATED, CLAIMABLE, DEALLOCATES, SHRINKS, MINIMUM_CHUNK_SIZE>

Source§

const MINIMUM_CHUNK_SIZE: usize = MINIMUM_CHUNK_SIZE

Source§

type MinimumAlignment = MinimumAlignment<MIN_ALIGN>

Source§

type Up = Bool<UP>

Source§

type GuaranteedAllocated = Bool<GUARANTEED_ALLOCATED>

Source§

type Claimable = Bool<CLAIMABLE>

Source§

type Deallocates = Bool<DEALLOCATES>

Source§

type Shrinks = Bool<SHRINKS>

Source§

type WithMinimumAlignment<const VALUE: usize> = BumpSettings<VALUE, UP, GUARANTEED_ALLOCATED, CLAIMABLE, DEALLOCATES, SHRINKS, MINIMUM_CHUNK_SIZE> where MinimumAlignment<VALUE>: SupportedMinimumAlignment

Source§

type WithUp<const VALUE: bool> = BumpSettings<MIN_ALIGN, VALUE, GUARANTEED_ALLOCATED, CLAIMABLE, DEALLOCATES, SHRINKS, MINIMUM_CHUNK_SIZE>

Source§

type WithGuaranteedAllocated<const VALUE: bool> = BumpSettings<MIN_ALIGN, UP, VALUE, CLAIMABLE, DEALLOCATES, SHRINKS, MINIMUM_CHUNK_SIZE>

Source§

type WithClaimable<const VALUE: bool> = BumpSettings<MIN_ALIGN, UP, GUARANTEED_ALLOCATED, VALUE, DEALLOCATES, SHRINKS, MINIMUM_CHUNK_SIZE>

Source§

type WithDeallocates<const VALUE: bool> = BumpSettings<MIN_ALIGN, UP, GUARANTEED_ALLOCATED, CLAIMABLE, VALUE, SHRINKS, MINIMUM_CHUNK_SIZE>

Source§

type WithShrinks<const VALUE: bool> = BumpSettings<MIN_ALIGN, UP, GUARANTEED_ALLOCATED, CLAIMABLE, DEALLOCATES, VALUE, MINIMUM_CHUNK_SIZE>

Source§

type WithMinimumChunkSize<const VALUE: usize> = BumpSettings<MIN_ALIGN, UP, GUARANTEED_ALLOCATED, CLAIMABLE, DEALLOCATES, SHRINKS, VALUE>