File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -1137,6 +1137,31 @@ impl<'a> DoubleEndedIterator for Lines<'a> {
11371137#[ stable( feature = "fused" , since = "1.26.0" ) ]
11381138impl FusedIterator for Lines < ' _ > { }
11391139
1140+ impl < ' a > Lines < ' a > {
1141+ /// Returns the remaining lines of the split string.
1142+ ///
1143+ /// # Examples
1144+ ///
1145+ /// ```
1146+ /// #![feature(str_lines_remainder)]
1147+ ///
1148+ /// let mut lines = "a\nb\nc\nd".lines();
1149+ /// assert_eq!(lines.remainder(), Some("a\nb\nc\nd"));
1150+ ///
1151+ /// lines.next();
1152+ /// assert_eq!(lines.remainder(), Some("b\nc\nd"));
1153+ ///
1154+ /// lines.by_ref().for_each(drop);
1155+ /// assert_eq!(lines.remainder(), None);
1156+ /// ```
1157+ #[ inline]
1158+ #[ must_use]
1159+ #[ unstable( feature = "str_lines_remainder" , issue = "77998" ) ]
1160+ pub fn remainder ( & self ) -> Option < & ' a str > {
1161+ self . 0 . iter . remainder ( )
1162+ }
1163+ }
1164+
11401165/// Created with the method [`lines_any`].
11411166///
11421167/// [`lines_any`]: str::lines_any
You can’t perform that action at this time.
0 commit comments