core::iter::TrustedLen - Rust
Description: API documentation for the Rust `TrustedLen` trait in crate `core`.
Keywords: rust, rustlang, rust-lang, TrustedLen

# [−][src]Trait core::iter::TrustedLen

    pub unsafe trait TrustedLen: Iterator { }

🔬 This is a nightly-only experimental API. (`trusted_len` #37572)

An iterator that reports an accurate length using size_hint.

The iterator reports a size hint where it is either exact (lower bound is equal to upper bound), or the upper bound is `None`. The upper bound must only be `None` if the actual iterator length is larger than `usize::MAX`. In that case, the lower bound must be `usize::MAX`, resulting in a `.size_hint` of `(usize::MAX, None)`.

The iterator must produce exactly the number of elements it reported or diverge before reaching the end.

# Safety

This trait must only be implemented when the contract is upheld. Consumers of this trait must inspect `.size_hint`’s upper bound.

## Implementors

### `impl<'_> TrustedLen for Bytes<'_>`[src]

### `impl<'a, I, T: 'a> TrustedLen for Cloned<I> where
I: TrustedLen<Item = &'a T>,
T: Clone,` [src]

### `impl<'a, I, T: 'a> TrustedLen for Copied<I> where
I: TrustedLen<Item = &'a T>,
T: Copy,` [src]

### `impl<A> TrustedLen for core::option::IntoIter<A>`[src]

### `impl<A> TrustedLen for core::result::IntoIter<A>`[src]

### `impl<A, '_> TrustedLen for core::option::Iter<'_, A>`[src]

### `impl<A, '_> TrustedLen for core::option::IterMut<'_, A>`[src]

### `impl<A, '_> TrustedLen for core::result::Iter<'_, A>`[src]

### `impl<A, '_> TrustedLen for core::result::IterMut<'_, A>`[src]

### `impl<A, B> TrustedLen for Chain<A, B> where
A: TrustedLen,
B: TrustedLen<Item = A::Item>,` [src]

### `impl<A, B> TrustedLen for Zip<A, B> where
A: TrustedLen,
B: TrustedLen,` [src]

### `impl<A, F: FnMut() -> A> TrustedLen for RepeatWith<F>`[src]

### `impl<A, F: FnOnce() -> A> TrustedLen for OnceWith<F>`[src]

### `impl<A: Clone> TrustedLen for Repeat<A>`[src]

### `impl<A: Step> TrustedLen for Range<A>`[src]

### `impl<A: Step> TrustedLen for RangeFrom<A>`[src]

### `impl<A: Step> TrustedLen for RangeInclusive<A>`[src]

### `impl<B, I, F> TrustedLen for Map<I, F> where
I: TrustedLen,
F: FnMut(I::Item) -> B,` [src]

### `impl<I> TrustedLen for Enumerate<I> where
I: TrustedLen,` [src]

### `impl<I> TrustedLen for Rev<I> where
I: TrustedLen + DoubleEndedIterator,` [src]

### `impl<I: TrustedLen + ?Sized, '_> TrustedLen for &'_ mut I`[src]

### `impl<I: TrustedLen> TrustedLen for Take<I>`[src]

### `impl<T> TrustedLen for Empty<T>`[src]

### `impl<T> TrustedLen for Once<T>`[src]

### `impl<T, '_> TrustedLen for Chunks<'_, T>`[src]

### `impl<T, '_> TrustedLen for ChunksExact<'_, T>`[src]

### `impl<T, '_> TrustedLen for ChunksExactMut<'_, T>`[src]

### `impl<T, '_> TrustedLen for ChunksMut<'_, T>`[src]

### `impl<T, '_> TrustedLen for core::slice::Iter<'_, T>`[src]

### `impl<T, '_> TrustedLen for core::slice::IterMut<'_, T>`[src]

### `impl<T, '_> TrustedLen for RChunks<'_, T>`[src]

### `impl<T, '_> TrustedLen for RChunksExact<'_, T>`[src]

### `impl<T, '_> TrustedLen for RChunksExactMut<'_, T>`[src]

### `impl<T, '_> TrustedLen for RChunksMut<'_, T>`[src]

### `impl<T, '_> TrustedLen for Windows<'_, T>`[src]

### `impl<T, const N: usize> TrustedLen for core::array::IntoIter<T, N>`[src]

### `impl<T, const N: usize, '_> TrustedLen for ArrayChunks<'_, T, N>`[src]

Loading content...