← Standard library

WriteOnlySpan

scoped struct WriteOnlySpan<T>
import WriteOnlySpan from Wax;

A scoped, borrowed window that allows writes but exposes no element reads. It can cover unassigned lateinit slots. A slice shares storage; its writes initialize only that window. Prove a late array fully assigned with AllAssigned or AsArray before treating it as dense.

WriteOnlySpan.wax:8

Members

lengthfield

public native int32 length

The number of elements in the borrowed window.

WriteOnlySpan.wax:15

sizegetter

public get size() : int32

The number of elements, equal to length.

WriteOnlySpan.wax:20

thisindexer-setter

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

Writes an in-range zero-based element. Out-of-range indices panic. No corresponding getter exists.

WriteOnlySpan.wax:26

Slicemethod

public fn Slice(int32 sliceStart, int32 len) : WriteOnlySpan<T>

Borrows a subwindow. Negative arguments or an endpoint outside [0, length] panic; an empty slice at the end is valid.

WriteOnlySpan.wax:34

Fillmethod

public fn Fill(T value) : void

Assigns every element of the window. Empty views do nothing; references are copied without cloning their objects.

WriteOnlySpan.wax:49

CopyFrommethod

public fn CopyFrom(ReadOnlySpan<T> source) : void where T is blittable

Copies the shorter of the source and destination lengths in increasing index order. The remaining destination is unchanged. Overlapping ranges are not treated as a snapshot: earlier writes can affect later reads.

WriteOnlySpan.wax:61

ToStringmethod

public fn ToString() : string

Provided by the compiler.

ToStringBuffermethod

public fn ToStringBuffer(StringBuilder builder) : int32

Provided by the compiler.