Skip to content

Commit 837750e

Browse files
committed
add is identical methods updates
1 parent 669c148 commit 837750e

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

proposals/0494-add-is-identical-methods.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
* [`ContiguousArray`](#contiguousarray)
2222
* [`Dictionary`](#dictionary)
2323
* [`Set`](#set)
24+
* [`UnsafeBufferPointer`](#unsafebufferpointer)
25+
* [`UTF8Span`](#utf8span)
2426
* [Source Compatibility](#source-compatibility)
2527
* [Impact on ABI](#impact-on-abi)
2628
* [Future Directions](#future-directions)
@@ -405,6 +407,11 @@ We propose adding `isIdentical` methods to the following concrete types from Sta
405407
* `ContiguousArray`
406408
* `Dictionary`
407409
* `Set`
410+
* `UnsafeBufferPointer`
411+
* `UnsafeMutableBufferPointer`
412+
* `UnsafeMutableRawBufferPointer`
413+
* `UnsafeRawBufferPointer`
414+
* `UTF8Span`
408415

409416
For each type being presented we codify important semantics in our header documentation.
410417

@@ -690,6 +697,30 @@ extension Set {
690697
}
691698
```
692699

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+
693724
## Source Compatibility
694725

695726
This proposal is additive and source-compatible with existing code.

0 commit comments

Comments
 (0)