Struct bytes_utils::string::BytesIter[][src]

pub struct BytesIter<S, F> { /* fields omitted */ }

Manual splitting iterator.

The methods on Str and StrMut that iterate use this internally. But it can also be used manually to generate other iterators that split the original into parts.

Implementations

impl<S, F> BytesIter<S, F> where
    S: Storage,
    F: FnMut(&str) -> Option<(usize, usize)>, 
[src]

pub fn new(s: StrInner<S>, direction: Direction, ext: F) -> Self[src]

A constructor of the iterator.

The direction specifies in what order chunks should be yielded.

The ext closure is always called with the rest of not yet split string. It shall return the byte indices of the chunk and separator border. In case of forward iteration, it is the end of them and the separator needs to end further to the string (or at the same position). In the backwards direction, it is in reverse ‒ they specify their starts and the separator is before the chunk.

Panics

If the indices don't point at a character boundary, the iteration will panic. It'll also panic if the returned indices are reversed or if they are out of bounds.

Trait Implementations

impl<S: Clone, F: Clone> Clone for BytesIter<S, F>[src]

impl<S: Debug, F: Debug> Debug for BytesIter<S, F>[src]

impl<S, F> Iterator for BytesIter<S, F> where
    S: Storage,
    F: FnMut(&str) -> Option<(usize, usize)>, 
[src]

type Item = StrInner<S>

The type of the elements being iterated over.

Auto Trait Implementations

impl<S, F> RefUnwindSafe for BytesIter<S, F> where
    F: RefUnwindSafe,
    S: RefUnwindSafe
[src]

impl<S, F> Send for BytesIter<S, F> where
    F: Send,
    S: Send
[src]

impl<S, F> Sync for BytesIter<S, F> where
    F: Sync,
    S: Sync
[src]

impl<S, F> Unpin for BytesIter<S, F> where
    F: Unpin,
    S: Unpin
[src]

impl<S, F> UnwindSafe for BytesIter<S, F> where
    F: UnwindSafe,
    S: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.