Struct SwiftBucketState<T>
- Namespace
- SwiftCollections
- Assembly
- SwiftCollections.dll
Represents the state of a bucket in a fast allocation pool, including the items, allocation status, free indices, and peak usage count.
[MemoryPackable(GenerateType.Object)]
public readonly struct SwiftBucketState<T> : IMemoryPackable<SwiftBucketState<T>>, IMemoryPackFormatterRegister
Type Parameters
TThe type of items stored in the bucket.
- Implements
-
IMemoryPackable<SwiftBucketState<T>>IMemoryPackFormatterRegister
- Inherited Members
Remarks
This struct is typically used to capture or transfer the current state of a bucket-based memory pool. It provides direct access to the underlying arrays representing the items, their allocation status, and the indices of free slots. The struct is serializable and designed for efficient state management in high-performance scenarios.
Constructors
SwiftBucketState(T[], bool[], int[], int)
Initializes a new instance of the SwiftBucketState class with the specified items, allocation states, free indices, and peak count.
[JsonConstructor]
[MemoryPackConstructor]
public SwiftBucketState(T[] items, bool[] allocated, int[] freeIndices, int peakCount)
Parameters
itemsT[]The array of items contained in the bucket. Cannot be null; an empty array is used if null is provided.
allocatedbool[]An array indicating which items in the bucket are currently allocated. Cannot be null; an empty array is used if null is provided.
freeIndicesint[]An array of indices representing the positions of free items in the bucket. Cannot be null; an empty array is used if null is provided.
peakCountintThe highest number of items that have been allocated in the bucket at any point.
Fields
Allocated
Indicates which items in the collection are currently allocated.
[JsonInclude]
[MemoryPackInclude]
public readonly bool[] Allocated
Field Value
- bool[]
FreeIndices
Gets the collection of indices that are currently available for allocation.
[JsonInclude]
[MemoryPackInclude]
public readonly int[] FreeIndices
Field Value
- int[]
Items
Gets the array of items contained in the collection.
[JsonInclude]
[MemoryPackInclude]
public readonly T[] Items
Field Value
- T[]
PeakCount
Gets the maximum number of peaks detected or recorded.
[JsonInclude]
[MemoryPackInclude]
public readonly int PeakCount