diff --git a/Sources/ContainersPreview/InputSpan.swift b/Sources/ContainersPreview/InputSpan.swift index 0a945304..63e7dbc8 100644 --- a/Sources/ContainersPreview/InputSpan.swift +++ b/Sources/ContainersPreview/InputSpan.swift @@ -16,6 +16,7 @@ import InternalCollectionsUtilities #endif import Builtin +@available(SwiftStdlib 5.0, *) @safe @frozen public struct InputSpan: ~Copyable, ~Escapable { @@ -46,8 +47,10 @@ public struct InputSpan: ~Copyable, ~Escapable { } } +@available(SwiftStdlib 5.0, *) extension InputSpan: @unchecked Sendable where Element: Sendable & ~Copyable {} +@available(SwiftStdlib 5.0, *) extension InputSpan where Element: ~Copyable { @_alwaysEmitIntoClient @_transparent @@ -86,6 +89,7 @@ extension InputSpan where Element: ~Copyable { } } +@available(SwiftStdlib 5.0, *) extension InputSpan where Element: ~Copyable { /// Consume the input span and return the number of initialized elements /// remaining at the end of the underlying memory region. @@ -118,6 +122,7 @@ extension InputSpan where Element: ~Copyable { } } +@available(SwiftStdlib 5.0, *) extension InputSpan { /// Consume the input span and return the number of initialized elements /// remaining at the end of the underlying memory region. @@ -144,6 +149,7 @@ extension InputSpan { } } +@available(SwiftStdlib 5.0, *) extension InputSpan where Element: ~Copyable { /// The number of initialized elements in this span. @_alwaysEmitIntoClient @@ -162,6 +168,7 @@ extension InputSpan where Element: ~Copyable { public var isFull: Bool { _count == capacity } } +@available(SwiftStdlib 5.0, *) extension InputSpan where Element: ~Copyable { @unsafe @_alwaysEmitIntoClient @@ -195,6 +202,7 @@ extension InputSpan where Element: ~Copyable { } } +@available(SwiftStdlib 5.0, *) extension InputSpan { /// Unsafely create an input span over partially initialized memory. /// @@ -222,6 +230,7 @@ extension InputSpan { } } +@available(SwiftStdlib 5.0, *) extension InputSpan where Element: ~Copyable { /// The type that represents an initialized position in an `InputSpan`. public typealias Index = Int @@ -301,6 +310,7 @@ extension InputSpan where Element: ~Copyable { } } +@available(SwiftStdlib 5.0, *) extension InputSpan where Element: ~Copyable { /// Prepend a single element to this span. @_alwaysEmitIntoClient @@ -355,6 +365,7 @@ extension InputSpan where Element: ~Copyable { //MARK: Bulk append functions +@available(SwiftStdlib 5.0, *) extension InputSpan { /// Repeatedly append an element to this span. @_alwaysEmitIntoClient @@ -368,6 +379,7 @@ extension InputSpan { } } +@available(SwiftStdlib 5.0, *) extension InputSpan where Element: ~Copyable { /// Borrow the underlying initialized memory for read-only access. @available(SwiftStdlib 5.0, *) @@ -401,6 +413,7 @@ extension InputSpan where Element: ~Copyable { } } +@available(SwiftStdlib 5.0, *) extension InputSpan where Element: ~Copyable { /// Call the given closure with the unsafe buffer pointer addressed by this /// InputSpan and a mutable reference to its count of initialized elements.