Struct Lines
#[must_use = "iterators are lazy and do nothing unless consumed"]
pub struct Lines<'a>(pub(in ::str) Map<SplitInclusive<'a, char>, LinesMap>);
An iterator over the lines of a string, as string slices.
This struct is created with the lines method on str.
See its documentation for more.
Fields
0: Map<SplitInclusive<'a, char>, LinesMap>
Implementations
impl<'a> Lines<'a>
fn remainder(&self) -> Option<&'a str>Returns the remaining lines of the split string.
Examples
let mut lines = "a\nb\nc\nd".lines; assert_eq!; lines.next; assert_eq!; lines.by_ref.for_each; assert_eq!;
Trait Implementations
impl FusedIterator for Lines<'_>
impl<'a> Clone for Lines<'a>
fn clone(&self) -> Self
impl<'a> Debug for Lines<'a>
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl<'a> DoubleEndedIterator for Lines<'a>
fn next_back(&mut self) -> Option<&'a str>
impl<'a> Iterator for Lines<'a>
type Item = &'a str;fn next(&mut self) -> Option<&'a str>fn size_hint(&self) -> (usize, Option<usize>)fn last(self) -> Option<&'a str>
Auto Trait Implementations
impl<'a> Freeze for Lines<'a>
impl<'a> RefUnwindSafe for Lines<'a>
impl<'a> Send for Lines<'a>
impl<'a> Sync for Lines<'a>
impl<'a> Unpin for Lines<'a>
impl<'a> UnsafeUnpin for Lines<'a>
impl<'a> UnwindSafe for Lines<'a>
Blanket Implementations
impl<I> IntoIterator for Lines<'a>
where
I: Iterator,
type Item = <I as Iterator>::Item;type IntoIter = I;fn into_iter(self) -> I
impl<T> Any for Lines<'a>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Lines<'a>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Lines<'a>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for Lines<'a>
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for Lines<'a>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> SizeHint for Lines<'a>
where
T: ?Sized,
fn lower_bound(&self) -> usizefn upper_bound(&self) -> Option<usize>
impl<T> SizedTypeProperties for Lines<'a>
impl<T, U> Into<U> for Lines<'a>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for Lines<'a>
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for Lines<'a>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>