From cd0ca78dbd3eb0bd5b79014f5534a33bfe247d0f Mon Sep 17 00:00:00 2001 From: Karoy Lorentey Date: Mon, 27 Apr 2026 18:10:26 -0700 Subject: [PATCH] [DequeModule] Assorted UniqueDeque doc string fixes --- .../RigidDeque/RigidDeque+Prepend.swift | 8 ++++---- .../UniqueDeque/UniqueDeque+Consumption.swift | 1 - .../UniqueDeque/UniqueDeque+Prepend.swift | 20 ++++++++++--------- .../DequeModule/UniqueDeque/UniqueDeque.swift | 4 ++-- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/Sources/DequeModule/RigidDeque/RigidDeque+Prepend.swift b/Sources/DequeModule/RigidDeque/RigidDeque+Prepend.swift index 50ed07b7..c9b1fe54 100644 --- a/Sources/DequeModule/RigidDeque/RigidDeque+Prepend.swift +++ b/Sources/DequeModule/RigidDeque/RigidDeque+Prepend.swift @@ -427,7 +427,7 @@ extension RigidDeque /*where Element: Copyable*/ { } #if compiler(>=6.4) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW - /// Copies the elements of a borrowing sequence to the end of this deque. + /// Copies the elements of a borrowing sequence to the front of this deque. /// /// If the deque does not have sufficient capacity to hold all items in the /// sequence, then this triggers a runtime error. @@ -443,7 +443,7 @@ extension RigidDeque /*where Element: Copyable*/ { self._prepend(copying: items) } - /// Copies the elements of a borrowing sequence to the end of this deque. + /// Copies the elements of a borrowing sequence to the front of this deque. /// /// If the deque does not have sufficient capacity to hold all items in the /// sequence, then this triggers a runtime error. @@ -459,7 +459,7 @@ extension RigidDeque /*where Element: Copyable*/ { self._prepend(copying: items, exactCount: items.count) } - /// Copies the elements of a container to the end of this deque. + /// Copies the elements of a container to the front of this deque. /// /// If the deque does not have sufficient capacity to hold all items in the /// sequence, then this triggers a runtime error. @@ -475,7 +475,7 @@ extension RigidDeque /*where Element: Copyable*/ { self._prepend(copying: items, exactCount: items.count) } - /// Copies the elements of a container to the end of this deque. + /// Copies the elements of a container to the front of this deque. /// /// If the deque does not have sufficient capacity to hold all items in the /// sequence, then this triggers a runtime error. diff --git a/Sources/DequeModule/UniqueDeque/UniqueDeque+Consumption.swift b/Sources/DequeModule/UniqueDeque/UniqueDeque+Consumption.swift index 77935b6a..7b394830 100644 --- a/Sources/DequeModule/UniqueDeque/UniqueDeque+Consumption.swift +++ b/Sources/DequeModule/UniqueDeque/UniqueDeque+Consumption.swift @@ -83,7 +83,6 @@ extension UniqueDeque where Element: ~Copyable { /// /// - Parameter consumer: A function taking an input span of the removed items, /// allowing them to be consumed straight out of the deque's storage. - /// The function is called at most once. /// - Complexity: O(`self.count`) @_alwaysEmitIntoClient @inline(__always) diff --git a/Sources/DequeModule/UniqueDeque/UniqueDeque+Prepend.swift b/Sources/DequeModule/UniqueDeque/UniqueDeque+Prepend.swift index 72c92847..380082d7 100644 --- a/Sources/DequeModule/UniqueDeque/UniqueDeque+Prepend.swift +++ b/Sources/DequeModule/UniqueDeque/UniqueDeque+Prepend.swift @@ -259,7 +259,7 @@ extension UniqueDeque where Element: ~Copyable { @available(SwiftStdlib 5.0, *) extension UniqueDeque /*where Element: Copyable*/ { /// Copies the elements of a buffer and prepend them to the front of this - /// rigid deque. + /// deque. /// /// If the deque doesn't have sufficient capacity to accommodate the specified /// number of new elements, then this method reallocates the deque's storage @@ -396,13 +396,14 @@ extension UniqueDeque /*where Element: Copyable*/ { /// Prepend the elements of a sequence to the front of this deque by copying /// them. /// - /// If the deque does not have sufficient capacity to hold all items in the - /// sequence, then this triggers a runtime error. + /// If the deque does not have sufficient capacity to accommodate the new + /// elements, then this method reallocates the deque's storage to grow it, + /// using a geometric growth rate. /// /// This example prepends the elements of a `Range` instance - /// to a rigid deque of integers. + /// to a unique deque of integers. /// - /// var numbers = RigidDeque(capacity: 10) + /// var numbers = UniqueDeque() /// numbers.append(copying: [1, 2, 3, 4, 5]) /// numbers.prepend(copying: 10...15) /// // `numbers` now contains [10, 11, 12, 13, 14, 15, 1, 2, 3, 4, 5] @@ -433,13 +434,14 @@ extension UniqueDeque /*where Element: Copyable*/ { /// Prepend the elements of a collection to the front of this deque by copying /// them. /// - /// If the deque does not have sufficient capacity to hold all items in the - /// sequence, then this triggers a runtime error. + /// If the deque does not have sufficient capacity to accommodate the new + /// elements, then this method reallocates the deque's storage to grow it, + /// using a geometric growth rate. /// /// This example prepends the elements of a `Range` instance - /// to a rigid deque of integers. + /// to a unique deque of integers. /// - /// var numbers = RigidDeque(capacity: 10) + /// var numbers = UniqueDeque() /// numbers.append(copying: [1, 2, 3, 4, 5]) /// numbers.prepend(copying: 10...15) /// // `numbers` now contains [10, 11, 12, 13, 14, 15, 1, 2, 3, 4, 5] diff --git a/Sources/DequeModule/UniqueDeque/UniqueDeque.swift b/Sources/DequeModule/UniqueDeque/UniqueDeque.swift index 0d12410e..9f5d8c19 100644 --- a/Sources/DequeModule/UniqueDeque/UniqueDeque.swift +++ b/Sources/DequeModule/UniqueDeque/UniqueDeque.swift @@ -308,10 +308,10 @@ extension UniqueDeque { UniqueDeque(_storage: _storage.clone()) } - /// Copy the contents of this deque into a newly allocated rigid deque + /// Copy the contents of this deque into a newly allocated unique deque /// instance with the specified capacity. /// - /// - Parameter capacity: The desired capacity of the resulting rigid deque. + /// - Parameter capacity: The desired capacity of the resulting unique deque. /// `capacity` must be greater than or equal to `count`. /// /// - Complexity: O(`count`)