@@ -108,9 +108,11 @@ The converse operation `removeLast()` is also supported, and returns the removed
108
108
``` swift
109
109
extension OutputSpan where Element : ~Copyable {
110
110
/// Remove the last initialized element from this `OutputSpan`.
111
+ ///
112
+ /// Returns the last element. The `OutputSpan` must not be empty
111
113
@discardableResult
112
114
@lifetime (self : copy self )
113
- public mutating func removeLast () -> Element ?
115
+ public mutating func removeLast () -> Element
114
116
}
115
117
```
116
118
@@ -135,23 +137,26 @@ extension OutputSpan {
135
137
136
138
/// Initialize this span's suffix with every element of the source.
137
139
///
138
- /// It is a precondition that the `OutputSpan` can contain every element of the source.
140
+ /// It is a precondition that the `OutputSpan`'s uninitialized suffix
141
+ /// can contain every element of the source.
139
142
@lifetime (self : copy self )
140
143
public mutating func append (
141
144
fromContentsOf source : some Sequence <Element >
142
145
)
143
146
144
147
/// Initialize this span's suffix with every element of the source.
145
148
///
146
- /// It is a precondition that the `OutputSpan` can contain every element of the source.
149
+ /// It is a precondition that the `OutputSpan`'s uninitialized suffix
150
+ /// can contain every element of the source.
147
151
@lifetime (self : copy self )
148
152
public mutating func append (
149
153
fromContentsOf source : Span<Element >
150
154
)
151
155
152
156
/// Initialize this span's suffix with every element of the source.
153
157
///
154
- /// It is a precondition that the `OutputSpan` can contain every element of the source.
158
+ /// It is a precondition that the `OutputSpan`'s uninitialized suffix
159
+ /// can contain every element of the source.
155
160
@lifetime (self : copy self )
156
161
public mutating func append (
157
162
fromContentsOf source : UnsafeBufferPointer <Element >
@@ -161,15 +166,17 @@ extension OutputSpan {
161
166
extension OutputSpan where Element : ~Copyable {
162
167
/// Initialize this span's suffix by moving every element from the source.
163
168
///
164
- /// It is a precondition that the `OutputSpan` can contain every element of the source.
169
+ /// It is a precondition that the `OutputSpan`'s uninitialized suffix
170
+ /// can contain every element of the source.
165
171
@lifetime (self : copy self )
166
172
public mutating func moveAppend (
167
173
fromContentsOf source : inout OutputSpan<Element >
168
174
)
169
175
170
176
/// Initialize this span's suffix by moving every element from the source.
171
177
///
172
- /// It is a precondition that the `OutputSpan` can contain every element of the source.
178
+ /// It is a precondition that the `OutputSpan`'s uninitialized suffix
179
+ /// can contain every element of the source.
173
180
@lifetime (self : copy self )
174
181
public mutating func moveAppend (
175
182
fromContentsOf source : UnsafeMutableBufferPointer <Element >
@@ -179,7 +186,8 @@ extension OutputSpan where Element: ~Copyable {
179
186
extension OutputSpan {
180
187
/// Initialize this span's suffix by moving every element from the source.
181
188
///
182
- /// It is a precondition that the `OutputSpan` can contain every element of the source.
189
+ /// It is a precondition that the `OutputSpan`'s uninitialized suffix
190
+ /// can contain every element of the source.
183
191
@lifetime (self : copy self )
184
192
public mutating func moveAppend (
185
193
fromContentsOf source : Slice <UnsafeMutableBufferPointer <Element >>
@@ -192,6 +200,8 @@ Bulk operations to deinitialize some or all of an `OutputSpan`'s memory is also
192
200
extension OutputSpan where Element : ~Copyable {
193
201
/// Remove the last N elements, returning the memory they occupy
194
202
/// to the uninitialized state.
203
+ ///
204
+ /// `n` must not be greater than `count`
195
205
@lifetime (self : copy self )
196
206
public mutating func removeLast (_ n : Int )
197
207
0 commit comments