Lines

Struct Lines 

Source
pub struct Lines<'a> { /* private fields */ }
Expand description

A Lender over the lines on Bytes

The reason for this being a Lender, rather than a regular Iterator is because the Bytes use a GapBuffer within, which means that any line may be split in two. In order to still return it as an &str, a new String needs to be allocated, which will be owned by the Lines, hence the Lender trait.

Trait Implementations§

Source§

impl<'a> DoubleEndedLender for Lines<'a>

Source§

fn next_back(&mut self) -> Option<Lend<'_, Self>>

Source§

fn advance_back_by(&mut self, n: usize) -> Result<(), NonZero<usize>>

Source§

fn nth_back(&mut self, n: usize) -> Option<Self::Lend>

Source§

fn try_rfold<B, F, R>(&mut self, init: B, f: F) -> R
where Self: Sized, F: FnMut(B, Self::Lend) -> R, R: Try<Output = B>,

Source§

fn rfold<B, F>(self, init: B, f: F) -> B
where Self: Sized, F: FnMut(B, Self::Lend) -> B,

Source§

fn rfind<P>(&mut self, predicate: P) -> Option<Self::Lend>
where Self: Sized, P: FnMut(&Self::Lend) -> bool,

Source§

impl<'a> ExactSizeLender for Lines<'a>

Source§

fn len(&self) -> usize

Source§

fn is_empty(&self) -> bool

Source§

impl<'a> Lender for Lines<'a>

Source§

fn next(&mut self) -> Option<Lend<'_, Self>>

Yield the next lend, if any, of the lender. Read more
Source§

fn size_hint(&self) -> (usize, Option<usize>)

Get the estimated minimum and maximum length of the lender. Use .len() for the exact length if the lender implements ExactSizeLender. Read more
Source§

fn next_chunk(&mut self, chunk_size: usize) -> Chunk<'_, Self>
where Self: Sized,

Take the next len lends of the lender with temporary lender Chunk. This is the quivalent of cloning the lender and calling take(len) on it. Read more
Source§

fn count(self) -> usize
where Self: Sized,

Count the number of lends in the lender by consuming it. Read more
Source§

fn last<'call>(&'call mut self) -> Option<Self::Lend>
where Self: Sized,

Get the last lend of the lender, if any, by consuming it. Read more
Source§

fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>

Advance the lender by n lends. If the lender does not have enough lends, return the number of lends left. Read more
Source§

fn nth(&mut self, n: usize) -> Option<Self::Lend>

Yield the nth lend of the lender, if any, by consuming it. If the lender does not have enough lends, returns None. Read more
Source§

fn step_by(self, step: usize) -> StepBy<Self>
where Self: Sized,

Skip step - 1 lends between each lend of the lender. Read more
Source§

fn chain<U>(self, other: U) -> Chain<Self, <U as IntoLender>::Lender>
where Self: Sized, U: for<'all> IntoLender + for<'all> Lending<'all, Lend = Self::Lend>,

Chain the lender with another lender of the same type. Read more
Source§

fn zip<U>(self, other: U) -> Zip<Self, <U as IntoLender>::Lender>
where U: IntoLender, Self: Sized,

Zip the lender with another lender of the same or different type. Read more
Source§

fn intersperse<'call>(self, separator: Self::Lend) -> Intersperse<'call, Self>
where Self: Sized, Self::Lend: for<'all> Clone,

Intersperse each lend of this lender with the given seperator. Read more
Source§

fn intersperse_with<'call, G>( self, separator: G, ) -> IntersperseWith<'call, Self, G>
where Self: Sized, G: FnMut() -> Self::Lend,

Intersperse each lend of this lender with the seperator produced by the given function. Read more
Source§

fn map<F>(self, f: F) -> Map<Self, F>
where Self: Sized, F: for<'all> FnMutHKA<'all, Self::Lend>,

Map each lend of this lender using the given function. Read more
Source§

fn map_into_iter<O, F>(self, f: F) -> MapIntoIter<Self, O, F>
where F: FnMut(Self::Lend) -> O, Self: Sized,

Map each lend of this lender into an owned value using the given function. Read more
Source§

fn for_each<F>(self, f: F)
where Self: Sized, F: FnMut(Self::Lend),

Call the given function with each lend of this lender. Read more
Source§

fn filter<P>(self, predicate: P) -> Filter<Self, P>
where Self: Sized, P: FnMut(&Self::Lend) -> bool,

Filter this lender using the given predicate. Read more
Source§

fn filter_map<F>(self, f: F) -> FilterMap<Self, F>
where Self: Sized, F: for<'all> FnMutHKAOpt<'all, Self::Lend>,

Filter and map this lender using the given function. Read more
Source§

fn enumerate(self) -> Enumerate<Self>
where Self: Sized,

Enumerate this lender. Each lend is paired with its zero-based index. Read more
Source§

fn peekable<'call>(self) -> Peekable<'call, Self>
where Self: Sized,

Make this lender peekable, so that it is possible to peek at the next lend without consuming it. Read more
Source§

fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
where Self: Sized, P: FnMut(&Self::Lend) -> bool,

Skip the first contiguous sequence lends of this lender that satisfy the given predicate. Read more
Source§

fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
where Self: Sized, P: FnMut(&Self::Lend) -> bool,

Take the first contiguous sequence lends of this lender that satisfy the given predicate. Read more
Source§

fn map_while<P>(self, predicate: P) -> MapWhile<Self, P>
where Self: Sized, P: for<'all> FnMutHKAOpt<'all, Self::Lend>,

Map this lender using the given function while it returns Some. Read more
Source§

fn skip(self, n: usize) -> Skip<Self>
where Self: Sized,

Skip the first n lends of this lender. Read more
Source§

fn take(self, n: usize) -> Take<Self>
where Self: Sized,

Take the first n lends of this lender. Read more
Source§

fn scan<St, F>(self, initial_state: St, f: F) -> Scan<Self, St, F>
where Self: Sized, F: for<'all> FnMutHKAOpt<'all, (&'all mut St, Self::Lend)>,

Documentation is incomplete. Refer to Iterator::scan for more information.
Source§

fn flat_map<'call, F>(self, f: F) -> FlatMap<'call, Self, F>
where Self: Sized, F: for<'all> FnMutHKA<'all, Self::Lend>, <F as FnMutHKA<'all, Self::Lend>>::B: for<'all> IntoLender,

Documentation is incomplete. Refer to Iterator::flat_map for more information
Source§

fn flatten<'call>(self) -> Flatten<'call, Self>
where Self: Sized, Self::Lend: for<'all> IntoLender,

Documentation is incomplete. Refer to Iterator::flatten for more information
Source§

fn fuse(self) -> Fuse<Self>
where Self: Sized,

Documentation is incomplete. Refer to Iterator::fuse for more information
Source§

fn inspect<F>(self, f: F) -> Inspect<Self, F>
where Self: Sized, F: FnMut(&Self::Lend),

Documentation is incomplete. Refer to Iterator::inspect for more information
Source§

fn mutate<F>(self, f: F) -> Mutate<Self, F>
where Self: Sized, F: FnMut(&mut Self::Lend),

Mutate each lend with the given function.
Source§

fn by_ref(&mut self) -> &mut Self
where Self: Sized,

Documentation is incomplete. Refer to Iterator::by_ref for more information
Source§

fn collect<B>(self) -> B
where Self: Sized, B: FromLender<Self>,

Documentation is incomplete. Refer to Iterator::collect for more information
Source§

fn try_collect<'a, B>( &'a mut self, ) -> <<Self::Lend as Try>::Residual as Residual<B>>::TryType
where Self: Sized, Self::Lend: for<'all> Try, <Self::Lend as Try>::Residual: for<'all> Residual<B>, B: for<'all> FromLender<TryShunt<'all, &'a mut Self>>,

Documentation is incomplete. Refer to Iterator::try_collect for more information
Source§

fn collect_into<E>(self, collection: &mut E) -> &mut E
where Self: Sized, E: ExtendLender<Self>,

Documentation is incomplete. Refer to Iterator::collect_into for more information
Source§

fn partition<A, E, F>(self, f: F) -> (E, E)
where Self: Sized, E: Default + ExtendLender<Self>, F: FnMut(&Self::Lend) -> bool,

Documentation is incomplete. Refer to Iterator::partition for more information
Source§

fn is_partitioned<P>(self, predicate: P) -> bool
where Self: Sized, P: FnMut(Self::Lend) -> bool,

Documentation is incomplete. Refer to Iterator::is_partitioned for more information
Source§

fn try_fold<B, F, R>(&mut self, init: B, f: F) -> R
where Self: Sized, F: FnMut(B, Self::Lend) -> R, R: Try<Output = B>,

Documentation is incomplete. Refer to Iterator::try_fold for more information
Source§

fn try_for_each<F, R>(&mut self, f: F) -> R
where Self: Sized, F: FnMut(Self::Lend) -> R, R: Try<Output = ()>,

Documentation is incomplete. Refer to Iterator::try_for_each for more information
Source§

fn fold<B, F>(self, init: B, f: F) -> B
where Self: Sized, F: FnMut(B, Self::Lend) -> B,

Documentation is incomplete. Refer to Iterator::fold for more information
Source§

fn reduce<T, F>(self, f: F) -> Option<T>
where Self: Sized, Self::Lend: for<'all> ToOwned<Owned = T>, F: FnMut(T, Self::Lend) -> T,

Documentation is incomplete. Refer to Iterator::reduce for more information
Source§

fn try_reduce<T, F, R>( self, f: F, ) -> <<R as Try>::Residual as Residual<Option<T>>>::TryType
where Self: Sized, Self::Lend: for<'all> ToOwned<Owned = T>, F: FnMut(T, Self::Lend) -> R, R: Try<Output = T>, <R as Try>::Residual: Residual<Option<T>>,

Documentation is incomplete. Refer to Iterator::try_reduce for more information
Source§

fn all<F>(&mut self, f: F) -> bool
where Self: Sized, F: FnMut(Self::Lend) -> bool,

Documentation is incomplete. Refer to Iterator::all for more information
Source§

fn any<F>(&mut self, f: F) -> bool
where Self: Sized, F: FnMut(Self::Lend) -> bool,

Documentation is incomplete. Refer to Iterator::any for more information
Source§

fn find<P>(&mut self, predicate: P) -> Option<Self::Lend>
where Self: Sized, P: FnMut(&Self::Lend) -> bool,

Documentation is incomplete. Refer to Iterator::find for more information
Source§

fn find_map<'a, F>( &'a mut self, f: F, ) -> Option<<F as FnMutHKAOpt<'a, Self::Lend>>::B>
where Self: Sized, F: for<'all> FnMutHKAOpt<'all, Self::Lend>,

Documentation is incomplete. Refer to Iterator::find_map for more information
Source§

fn try_find<F, R>( &mut self, f: F, ) -> <<R as Try>::Residual as Residual<Option<Self::Lend>>>::TryType
where Self: Sized, F: FnMut(&Self::Lend) -> R, R: Try<Output = bool>, <R as Try>::Residual: for<'all> Residual<Option<Self::Lend>>,

Documentation is incomplete. Refer to Iterator::try_find for more information
Source§

fn position<P>(&mut self, predicate: P) -> Option<usize>
where Self: Sized, P: FnMut(Self::Lend) -> bool,

Documentation is incomplete. Refer to Iterator::position for more information
Source§

fn rposition<P>(&mut self, predicate: P) -> Option<usize>
where P: FnMut(Self::Lend) -> bool, Self: Sized + ExactSizeLender + DoubleEndedLender,

Documentation is incomplete. Refer to Iterator::rposition for more information
Source§

fn max<T>(self) -> Option<T>
where Self: Sized, T: for<'all> PartialOrd<Self::Lend>, Self::Lend: for<'all> ToOwned<Owned = T>,

Documentation is incomplete. Refer to Iterator::max for more information
Source§

fn min<T>(self) -> Option<T>
where Self: Sized, T: for<'all> PartialOrd<Self::Lend>, Self::Lend: for<'all> ToOwned<Owned = T>,

Documentation is incomplete. Refer to Iterator::min for more information
Source§

fn max_by_key<B, T, F>(self, f: F) -> Option<T>
where B: Ord, Self: Sized, Self::Lend: for<'all> ToOwned<Owned = T>, F: FnMut(&T) -> B,

Documentation is incomplete. Refer to Iterator::max_by_key for more information
Source§

fn max_by<T, F>(self, compare: F) -> Option<T>
where Self: Sized, Self::Lend: for<'all> ToOwned<Owned = T>, F: FnMut(&T, &Self::Lend) -> Ordering,

Documentation is incomplete. Refer to Iterator::max_by for more information
Source§

fn min_by_key<B, T, F>(self, f: F) -> Option<T>
where B: Ord, Self: Sized, Self::Lend: for<'all> ToOwned<Owned = T>, F: FnMut(&T) -> B,

Documentation is incomplete. Refer to Iterator::min_by_key for more information
Source§

fn min_by<T, F>(self, compare: F) -> Option<T>
where Self: Sized, Self::Lend: for<'all> ToOwned<Owned = T>, F: FnMut(&T, &Self::Lend) -> Ordering,

Documentation is incomplete. Refer to Iterator::min_by for more information
Source§

fn rev(self) -> Rev<Self>
where Self: Sized + DoubleEndedLender,

Documentation is incomplete. Refer to Iterator::rev for more information
Source§

fn unzip<ExtA, ExtB>(self) -> (ExtA, ExtB)
where Self: Sized, Self::Lend: for<'all> TupleLend<'all>, ExtA: Default + ExtendLender<FirstShunt<Self>>, ExtB: Default + ExtendLender<SecondShunt<Self>>,

Documentation is incomplete. Refer to Iterator::unzip for more information
Source§

fn copied<T>(self) -> Copied<Self>
where Self: Sized + for<'all> Lending<'all, Lend = &'all T>, T: Copy,

Documentation is incomplete. Refer to Iterator::copied for more information. Read more
Source§

fn cloned<T>(self) -> Cloned<Self>
where Self: Sized + for<'all> Lending<'all, Lend = &'all T>, T: Clone,

Documentation is incomplete. Refer to Iterator::cloned for more information. Read more
Source§

fn owned(self) -> Owned<Self>
where Self: Sized, Self::Lend: for<'all> ToOwned,

Turn this Lender into an Iterator.
Source§

fn sum<S>(self) -> S
where Self: Sized, S: SumLender<Self>,

Documentation is incomplete. Refer to Iterator::sum for more information
Source§

fn product<P>(self) -> P
where Self: Sized, P: ProductLender<Self>,

Documentation is incomplete. Refer to Iterator::product for more information
Source§

fn cmp<L>(self, other: L) -> Ordering
where L: IntoLender, <L as IntoLender>::Lender: for<'all> Lending<'all, Lend = Self::Lend>, Self::Lend: for<'all> Ord, Self: Sized,

Documentation is incomplete. Refer to Iterator::cmp for more information
Source§

fn cmp_by<L, F>(self, other: L, cmp: F) -> Ordering
where Self: Sized, L: IntoLender, F: for<'all> FnMut(Self::Lend, <<L as IntoLender>::Lender as Lending<'all>>::Lend) -> Ordering,

Documentation is incomplete. Refer to Iterator::cmp_by for more information
Source§

fn partial_cmp<L>(self, other: L) -> Option<Ordering>
where L: IntoLender, Self::Lend: for<'all> PartialOrd<<<L as IntoLender>::Lender as Lending<'all>>::Lend>, Self: Sized,

Documentation is incomplete. Refer to Iterator::partial_cmp for more information
Source§

fn partial_cmp_by<L, F>(self, other: L, partial_cmp: F) -> Option<Ordering>
where Self: Sized, L: IntoLender, F: for<'all> FnMut(Self::Lend, <<L as IntoLender>::Lender as Lending<'all>>::Lend) -> Option<Ordering>,

Documentation is incomplete. Refer to Iterator::partial_cmp_by for more information
Source§

fn eq<L>(self, other: L) -> bool
where L: IntoLender, Self::Lend: for<'all> PartialEq<<<L as IntoLender>::Lender as Lending<'all>>::Lend>, Self: Sized,

Documentation is incomplete. Refer to Iterator::eq for more information
Source§

fn eq_by<L, F>(self, other: L, eq: F) -> bool
where Self: Sized, L: IntoLender, F: for<'all> FnMut(Self::Lend, <<L as IntoLender>::Lender as Lending<'all>>::Lend) -> bool,

Documentation is incomplete. Refer to Iterator::eq_by for more information
Source§

fn ne<L>(self, other: L) -> bool
where L: IntoLender, Self::Lend: for<'all> PartialEq<<<L as IntoLender>::Lender as Lending<'all>>::Lend>, Self: Sized,

Documentation is incomplete. Refer to Iterator::ne for more information
Source§

fn lt<L>(self, other: L) -> bool
where L: IntoLender, Self::Lend: for<'all> PartialOrd<<<L as IntoLender>::Lender as Lending<'all>>::Lend>, Self: Sized,

Documentation is incomplete. Refer to Iterator::lt for more information
Source§

fn le<L>(self, other: L) -> bool
where L: IntoLender, Self::Lend: for<'all> PartialOrd<<<L as IntoLender>::Lender as Lending<'all>>::Lend>, Self: Sized,

Documentation is incomplete. Refer to Iterator::le for more information
Source§

fn gt<L>(self, other: L) -> bool
where L: IntoLender, Self::Lend: for<'all> PartialOrd<<<L as IntoLender>::Lender as Lending<'all>>::Lend>, Self: Sized,

Documentation is incomplete. Refer to Iterator::gt for more information
Source§

fn ge<L>(self, other: L) -> bool
where L: IntoLender, Self::Lend: for<'all> PartialOrd<<<L as IntoLender>::Lender as Lending<'all>>::Lend>, Self: Sized,

Documentation is incomplete. Refer to Iterator::ge for more information
Source§

fn is_sorted<T>(self) -> bool
where Self: Sized, Self::Lend: for<'all> ToOwned<Owned = T>, T: PartialOrd,

Documentation is incomplete. Refer to Iterator::is_sorted for more information
Source§

fn is_sorted_by<T, F>(self, compare: F) -> bool
where Self: Sized, Self::Lend: for<'all> ToOwned<Owned = T>, F: FnMut(&T, &T) -> Option<Ordering>,

Documentation is incomplete. Refer to Iterator::is_sorted_by for more information
Source§

fn is_sorted_by_key<F, K>(self, f: F) -> bool
where Self: Sized, F: FnMut(Self::Lend) -> K, K: PartialOrd,

Documentation is incomplete. Refer to Iterator::is_sorted_by_key for more information
Source§

fn iter<'this>(self) -> Iter<'this, Self>
where Self: Sized + 'this, Self::Lend: 'this,

Turn this lender into an Iterator where it has already fulfilled the requirements of the Iterator trait.
Source§

fn chunky(self, chunk_size: usize) -> Chunky<Self>
where Self: Sized + ExactSizeLender,

A lending replacement for Iterator::array_chunks. Read more
Source§

impl<'a, 'text> Lending<'a> for Lines<'text>

Source§

type Lend = (usize, &'a str)

The type being lent.

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> UnwindSafe for Lines<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<L> IntoLender for L
where L: Lender,

Source§

type Lender = L

Source§

fn into_lender(self) -> L

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.