Swift Collections 1.3.0
This feature release supports Swift toolchain versions 6.0, 6.1 and 6.2, and it includes the following improvements:
BasicContainers module
This new module collects ownership-aware, low-level variants of existing data structures in the core standard library. In this release, this module consists of two array variants, UniqueArray and RigidArray.
These new types are provided as less flexible, noncopyable alternatives to the classic Array type. The standard Array implements value semantics with the copy-on-write optimization; this inherently requires elements to be copyable, and it is itself copyable.
struct UniqueArray<Element> is a noncopyable array variant that takes away Array's copy-on-write behavior, enabling support for noncopyable elements. This type's noncopyability means mutations can always assume that the array is uniquely owned, with no shared copies (hence the name!). This means that array mutations such as mutating an element at an index can behave much more predictably, with no unexpected performance spikes due to having to copy shared storage.
struct RigidArray<Element> goes even further, by also disabling dynamic resizing. Rigid arrays have a fixed capacity: they are initialized with room for a particular number of elements, and they never implicitly grow (nor shrink) their storage. When a rigid array's count reaches its capacity, it becomes unable to add any new items -- inserting into a full array is considered a programming error. This makes this a quite inflexible (or rigid) type indeed, as avoiding storage overflow requires careful, up front planning on the resource needs of the task at hand. In exchange, rigid arrays can have extremely predictable performance characteristics.
UniqueArray is a great default choice when a task just needs an array type that is able store noncopyable elements. RigidArray is best reserved for use cases that require absolute, pedantic control over memory use or latency -- such as control software running in environments with extremely limited memory, or when a certain task must always be completed in some given amount of time.
The Unique and Rigid prefixes applied here establish a general naming convention for low-level variants of the classic copy-on-write data structure implementations. Future releases are expected to flesh out our zoo of container types by adding Unique and Rigid variants of the existing Set, Dictionary, Deque, Heap and other constructs, with type names such as as RigidDictionary and UniqueDeque.
TrailingElementsModule module
This new module ships a new TrailingArray construct, a preview of a new low-level, ownership-aware variant of ManagedBuffer. This is primarily intended as a interoperability helper for C constructs that consist of a fixed-size header directly followed by variable-size storage buffer.
ContainersPreview module
This module is intended to contain previews of an upcoming ownership-aware container model. In this initial release, this module consists of just one construct: struct Box<T>.
Box is a wrapper type that forms a noncopyable, heap allocated box around an arbitrary value.
What's Changed
- Merge release/1.1 to main by @lorentey in https://github.com/apple/swift-collections/pull/204
- Merge relase/1.1 to main, without taking any changes by @lorentey in https://github.com/apple/swift-collections/pull/206
- [Heap] Add methods to replace minimum/maximum (redux) by @lorentey in https://github.com/apple/swift-collections/pull/208
- Persistent collections updates (part 10) by @lorentey in https://github.com/apple/swift-collections/pull/207
- Update CMakeLists.txt by @compnerd in https://github.com/apple/swift-collections/pull/215
- Merge latest changes from release/1.1 to main by @lorentey in https://github.com/apple/swift-collections/pull/220
- Merge branch release/1.1 to main by @lorentey in https://github.com/apple/swift-collections/pull/231
- [SortedCollections] Disable tests with @testable imports in release builds by @lorentey in https://github.com/apple/swift-collections/pull/232
- [Hashtable] Minor Documentation Fix (Typo) by @nickkohrn in https://github.com/apple/swift-collections/pull/241
- Merge branch
release/1.1tomainby @lorentey in https://github.com/apple/swift-collections/pull/248 - Update README.md by @glessard in https://github.com/apple/swift-collections/pull/251
- [OrderedDictionary] Explicitly mention in documentation that keys/values are ordered by @warpling in https://github.com/apple/swift-collections/pull/254
- build: support ARM64 spelling by @compnerd in https://github.com/apple/swift-collections/pull/282
- Merge release/1.1 to main by @lorentey in https://github.com/apple/swift-collections/pull/284
- Update release checklist by @lorentey in https://github.com/apple/swift-collections/pull/323
- build: update the build rules for adjusted tree layout by @compnerd in https://github.com/apple/swift-collections/pull/331
- build: support using swift-collections in larger projects by @compnerd in https://github.com/apple/swift-collections/pull/330
- Merge release/1.1 to main by @lorentey in https://github.com/apple/swift-collections/pull/332
- build: support building in Debug mode on Windows by @compnerd in https://github.com/apple/swift-collections/pull/333
- Bugfix Incorrect Assert in BTree.removeFirst/removeLast by @LeoNavel in https://github.com/apple/swift-collections/pull/349
- Fix typos by @rex4539 in https://github.com/apple/swift-collections/pull/356
- Merge branch
release/1.1tomainby @lorentey in https://github.com/apple/swift-collections/pull/358 - Merge.1.1→main by @lorentey in https://github.com/apple/swift-collections/pull/361
- Add post-merge CI support by @shahmishal in https://github.com/apple/swift-collections/pull/367
New Contributors
- @nickkohrn made their first contribution in https://github.com/apple/swift-collections/pull/241
- @warpling made their first contribution in https://github.com/apple/swift-collections/pull/254
- @LeoNavel made their first contribution in https://github.com/apple/swift-collections/pull/349
- @rex4539 made their first contribution in https://github.com/apple/swift-collections/pull/356
- @Gyuni made their first contribution in https://github.com/apple/swift-collections/pull/445
- @pm-dev made their first contribution in https://github.com/apple/swift-collections/pull/452
- @DakshinD made their first contribution in https://github.com/apple/swift-collections/pull/455
- @ozumin made their first contribution in https://github.com/apple/swift-collections/pull/478
- @azarovalex made their first contribution in https://github.com/apple/swift-collections/pull/490
- @natecook1000 made their first contribution in https://github.com/apple/swift-collections/pull/493
- @parkera made their first contribution in https://github.com/apple/swift-collections/pull/494
- @t089 made their first contribution in https://github.com/apple/swift-collections/pull/503
- @brianchang928 made their first contribution in https://github.com/apple/swift-collections/pull/502
- @faimin made their first contribution in https://github.com/apple/swift-collections/pull/501
- @MaxDesiatov made their first contribution in https://github.com/apple/swift-collections/pull/509
- @DougGregor made their first contribution in https://github.com/apple/swift-collections/pull/513
Full Changelog: https://github.com/apple/swift-collections/compare/1.2.1...1.3.0