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 b2b679d commit 734df41Copy full SHA for 734df41
core/src/iter/adapters/rev.rs
@@ -20,6 +20,25 @@ impl<T> Rev<T> {
20
pub(in crate::iter) fn new(iter: T) -> Rev<T> {
21
Rev { iter }
22
}
23
+
24
+ /// Consumes the `Rev`, returning the inner iterator.
25
+ ///
26
+ /// # Examples
27
28
+ /// ```rust
29
+ /// #![feature(rev_into_inner)]
30
31
+ /// let s = "foobar";
32
+ /// let mut rev = s.chars().rev();
33
+ /// assert_eq!(rev.next(), Some('r'));
34
+ /// assert_eq!(rev.next(), Some('a'));
35
+ /// assert_eq!(rev.next(), Some('b'));
36
+ /// assert_eq!(rev.into_inner().collect::<String>(), "foo");
37
+ /// ```
38
+ #[unstable(feature = "rev_into_inner", issue = "144277")]
39
+ pub fn into_inner(self) -> T {
40
+ self.iter
41
+ }
42
43
44
#[stable(feature = "rust1", since = "1.0.0")]
0 commit comments