Struct Lines

struct Lines<'a> { ... }

An iterator over all lines in a byte string, without their terminators.

For this iterator, the only line terminators recognized are \r\n and \n.

'a is the lifetime of the byte string being iterated over.

Implementations

impl<'a> Lines<'a>

fn as_bytes(self: &Self) -> &'a [u8]

Return a copy of the rest of the underlying bytes without affecting the iterator itself.

Examples

Basic usage:

use bstr::{B, ByteSlice};

let s = b"\
foo
bar\r
baz";
let mut lines = s.lines();
assert_eq!(lines.next(), Some(B("foo")));
assert_eq!(lines.as_bytes(), B("bar\r\nbaz"));

impl<'a> Clone for Lines<'a>

fn clone(self: &Self) -> Lines<'a>

impl<'a> Debug for Lines<'a>

fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result

impl<'a> DoubleEndedIterator for Lines<'a>

fn next_back(self: &mut Self) -> Option<<Self as >::Item>

impl<'a> Freeze for Lines<'a>

impl<'a> FusedIterator for Lines<'a>

impl<'a> Iterator for Lines<'a>

fn next(self: &mut Self) -> Option<&'a [u8]>

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>

impl<I> IntoIterator for Lines<'a>

fn into_iter(self: Self) -> I

impl<T> Any for Lines<'a>

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for Lines<'a>

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for Lines<'a>

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> CloneToUninit for Lines<'a>

unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)

impl<T> From for Lines<'a>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for Lines<'a>

fn to_owned(self: &Self) -> T
fn clone_into(self: &Self, target: &mut T)

impl<T, U> Into for Lines<'a>

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for Lines<'a>

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for Lines<'a>

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>