Update MutableContainer

- Add `nextMutableSpan(after:)` and `nextMutableSpan(after:maxCount:limitedBy)`, replacing `nextMutableSpan(after:maxCount:)` as the core access primitives
- Add `previousMutableSpan` default algorithms on bidirectional mutable containers
This commit is contained in:
Karoy Lorentey committed 2026-07-20 15:44:35 -07:00
1 parent ef0fba7f7f
commit e75f053e46
12 files changed
+350 -192

No files matched your search

@@ -403,9 +403,9 @@ extension UniqueArray where Element: ~Copyable {
@inlinable
@_lifetime(&self)
public mutating func nextMutableSpan(
after index: inout Int, maxCount: Int
after index: inout Int, maxCount: Int, limitedBy limit: Int
) -> MutableSpan<Element> {
_storage.nextMutableSpan(after: &index, maxCount: maxCount)
_storage.nextMutableSpan(after: &index, maxCount: maxCount, limitedBy: limit)
}
@_alwaysEmitIntoClient
@@ -33,7 +33,10 @@ extension UniqueArray where Element: ~Copyable {
public mutating func nextMutableSpan(
after index: inout Int, maximumCount: Int
) -> MutableSpan<Element> {
self.nextMutableSpan(after: &index, maxCount: maximumCount)
self.nextMutableSpan(
after: &index,
maxCount: maximumCount,
limitedBy: self.endIndex)
}
@available(*, deprecated, renamed: "previousSpan(before:maxCount:)")