array

A growable, copy-on-write sequence with value semantics.

API Reference

Structs

struct Array<Element>

A growable, copy-on-write sequence with value semantics.

struct ArrayIntoIterator<T>

An iterator over array into values. A consuming array iterator that moves elements out in index order.

struct ArrayMutIterator<T>

An iterator over array mut values. An exclusive iterator over a uniquely owned array buffer.

struct DropToken

The exactly-once gate for Deinit hooks (ADR 0060). Implicit sharing duplicates values by retain, and a hook runs once per copy; a hook that must act exactly once per LOGICAL value carries a token and gates on is_last() — the copy that sees owner count 1 is the last one standing, wherever it drops. A fresh token is a fresh logical identity: clone-like operations construct a new one, compiler-made copies share it.

Functions

func _storage_is_unique<T>(xs: [T]) -> Bool

Whether this array's buffer has exactly one owner. Implicit sharing duplicates values by retain at value boundaries, so a Deinit hook runs once per copy; a hook that must act exactly once per logical value (core containers' teardown, stdlib channel endpoints) gates on the owner count of a carried buffer, and this is that gate.

func _drop_token() -> DropToken

Creates a fresh identity used to elect one logical finalizer among retained copies.