We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9f51c06 commit 7722c84Copy full SHA for 7722c84
stdlib/public/core/CollectionOfOne.swift
@@ -70,6 +70,18 @@ extension CollectionOfOne.Iterator: IteratorProtocol {
70
}
71
72
73
+extension CollectionOfOne: Sequence {
74
+ @inlinable // trivial-implementation
75
+ public func withContiguousStorageIfAvailable<R>(
76
+ _ body: (UnsafeBufferPointer<Element>) throws -> R
77
+ ) rethrows -> R? {
78
+ return try withUnsafePointer(to: _element) {
79
+ let buf = UnsafeBufferPointer(start: $0, count: 1)
80
+ return try body(buf)
81
+ }
82
83
+}
84
+
85
extension CollectionOfOne: RandomAccessCollection, MutableCollection {
86
87
public typealias Index = Int
0 commit comments