Skip to content

Commit 24f772d

Browse files
author
Julian Orth
committed
update detailed design
1 parent 1a57d20 commit 24f772d

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

text/0000-drain-range.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,14 @@ Remove `Vec::drain` and add the following method:
5858
///
5959
/// Panics if the range is decreasing or if the upper bound is larger than the
6060
/// length of the vector.
61-
pub fn drain<T: Drainer>(&mut self, range: T) -> RangeIter<T> {
62-
range.drain(self)
63-
}
61+
pub fn drain<T: Trait>(&mut self, range: T) -> /* ... */;
6462
```
6563

66-
Where `Drainer` should be implemented for `Range<usize>`, `RangeTo<usize>`,
67-
`RangeFrom<usize>`, `FullRange`, and `usize`.
64+
Where `Trait` is some trait that is implemented for at least `Range<usize>`,
65+
`RangeTo<usize>`, `RangeFrom<usize>`, `FullRange`, and `usize`.
66+
67+
The precise nature of the return value is to be determined during implementation
68+
and may or may not depend on `T`.
6869

6970
Add `String::drain`:
7071

@@ -77,11 +78,11 @@ Add `String::drain`:
7778
/// Panics if the range is decreasing, if the upper bound is larger than the
7879
/// length of the String, or if the start and the end of the range don't lie on
7980
/// character boundaries.
80-
pub fn drain(&mut self, range: /* ? */) -> /* ? */ {
81-
// ?
82-
}
81+
pub fn drain<T: Trait>(&mut self, range: T) -> /* ... */;
8382
```
8483

84+
Where `Trait` and the return value are as above but need not be the same.
85+
8586
# Drawbacks
8687

8788
- The function signature differs from other collections.

0 commit comments

Comments
 (0)