|
21 | 21 | * [`ContiguousArray`](#contiguousarray) |
22 | 22 | * [`Dictionary`](#dictionary) |
23 | 23 | * [`Set`](#set) |
| 24 | + * [`UnsafeBufferPointer`](#unsafebufferpointer) |
| 25 | + * [`UTF8Span`](#utf8span) |
24 | 26 | * [Source Compatibility](#source-compatibility) |
25 | 27 | * [Impact on ABI](#impact-on-abi) |
26 | 28 | * [Future Directions](#future-directions) |
@@ -405,6 +407,11 @@ We propose adding `isIdentical` methods to the following concrete types from Sta |
405 | 407 | * `ContiguousArray` |
406 | 408 | * `Dictionary` |
407 | 409 | * `Set` |
| 410 | +* `UnsafeBufferPointer` |
| 411 | +* `UnsafeMutableBufferPointer` |
| 412 | +* `UnsafeMutableRawBufferPointer` |
| 413 | +* `UnsafeRawBufferPointer` |
| 414 | +* `UTF8Span` |
408 | 415 |
|
409 | 416 | For each type being presented we codify important semantics in our header documentation. |
410 | 417 |
|
@@ -690,6 +697,30 @@ extension Set { |
690 | 697 | } |
691 | 698 | ``` |
692 | 699 |
|
| 700 | +### `UnsafeBufferPointer` |
| 701 | + |
| 702 | +```swift |
| 703 | +extension UnsafeBufferPointer where Element: ~Copyable { |
| 704 | + /// Returns a Boolean value indicating whether two `UnsafeBufferPointer` |
| 705 | + /// instances refer to the same region in memory. |
| 706 | + public func isIdentical(to other: Self) -> Bool { ... } |
| 707 | +} |
| 708 | +``` |
| 709 | + |
| 710 | +The following types will adopt the same semantic guarantees as `UnsafeBufferPointer`: |
| 711 | +* `UnsafeMutableBufferPointer` |
| 712 | +* `UnsafeMutableRawBufferPointer` |
| 713 | +* `UnsafeRawBufferPointer` |
| 714 | + |
| 715 | +### `UTF8Span` |
| 716 | + |
| 717 | +```swift |
| 718 | +extension UTF8Span where Element: ~Copyable { |
| 719 | + /// Returns a Boolean value indicating whether two `UTF8Span` instances |
| 720 | + /// refer to the same region in memory. |
| 721 | + public func isIdentical(to other: Self) -> Bool { ... } |
| 722 | +``` |
| 723 | + |
693 | 724 | ## Source Compatibility |
694 | 725 |
|
695 | 726 | This proposal is additive and source-compatible with existing code. |
|
0 commit comments