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

# [−][src]Trait std::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 `Iterator::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 `Iterator::size_hint()`’s upper bound.

## Implementors

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

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

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

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

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

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

### `impl<'_, T> TrustedLen for DrainSorted<'_, T> where
T: Ord,` [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 std::slice::Iter<'_, T>`[src]

### `impl<'_, T> TrustedLen for std::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, A> TrustedLen for Drain<'_, T, A> where
A: Allocator,` [src]

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

### `impl<T> TrustedLen for IntoIterSorted<T> where
T: Ord,` [src]

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

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

### `impl<T, A> TrustedLen for std::vec::IntoIter<T, A> where
A: Allocator,` [src]

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

Loading content...