mirror of
https://github.com/apple/swift-collections
synced 2026-11-27 04:54:21 +00:00
RigidArray, UniqueArray: Deprecate ancient span methods
This commit is contained in:
6 files changed
+153
-174
No files matched your search
@@ -346,6 +346,14 @@ extension UniqueArray where Element: ~Copyable {
|
||||
_storage.nextSpan(after: &index, maxCount: maxCount, limitedBy: limit)
|
||||
}
|
||||
|
||||
@_alwaysEmitIntoClient
|
||||
@_lifetime(&self)
|
||||
public mutating func nextMutableSpan(
|
||||
after index: inout Int
|
||||
) -> MutableSpan<Element> {
|
||||
_storage.nextMutableSpan(after: &index)
|
||||
}
|
||||
|
||||
@inlinable
|
||||
@_lifetime(&self)
|
||||
public mutating func nextMutableSpan(
|
||||
@@ -369,6 +377,15 @@ extension UniqueArray where Element: ~Copyable {
|
||||
before: index, maxDistance: maxDistance, limitedBy: limit)
|
||||
}
|
||||
|
||||
@_alwaysEmitIntoClient
|
||||
@_lifetime(borrow self)
|
||||
public func previousSpan(
|
||||
before index: inout Int
|
||||
) -> Span<Element> {
|
||||
// FIXME: Remove this in favor of the BidirectionalContainer algorithm.
|
||||
_storage.previousSpan(before: &index)
|
||||
}
|
||||
|
||||
@_alwaysEmitIntoClient
|
||||
@_lifetime(borrow self)
|
||||
public func previousSpan(
|
||||
@@ -377,4 +394,12 @@ extension UniqueArray where Element: ~Copyable {
|
||||
// FIXME: Remove this in favor of the BidirectionalContainer algorithm.
|
||||
_storage.previousSpan(before: &index, maxCount: maxCount)
|
||||
}
|
||||
|
||||
@_alwaysEmitIntoClient
|
||||
@_lifetime(&self)
|
||||
public mutating func previousMutableSpan(
|
||||
before index: inout Int
|
||||
) -> MutableSpan<Element> {
|
||||
_storage.previousMutableSpan(before: &index)
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,21 @@ import SpanPreview
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension UniqueArray where Element: ~Copyable {
|
||||
@available(*, deprecated, renamed: "nextSpan(after:)")
|
||||
@inlinable
|
||||
@inline(__always)
|
||||
@_lifetime(borrow self)
|
||||
public func span(after index: inout Int) -> Span<Element> {
|
||||
nextSpan(after: &index)
|
||||
}
|
||||
|
||||
@available(*, deprecated, renamed: "nextSpan(after:)")
|
||||
@inlinable
|
||||
@_lifetime(borrow self)
|
||||
public func span(before index: inout Int) -> Span<Element> {
|
||||
previousSpan(before: &index)
|
||||
}
|
||||
|
||||
@available(*, deprecated, renamed: "nextSpan(after:maxCount:)")
|
||||
@inlinable
|
||||
@_lifetime(borrow self)
|
||||
@@ -29,6 +44,24 @@ extension UniqueArray where Element: ~Copyable {
|
||||
limitedBy: self.endIndex)
|
||||
}
|
||||
|
||||
@available(*, deprecated, renamed: "nextMutableSpan(after:)")
|
||||
@_lifetime(&self)
|
||||
@inlinable
|
||||
public mutating func mutableSpan(
|
||||
after index: inout Int
|
||||
) -> MutableSpan<Element> {
|
||||
self.nextMutableSpan(after: &index)
|
||||
}
|
||||
|
||||
@available(*, deprecated, renamed: "previousMutableSpan(before:)")
|
||||
@_lifetime(&self)
|
||||
@inlinable
|
||||
public mutating func mutableSpan(
|
||||
before index: inout Int
|
||||
) -> MutableSpan<Element> {
|
||||
self.previousMutableSpan(before: &index)
|
||||
}
|
||||
|
||||
@available(*, deprecated, renamed: "nextMutableSpan(after:maxCount:)")
|
||||
@inlinable
|
||||
@_lifetime(&self)
|
||||
|
||||
@@ -155,84 +155,6 @@ extension UniqueArray where Element: ~Copyable {
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - Container primitives
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension UniqueArray where Element: ~Copyable {
|
||||
/// Return a borrowing span over the maximal storage chunk following the
|
||||
/// specified position in the array.
|
||||
///
|
||||
/// The returned span provides direct read-only access to all array elements
|
||||
/// in the range `index ..< count`.
|
||||
///
|
||||
/// - Parameter index: A valid index in the array, including the end index.
|
||||
/// When `span(after:)` returns, `index` is equal to the array's
|
||||
/// `endIndex`.
|
||||
///
|
||||
/// - Complexity: O(1)
|
||||
@inlinable
|
||||
@_lifetime(borrow self)
|
||||
public func span(after index: inout Int) -> Span<Element> {
|
||||
_storage.span(after: &index)
|
||||
}
|
||||
|
||||
/// Return a borrowing span over the maximal storage chunk preceding the
|
||||
/// specified position in the array.
|
||||
///
|
||||
/// The returned span provides direct read-only access to all array elements
|
||||
/// in the range `0 ..< index`.
|
||||
///
|
||||
/// - Parameter index: A valid index in the array, including the end index.
|
||||
/// When `span(before:)` returns, `index` is equal to the array's
|
||||
/// `startIndex`.
|
||||
///
|
||||
/// - Complexity: O(1)
|
||||
@inlinable
|
||||
@_lifetime(borrow self)
|
||||
public func span(before index: inout Int) -> Span<Element> {
|
||||
_storage.span(before: &index)
|
||||
}
|
||||
}
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension UniqueArray where Element: ~Copyable {
|
||||
/// Return a mutable span over the maximal storage chunk following the
|
||||
/// specified position in the array.
|
||||
///
|
||||
/// The returned span provides direct mutating access to all array elements
|
||||
/// in the range `index ..< count`.
|
||||
///
|
||||
/// - Parameter index: A valid index in the array, including the end index.
|
||||
/// When `mutableSpan(after:)` returns, `index` is equal to the array's
|
||||
/// `endIndex`.
|
||||
///
|
||||
/// - Complexity: O(1)
|
||||
@_lifetime(&self)
|
||||
public mutating func mutableSpan(
|
||||
after index: inout Int
|
||||
) -> MutableSpan<Element> {
|
||||
_storage.mutableSpan(after: &index)
|
||||
}
|
||||
|
||||
/// Return a mutable span over the maximal storage chunk preceding the specified
|
||||
/// position in the array.
|
||||
///
|
||||
/// The returned span provides direct mutating access to all array elements
|
||||
/// in the range `0 ..< index`.
|
||||
///
|
||||
/// - Parameter index: A valid index in the array, including the end index.
|
||||
/// When `mutableSpan(before:)` returns, `index` is equal to the array's
|
||||
/// `startIndex`.
|
||||
///
|
||||
/// - Complexity: O(1)
|
||||
@_lifetime(&self)
|
||||
public mutating func mutableSpan(
|
||||
before index: inout Int
|
||||
) -> MutableSpan<Element> {
|
||||
_storage.mutableSpan(before: &index)
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - Resizing
|
||||
|
||||
@_alwaysEmitIntoClient
|
||||
|
||||
Reference in new issue
Block a user