[BasicContainers] RigidArray, UniqueArray: “precisely once” → “at most once”

Loosen guarantees about how many times closure arguments are getting called, so that e.g. insertions of zero items do not necessarily need to call their callback with an empty OutputSpan.

(For these array types we can reinstate the guarantee later, if it turns out to be important/useful. However, the generalized primitives will need to allow their callbacks to get called an arbitrary number of times, and it seems useful to establish that (at least partially) with these simple array types too.)
This commit is contained in:
Karoy Lorentey committed 2026-02-04 10:09:00 -08:00
1 parent 99da8a72e0
commit b768d22393
11 files changed
+18 -14

No files matched your search

@@ -45,7 +45,7 @@ extension UniqueArray where Element: ~Copyable {
///
/// - Parameters
/// - count: The number of items to append to the array.
/// - body: A callback that gets called precisely once to directly
/// - body: A callback that gets called at most once to directly
/// populate newly reserved storage within the array. The function
/// is allowed to initialize fewer than `count` items. The array is
/// appended however many items the callback adds to the output span