Struct encode_unicode::iterator::Utf8CharMerger[][src]

pub struct Utf8CharMerger<B: Borrow<u8>, I: Iterator<Item = B>> { /* fields omitted */ }

Decodes UTF-8 characters from a byte iterator into Utf8Chars.

See IterExt::to_utf8chars() for examples and error handling.

Implementations

impl<B: Borrow<u8>, I: Iterator<Item = B>> Utf8CharMerger<B, I>[src]

pub fn into_inner(self) -> I[src]

Extract the inner iterator.

If the last item produced by .next() was an Err, up to three following bytes might be missing.
The exact number of missing bytes for each error type should not be relied on.

Examples

Three bytes swallowed:

let mut merger = b"\xf4\xa1\xb2FS".iter().to_utf8chars();
assert!(merger.next().unwrap().is_err());
let mut inner: std::slice::Iter<u8> = merger.into_inner();
assert_eq!(inner.next(), Some(&b'S')); // b'\xa1', b'\xb2' and b'F' disappeared

All bytes present:

let mut merger = b"\xb0FS".iter().to_utf8chars();
assert!(merger.next().unwrap().is_err());
assert_eq!(merger.into_inner().next(), Some(&b'F'));

Two bytes missing:

let mut merger = b"\xe0\x80\x80FS".iter().to_utf8chars();
assert!(merger.next().unwrap().is_err());
assert_eq!(merger.into_inner().next(), Some(&b'F'));

Trait Implementations

impl<B: Clone + Borrow<u8>, I: Clone + Iterator<Item = B>> Clone for Utf8CharMerger<B, I>[src]

impl<B: Borrow<u8>, I: Iterator<Item = B> + Debug> Debug for Utf8CharMerger<B, I>[src]

impl<B: Default + Borrow<u8>, I: Default + Iterator<Item = B>> Default for Utf8CharMerger<B, I>[src]

impl<B: Borrow<u8>, I: Iterator<Item = B>, T: IntoIterator<IntoIter = I, Item = B>> From<T> for Utf8CharMerger<B, I>[src]

impl<B: Borrow<u8>, I: Iterator<Item = B>> Iterator for Utf8CharMerger<B, I>[src]

type Item = Result<Utf8Char, InvalidUtf8Slice>

The type of the elements being iterated over.

Auto Trait Implementations

impl<B, I> RefUnwindSafe for Utf8CharMerger<B, I> where
    I: RefUnwindSafe

impl<B, I> Send for Utf8CharMerger<B, I> where
    I: Send

impl<B, I> Sync for Utf8CharMerger<B, I> where
    I: Sync

impl<B, I> Unpin for Utf8CharMerger<B, I> where
    I: Unpin

impl<B, I> UnwindSafe for Utf8CharMerger<B, I> where
    I: UnwindSafe

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<!> for T[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.