|
25 | 25 |
|
26 | 26 | - [Proposed solution](#proposed-solution)
|
27 | 27 |
|
28 |
| -- [Detailed Design](#detailed-design) |
| 28 | +- [Detailed Design](#design) |
29 | 29 |
|
30 | 30 | - [Source compatibility](#source-compatibility)
|
31 | 31 |
|
@@ -144,24 +144,6 @@ extension OutputSpan where Element: ~Copyable {
|
144 | 144 | }
|
145 | 145 | ```
|
146 | 146 |
|
147 |
| -`OutputSpan` provides the ability to access its initialized elements by index: |
148 |
| -```swift |
149 |
| -extension OutputSpan wehre Element: ~Copyable { |
150 |
| - /// The type that represents an initialized position in an `OutputSpan`. |
151 |
| - typealias Index = Int |
152 |
| - |
153 |
| - /// The range of initialized positions for this `OutputSpan`. |
154 |
| - var indices: Range<Index> { get } |
155 |
| - |
156 |
| - /// Accesses the element at the specified initialized position. |
157 |
| - subscript(_ index: Index) -> Element { borrow; mutate } |
158 |
| - // accessor syntax from accessors roadmap (https://forums.swift.org/t/76707) |
159 |
| - |
160 |
| - /// Exchange the elements at the two given offsets |
161 |
| - mutating func swapAt(_ i: Index, _ j: Index) |
162 |
| -} |
163 |
| -``` |
164 |
| - |
165 | 147 |
|
166 | 148 | ##### Bulk initialization of an `OutputSpan`'s memory:
|
167 | 149 |
|
@@ -289,6 +271,24 @@ extension OutputSpan where Element: ~Copyable {
|
289 | 271 | }
|
290 | 272 | ```
|
291 | 273 |
|
| 274 | +`OutputSpan` also provides the ability to access its individual initialized elements by index: |
| 275 | +```swift |
| 276 | +extension OutputSpan wehre Element: ~Copyable { |
| 277 | + /// The type that represents an initialized position in an `OutputSpan`. |
| 278 | + typealias Index = Int |
| 279 | + |
| 280 | + /// The range of initialized positions for this `OutputSpan`. |
| 281 | + var indices: Range<Index> { get } |
| 282 | + |
| 283 | + /// Accesses the element at the specified initialized position. |
| 284 | + subscript(_ index: Index) -> Element { borrow; mutate } |
| 285 | + // accessor syntax from accessors roadmap (https://forums.swift.org/t/76707) |
| 286 | + |
| 287 | + /// Exchange the elements at the two given offsets |
| 288 | + mutating func swapAt(_ i: Index, _ j: Index) |
| 289 | +} |
| 290 | +``` |
| 291 | + |
292 | 292 |
|
293 | 293 | ##### Interoperability with unsafe code
|
294 | 294 |
|
|
0 commit comments