← Standard library

FixedList

sealed class FixedList<T>
import FixedList from Wax;

An initially empty sequence with fixed allocated capacity, constructed as new FixedList<T>(capacity). Add grows its live prefix but cannot reallocate: exceeding capacity panics. Use List<T> when automatic growth is needed. Views cover only live elements and share storage; ToArray copies them.

FixedList.wax:27

Inherits from object. Follow these links for inherited members.

Members

sizefield

public native readonly int32 size

The number of live elements; valid element indices are [0, size). Capacity is not part of the readable range.

FixedList.wax:39

thisindexer-getter

public get this(int32 index) : T

Reads or replaces a live element at a zero-based index. An index outside [0, size) panics. Replacing an element does not change the collection size.

FixedList.wax:57

thisindexer-setter

public set this(int32 index, T value) : void

Reads or replaces a live element at a zero-based index. An index outside [0, size) panics. Replacing an element does not change the collection size.

FixedList.wax:62

Addmethod

public fn Add(T value) : void

Appends one value, increasing size. Panics when no capacity remains.

FixedList.wax:71

Truncatemethod

public fn Truncate(int32 newSize) : void

Shrinks the live prefix to newSize, which must be between zero and the current size. It cannot grow the list and retains allocated capacity.

FixedList.wax:81

ToSpanmethod

public fn ToSpan() : Span<T>

Borrows a mutable view of the current live elements without copying. The view has a fixed length. Writes affect shared storage; it does not follow a later collection reallocation.

FixedList.wax:95

ToWriteOnlySpanmethod

public fn ToWriteOnlySpan() : WriteOnlySpan<T>

Borrows a write-only view of the live element range without copying. Writes change the backing storage; the view itself cannot read values.

FixedList.wax:101

ToReadOnlySpanmethod

public fn ToReadOnlySpan() : ReadOnlySpan<T>

Borrows the current live elements without copying or permitting writes through this view. Other aliases can still mutate the storage; the view does not follow a later reallocation.

FixedList.wax:109

Slicemethod

public fn Slice(int32 start, int32 len) : Span<T>

Borrows a mutable window [start, start + len). Negative arguments or a range outside the live elements panic. An empty slice at size is valid.

FixedList.wax:117

ToArraymethod

public fn ToArray() : T[]

Copies the live elements into a separate dense array. Reference elements retain their object identities; the objects are not cloned.

FixedList.wax:129

AddRangemethod

public fn AddRange(scoped ReadOnlySpan<T> items) : void

Appends the source elements in order. Enough unused capacity must be available or the operation panics; do not rely on rollback of earlier appends on failure.

FixedList.wax:149

Clearmethod

public fn Clear() : void

Removes all live elements while keeping allocated capacity.

FixedList.wax:167

RemoveLastmethod

public fn RemoveLast() : void

Removes the last live element. Panics if the list is empty.

FixedList.wax:175

RemoveRangemethod

public fn RemoveRange(int32 index, int32 count) : void

Removes a nonnegative count at an in-bounds index and shifts the surviving tail left. A zero-length range at size is valid; invalid ranges panic.

FixedList.wax:190

constructorconstructor

public constructor (int32 capacity = 0)

Provided by the compiler.