You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: proposals/nnnn-outputspan.md
+38-11Lines changed: 38 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -273,7 +273,7 @@ extension OutputSpan where Element: ~Copyable {
273
273
274
274
`OutputSpan` also provides the ability to access its individual initialized elements by index:
275
275
```swift
276
-
extensionOutputSpanwehre Element: ~Copyable {
276
+
extensionOutputSpanwhereElement:~Copyable {
277
277
/// The type that represents an initialized position in an `OutputSpan`.
278
278
typealiasIndex=Int
279
279
@@ -448,6 +448,10 @@ extension OutputRawSpan {
448
448
The basic operation is to append the bytes of some value to an `OutputRawSpan`. Note that since the fundamental operation is appending bytes, `OutputRawSpan` does not concern itself with memory alignment.
449
449
```swift
450
450
extensionOutputRawSpan {
451
+
/// Append a single byte to this span
452
+
@lifetime(self:copyself)
453
+
publicmutatingfuncappend(_value: UInt8)
454
+
451
455
/// Appends the given value's bytes to this span's initialized bytes
452
456
@lifetime(self:copyself)
453
457
publicmutatingfuncappend<T: BitwiseCopyable>(
@@ -522,6 +526,29 @@ extension OutputRawSpan {
522
526
}
523
527
```
524
528
529
+
Methods to deinitialize memory from an `OutputRawSpan`:
530
+
531
+
```swift
532
+
extension OutputRawSpan {
533
+
534
+
/// Remove the last byte from this span
535
+
@lifetime(self: copy self)
536
+
public mutating func removeLast() -> UInt8 {
537
+
538
+
/// Remove the last N elements, returning the memory they occupy
539
+
/// to the uninitialized state.
540
+
///
541
+
/// `n` must not be greater than `count`
542
+
@lifetime(self:copyself)
543
+
publicmutatingfuncremoveLast(_n: Int)
544
+
545
+
/// Remove all this span's elements and return its memory
546
+
/// to the uninitialized state.
547
+
@lifetime(self:copyself)
548
+
publicmutatingfuncremoveAll()
549
+
}
550
+
```
551
+
525
552
526
553
##### Interoperability with unsafe code
527
554
@@ -825,10 +852,6 @@ This proposal considers the naming of `OutputSpan`'s bulk-copying methods more c
0 commit comments