File tree Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change 2
2
//
3
3
// This source file is part of the Swift.org open source project
4
4
//
5
- // Copyright (c) 2014 - 2024 Apple Inc. and the Swift project authors
5
+ // Copyright (c) 2014 - 2025 Apple Inc. and the Swift project authors
6
6
// Licensed under Apache License v2.0 with Runtime Library Exception
7
7
//
8
8
// See https://swift.org/LICENSE.txt for license information
@@ -564,6 +564,16 @@ extension Unsafe${Mutable}BufferPointer where Element: ~Copyable {
564
564
public func extracting( _ bounds: UnboundedRange ) -> Self {
565
565
unsafe self
566
566
}
567
+
568
+ @available ( SwiftStdlib 6 . 2 , * )
569
+ public var span : Span < Element > {
570
+ @lifetime ( borrow self)
571
+ @_alwaysEmitIntoClient
572
+ get {
573
+ let span = Span ( _unsafeElements: self )
574
+ return _overrideLifetime ( span, borrowing: self )
575
+ }
576
+ }
567
577
}
568
578
569
579
extension Unsafe${ Mutable} BufferPointer {
Original file line number Diff line number Diff line change 2
2
//
3
3
// This source file is part of the Swift.org open source project
4
4
//
5
- // Copyright (c) 2014 - 2024 Apple Inc. and the Swift project authors
5
+ // Copyright (c) 2014 - 2025 Apple Inc. and the Swift project authors
6
6
// Licensed under Apache License v2.0 with Runtime Library Exception
7
7
//
8
8
// See https://swift.org/LICENSE.txt for license information
@@ -1171,6 +1171,16 @@ extension Unsafe${Mutable}RawBufferPointer {
1171
1171
try unsafe body( ${ 'UnsafeBufferPointer < Element > ( $0) ' if Mutable else '$0' } )
1172
1172
}
1173
1173
}
1174
+
1175
+ @available( SwiftStdlib 6.2 , * )
1176
+ public var bytes: RawSpan {
1177
+ @lifetime ( borrow self)
1178
+ @_alwaysEmitIntoClient
1179
+ get {
1180
+ let span = RawSpan ( _unsafeBytes: self )
1181
+ return _overrideLifetime ( span, borrowing: self )
1182
+ }
1183
+ }
1174
1184
}
1175
1185
1176
1186
@_unavailableInEmbedded
You can’t perform that action at this time.
0 commit comments