code
stringlengths 2.5k
150k
| kind
stringclasses 1
value |
---|---|
rust Struct std::iter::Enumerate Struct std::iter::Enumerate
===========================
```
pub struct Enumerate<I> { /* private fields */ }
```
An iterator that yields the current count and the element during iteration.
This `struct` is created by the [`enumerate`](trait.iterator#method.enumerate) method on [`Iterator`](trait.iterator). See its documentation for more.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/iter/adapters/enumerate.rs.html#14)### impl<I> Clone for Enumerate<I>where I: [Clone](../clone/trait.clone "trait std::clone::Clone"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/enumerate.rs.html#14)#### fn clone(&self) -> Enumerate<I>
Notable traits for [Enumerate](struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)#### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/core/iter/adapters/enumerate.rs.html#14)### impl<I> Debug for Enumerate<I>where I: [Debug](../fmt/trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/enumerate.rs.html#14)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/iter/adapters/enumerate.rs.html#144)### impl<I> DoubleEndedIterator for Enumerate<I>where I: [ExactSizeIterator](trait.exactsizeiterator "trait std::iter::ExactSizeIterator") + [DoubleEndedIterator](trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/enumerate.rs.html#149)#### fn next\_back(&mut self) -> Option<(usize, <I as Iterator>::Item)>
Removes and returns an element from the end of the iterator. [Read more](trait.doubleendediterator#tymethod.next_back)
[source](https://doc.rust-lang.org/src/core/iter/adapters/enumerate.rs.html#158)#### fn nth\_back(&mut self, n: usize) -> Option<(usize, <I as Iterator>::Item)>
Returns the `n`th element from the end of the iterator. [Read more](trait.doubleendediterator#method.nth_back)
[source](https://doc.rust-lang.org/src/core/iter/adapters/enumerate.rs.html#167-171)#### fn try\_rfold<Acc, Fold, R>(&mut self, init: Acc, fold: Fold) -> Rwhere Fold: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[Enumerate](struct.enumerate "struct std::iter::Enumerate")<I> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Acc>, [Enumerate](struct.enumerate "struct std::iter::Enumerate")<I>: [Sized](../marker/trait.sized "trait std::marker::Sized"),
This is the reverse version of [`Iterator::try_fold()`](trait.iterator#method.try_fold "Iterator::try_fold()"): it takes elements starting from the back of the iterator. [Read more](trait.doubleendediterator#method.try_rfold)
[source](https://doc.rust-lang.org/src/core/iter/adapters/enumerate.rs.html#190-192)#### fn rfold<Acc, Fold>(self, init: Acc, fold: Fold) -> Accwhere Fold: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[Enumerate](struct.enumerate "struct std::iter::Enumerate")<I> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Acc,
An iterator method that reduces the iterator’s elements to a single, final value, starting from the back. [Read more](trait.doubleendediterator#method.rfold)
[source](https://doc.rust-lang.org/src/core/iter/adapters/enumerate.rs.html#211)#### fn advance\_back\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator from the back by `n` elements. [Read more](trait.doubleendediterator#method.advance_back_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#347-350)1.27.0 · #### fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator from the back that satisfies a predicate. [Read more](trait.doubleendediterator#method.rfind)
[source](https://doc.rust-lang.org/src/core/iter/adapters/enumerate.rs.html#219)### impl<I> ExactSizeIterator for Enumerate<I>where I: [ExactSizeIterator](trait.exactsizeiterator "trait std::iter::ExactSizeIterator"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/enumerate.rs.html#223)#### fn len(&self) -> usize
Returns the exact remaining length of the iterator. [Read more](trait.exactsizeiterator#method.len)
[source](https://doc.rust-lang.org/src/core/iter/adapters/enumerate.rs.html#227)#### fn is\_empty(&self) -> bool
🔬This is a nightly-only experimental API. (`exact_size_is_empty` [#35428](https://github.com/rust-lang/rust/issues/35428))
Returns `true` if the iterator is empty. [Read more](trait.exactsizeiterator#method.is_empty)
[source](https://doc.rust-lang.org/src/core/iter/adapters/enumerate.rs.html#28)### impl<I> Iterator for Enumerate<I>where I: [Iterator](trait.iterator "trait std::iter::Iterator"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/enumerate.rs.html#45)#### fn next(&mut self) -> Option<(usize, <I as Iterator>::Item)>
##### Overflow Behavior
The method does no guarding against overflows, so enumerating more than `usize::MAX` elements either produces the wrong result or panics. If debug assertions are enabled, a panic is guaranteed.
##### Panics
Might panic if the index of the element overflows a `usize`.
#### type Item = (usize, <I as Iterator>::Item)
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/iter/adapters/enumerate.rs.html#53)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/iter/adapters/enumerate.rs.html#59)#### fn nth(&mut self, n: usize) -> Option<(usize, <I as Iterator>::Item)>
Returns the `n`th element of the iterator. [Read more](trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/iter/adapters/enumerate.rs.html#67)#### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/iter/adapters/enumerate.rs.html#72-76)#### fn try\_fold<Acc, Fold, R>(&mut self, init: Acc, fold: Fold) -> Rwhere Fold: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[Enumerate](struct.enumerate "struct std::iter::Enumerate")<I> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Acc>, [Enumerate](struct.enumerate "struct std::iter::Enumerate")<I>: [Sized](../marker/trait.sized "trait std::marker::Sized"),
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/adapters/enumerate.rs.html#95-97)#### fn fold<Acc, Fold>(self, init: Acc, fold: Fold) -> Accwhere Fold: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[Enumerate](struct.enumerate "struct std::iter::Enumerate")<I> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Acc,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/adapters/enumerate.rs.html#117)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#282-284)#### fn last(self) -> Option<Self::Item>
Consumes the iterator, returning the last element. [Read more](trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)#### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)#### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)#### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)#### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)#### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)#### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)#### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](struct.peekable#method.peek) and [`peek_mut`](struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)#### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](trait.iterator#method.skip)s elements based on a predicate. [Read more](trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)#### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)#### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)#### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)#### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)#### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)#### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)#### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)#### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)#### fn collect<B>(self) -> Bwhere B: [FromIterator](trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](trait.extend "trait std::iter::Extend")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)#### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)#### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)#### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)#### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)#### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)#### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)#### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](trait.sum "trait std::iter::Sum")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](trait.product "trait std::iter::Product")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another. [Read more](trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are equal to those of another. [Read more](trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are unequal to those of another. [Read more](trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](trait.iterator#method.is_sorted_by_key)
[source](https://doc.rust-lang.org/src/core/iter/adapters/enumerate.rs.html#246)1.26.0 · ### impl<I> FusedIterator for Enumerate<I>where I: [FusedIterator](trait.fusediterator "trait std::iter::FusedIterator"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/enumerate.rs.html#249)### impl<I> TrustedLen for Enumerate<I>where I: [TrustedLen](trait.trustedlen "trait std::iter::TrustedLen"),
Auto Trait Implementations
--------------------------
### impl<I> RefUnwindSafe for Enumerate<I>where I: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<I> Send for Enumerate<I>where I: [Send](../marker/trait.send "trait std::marker::Send"),
### impl<I> Sync for Enumerate<I>where I: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<I> Unpin for Enumerate<I>where I: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"),
### impl<I> UnwindSafe for Enumerate<I>where I: [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"),
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Function std::iter::from_fn Function std::iter::from\_fn
============================
```
pub fn from_fn<T, F>(f: F) -> FromFn<F>ⓘNotable traits for FromFn<F>impl<T, F> Iterator for FromFn<F>where F: FnMut() -> Option<T>, type Item = T;where F: FnMut() -> Option<T>,
```
Creates a new iterator where each iteration calls the provided closure `F: FnMut() -> Option<T>`.
This allows creating a custom iterator with any behavior without using the more verbose syntax of creating a dedicated type and implementing the [`Iterator`](trait.iterator "Iterator") trait for it.
Note that the `FromFn` iterator doesn’t make assumptions about the behavior of the closure, and therefore conservatively does not implement [`FusedIterator`](trait.fusediterator), or override [`Iterator::size_hint()`](trait.iterator#method.size_hint "Iterator::size_hint()") from its default `(0, None)`.
The closure can use captures and its environment to track state across iterations. Depending on how the iterator is used, this may require specifying the [`move`](../keyword.move) keyword on the closure.
Examples
--------
Let’s re-implement the counter iterator from [module-level documentation](index):
```
let mut count = 0;
let counter = std::iter::from_fn(move || {
// Increment our count. This is why we started at zero.
count += 1;
// Check to see if we've finished counting or not.
if count < 6 {
Some(count)
} else {
None
}
});
assert_eq!(counter.collect::<Vec<_>>(), &[1, 2, 3, 4, 5]);
```
rust Struct std::iter::Successors Struct std::iter::Successors
============================
```
pub struct Successors<T, F> { /* private fields */ }
```
An new iterator where each successive item is computed based on the preceding one.
This `struct` is created by the [`iter::successors()`](fn.successors) function. See its documentation for more.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/iter/sources/successors.rs.html#31)### impl<T, F> Clone for Successors<T, F>where T: [Clone](../clone/trait.clone "trait std::clone::Clone"), F: [Clone](../clone/trait.clone "trait std::clone::Clone"),
[source](https://doc.rust-lang.org/src/core/iter/sources/successors.rs.html#31)#### fn clone(&self) -> Successors<T, F>
Notable traits for [Successors](struct.successors "struct std::iter::Successors")<T, F>
```
impl<T, F> Iterator for Successors<T, F>where
F: FnMut(&T) -> Option<T>,
type Item = T;
```
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)1.0.0 · #### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/core/iter/sources/successors.rs.html#62)### impl<T, F> Debug for Successors<T, F>where T: [Debug](../fmt/trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/iter/sources/successors.rs.html#63)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/iter/sources/successors.rs.html#39)### impl<T, F> Iterator for Successors<T, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [Option](../option/enum.option "enum std::option::Option")<T>,
#### type Item = T
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/iter/sources/successors.rs.html#46)#### fn next(&mut self) -> Option<<Successors<T, F> as Iterator>::Item>
Advances the iterator and returns the next value. [Read more](trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/iter/sources/successors.rs.html#53)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#252-254)1.0.0 · #### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#282-284)1.0.0 · #### fn last(self) -> Option<Self::Item>
Consumes the iterator, returning the last element. [Read more](trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#328)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#376)1.0.0 · #### fn nth(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element of the iterator. [Read more](trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)1.0.0 · #### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)1.0.0 · #### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)1.0.0 · #### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)1.0.0 · #### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)1.0.0 · #### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)1.0.0 · #### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)1.0.0 · #### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](struct.peekable#method.peek) and [`peek_mut`](struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)1.0.0 · #### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](trait.iterator#method.skip)s elements based on a predicate. [Read more](trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)1.0.0 · #### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)1.0.0 · #### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)1.0.0 · #### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)1.0.0 · #### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)1.0.0 · #### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)1.0.0 · #### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)1.0.0 · #### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)1.0.0 · #### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)1.0.0 · #### fn collect<B>(self) -> Bwhere B: [FromIterator](trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](trait.extend "trait std::iter::Extend")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)1.0.0 · #### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2230-2234)1.27.0 · #### fn try\_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2407-2410)1.0.0 · #### fn fold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)1.0.0 · #### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)1.0.0 · #### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)1.0.0 · #### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)1.0.0 · #### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)1.0.0 · #### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)1.0.0 · #### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](trait.sum "trait std::iter::Sum")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](trait.product "trait std::iter::Product")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another. [Read more](trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are equal to those of another. [Read more](trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are unequal to those of another. [Read more](trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](trait.iterator#method.is_sorted_by_key)
[source](https://doc.rust-lang.org/src/core/iter/sources/successors.rs.html#59)### impl<T, F> FusedIterator for Successors<T, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [Option](../option/enum.option "enum std::option::Option")<T>,
Auto Trait Implementations
--------------------------
### impl<T, F> RefUnwindSafe for Successors<T, F>where F: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"), T: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<T, F> Send for Successors<T, F>where F: [Send](../marker/trait.send "trait std::marker::Send"), T: [Send](../marker/trait.send "trait std::marker::Send"),
### impl<T, F> Sync for Successors<T, F>where F: [Sync](../marker/trait.sync "trait std::marker::Sync"), T: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<T, F> Unpin for Successors<T, F>where F: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"), T: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"),
### impl<T, F> UnwindSafe for Successors<T, F>where F: [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"), T: [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"),
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Struct std::iter::FlatMap Struct std::iter::FlatMap
=========================
```
pub struct FlatMap<I, U, F>where U: IntoIterator,{ /* private fields */ }
```
An iterator that maps each element to an iterator, and yields the elements of the produced iterators.
This `struct` is created by [`Iterator::flat_map`](trait.iterator#method.flat_map "Iterator::flat_map"). See its documentation for more.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/iter/adapters/flatten.rs.html#23)### impl<I, U, F> Clone for FlatMap<I, U, F>where I: [Clone](../clone/trait.clone "trait std::clone::Clone"), F: [Clone](../clone/trait.clone "trait std::clone::Clone"), U: [Clone](../clone/trait.clone "trait std::clone::Clone") + [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), <U as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[IntoIter](trait.intoiterator#associatedtype.IntoIter "type std::iter::IntoIterator::IntoIter"): [Clone](../clone/trait.clone "trait std::clone::Clone"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/flatten.rs.html#27)#### fn clone(&self) -> FlatMap<I, U, F>
Notable traits for [FlatMap](struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)#### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/core/iter/adapters/flatten.rs.html#33)1.9.0 · ### impl<I, U, F> Debug for FlatMap<I, U, F>where I: [Debug](../fmt/trait.debug "trait std::fmt::Debug"), U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), <U as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[IntoIter](trait.intoiterator#associatedtype.IntoIter "type std::iter::IntoIterator::IntoIter"): [Debug](../fmt/trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/flatten.rs.html#37)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/iter/adapters/flatten.rs.html#94)### impl<I, U, F> DoubleEndedIterator for FlatMap<I, U, F>where I: [DoubleEndedIterator](trait.doubleendediterator "trait std::iter::DoubleEndedIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U, U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), <U as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[IntoIter](trait.intoiterator#associatedtype.IntoIter "type std::iter::IntoIterator::IntoIter"): [DoubleEndedIterator](trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/flatten.rs.html#100)#### fn next\_back(&mut self) -> Option<<U as IntoIterator>::Item>
Removes and returns an element from the end of the iterator. [Read more](trait.doubleendediterator#tymethod.next_back)
[source](https://doc.rust-lang.org/src/core/iter/adapters/flatten.rs.html#105-109)#### fn try\_rfold<Acc, Fold, R>(&mut self, init: Acc, fold: Fold) -> Rwhere Fold: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[FlatMap](struct.flatmap "struct std::iter::FlatMap")<I, U, F> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Acc>, [FlatMap](struct.flatmap "struct std::iter::FlatMap")<I, U, F>: [Sized](../marker/trait.sized "trait std::marker::Sized"),
This is the reverse version of [`Iterator::try_fold()`](trait.iterator#method.try_fold "Iterator::try_fold()"): it takes elements starting from the back of the iterator. [Read more](trait.doubleendediterator#method.try_rfold)
[source](https://doc.rust-lang.org/src/core/iter/adapters/flatten.rs.html#115-117)#### fn rfold<Acc, Fold>(self, init: Acc, fold: Fold) -> Accwhere Fold: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[FlatMap](struct.flatmap "struct std::iter::FlatMap")<I, U, F> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Acc,
An iterator method that reduces the iterator’s elements to a single, final value, starting from the back. [Read more](trait.doubleendediterator#method.rfold)
[source](https://doc.rust-lang.org/src/core/iter/adapters/flatten.rs.html#123)#### fn advance\_back\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator from the back by `n` elements. [Read more](trait.doubleendediterator#method.advance_back_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#184)1.37.0 · #### fn nth\_back(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element from the end of the iterator. [Read more](trait.doubleendediterator#method.nth_back)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#347-350)1.27.0 · #### fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator from the back that satisfies a predicate. [Read more](trait.doubleendediterator#method.rfind)
[source](https://doc.rust-lang.org/src/core/iter/adapters/flatten.rs.html#43)### impl<I, U, F> Iterator for FlatMap<I, U, F>where I: [Iterator](trait.iterator "trait std::iter::Iterator"), U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
#### type Item = <U as IntoIterator>::Item
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/iter/adapters/flatten.rs.html#50)#### fn next(&mut self) -> Option<<U as IntoIterator>::Item>
Advances the iterator and returns the next value. [Read more](trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/iter/adapters/flatten.rs.html#55)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/iter/adapters/flatten.rs.html#60-64)#### fn try\_fold<Acc, Fold, R>(&mut self, init: Acc, fold: Fold) -> Rwhere Fold: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[FlatMap](struct.flatmap "struct std::iter::FlatMap")<I, U, F> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Acc>, [FlatMap](struct.flatmap "struct std::iter::FlatMap")<I, U, F>: [Sized](../marker/trait.sized "trait std::marker::Sized"),
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/adapters/flatten.rs.html#70-72)#### fn fold<Acc, Fold>(self, init: Acc, fold: Fold) -> Accwhere Fold: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[FlatMap](struct.flatmap "struct std::iter::FlatMap")<I, U, F> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Acc,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/adapters/flatten.rs.html#78)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/adapters/flatten.rs.html#83)#### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/iter/adapters/flatten.rs.html#88)#### fn last(self) -> Option<<FlatMap<I, U, F> as Iterator>::Item>
Consumes the iterator, returning the last element. [Read more](trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#376)#### fn nth(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element of the iterator. [Read more](trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)#### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)#### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)#### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)#### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)#### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)#### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)#### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](struct.peekable#method.peek) and [`peek_mut`](struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)#### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](trait.iterator#method.skip)s elements based on a predicate. [Read more](trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)#### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)#### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)#### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)#### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)#### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)#### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)#### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)#### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)#### fn collect<B>(self) -> Bwhere B: [FromIterator](trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](trait.extend "trait std::iter::Extend")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)#### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)#### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)#### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)#### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)#### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)#### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)#### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](trait.sum "trait std::iter::Sum")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](trait.product "trait std::iter::Product")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another. [Read more](trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are equal to those of another. [Read more](trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are unequal to those of another. [Read more](trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](trait.iterator#method.is_sorted_by_key)
[source](https://doc.rust-lang.org/src/core/iter/adapters/flatten.rs.html#129)1.26.0 · ### impl<I, U, F> FusedIterator for FlatMap<I, U, F>where I: [FusedIterator](trait.fusediterator "trait std::iter::FusedIterator"), U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
[source](https://doc.rust-lang.org/src/core/iter/adapters/flatten.rs.html#146)### impl<'a, T, I, F, const N: usize> TrustedLen for FlatMap<I, &'a [T; N], F>where I: [TrustedLen](trait.trustedlen "trait std::iter::TrustedLen"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> &'a [[](../primitive.array)T[; N]](../primitive.array),
[source](https://doc.rust-lang.org/src/core/iter/adapters/flatten.rs.html#154)### impl<'a, T, I, F, const N: usize> TrustedLen for FlatMap<I, &'a mut [T; N], F>where I: [TrustedLen](trait.trustedlen "trait std::iter::TrustedLen"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> &'a mut [[](../primitive.array)T[; N]](../primitive.array),
[source](https://doc.rust-lang.org/src/core/iter/adapters/flatten.rs.html#138)### impl<T, I, F, const N: usize> TrustedLen for FlatMap<I, [T; N], F>where I: [TrustedLen](trait.trustedlen "trait std::iter::TrustedLen"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [[](../primitive.array)T[; N]](../primitive.array),
Auto Trait Implementations
--------------------------
### impl<I, U, F> RefUnwindSafe for FlatMap<I, U, F>where F: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"), I: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"), <U as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[IntoIter](trait.intoiterator#associatedtype.IntoIter "type std::iter::IntoIterator::IntoIter"): [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<I, U, F> Send for FlatMap<I, U, F>where F: [Send](../marker/trait.send "trait std::marker::Send"), I: [Send](../marker/trait.send "trait std::marker::Send"), <U as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[IntoIter](trait.intoiterator#associatedtype.IntoIter "type std::iter::IntoIterator::IntoIter"): [Send](../marker/trait.send "trait std::marker::Send"),
### impl<I, U, F> Sync for FlatMap<I, U, F>where F: [Sync](../marker/trait.sync "trait std::marker::Sync"), I: [Sync](../marker/trait.sync "trait std::marker::Sync"), <U as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[IntoIter](trait.intoiterator#associatedtype.IntoIter "type std::iter::IntoIterator::IntoIter"): [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<I, U, F> Unpin for FlatMap<I, U, F>where F: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"), I: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"), <U as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[IntoIter](trait.intoiterator#associatedtype.IntoIter "type std::iter::IntoIterator::IntoIter"): [Unpin](../marker/trait.unpin "trait std::marker::Unpin"),
### impl<I, U, F> UnwindSafe for FlatMap<I, U, F>where F: [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"), I: [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"), <U as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[IntoIter](trait.intoiterator#associatedtype.IntoIter "type std::iter::IntoIterator::IntoIter"): [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"),
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Struct std::iter::Scan Struct std::iter::Scan
======================
```
pub struct Scan<I, St, F> { /* private fields */ }
```
An iterator to maintain state while iterating another iterator.
This `struct` is created by the [`scan`](trait.iterator#method.scan) method on [`Iterator`](trait.iterator). See its documentation for more.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/iter/adapters/scan.rs.html#14)### impl<I, St, F> Clone for Scan<I, St, F>where I: [Clone](../clone/trait.clone "trait std::clone::Clone"), St: [Clone](../clone/trait.clone "trait std::clone::Clone"), F: [Clone](../clone/trait.clone "trait std::clone::Clone"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/scan.rs.html#14)#### fn clone(&self) -> Scan<I, St, F>
Notable traits for [Scan](struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)#### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/core/iter/adapters/scan.rs.html#28)1.9.0 · ### impl<I, St, F> Debug for Scan<I, St, F>where I: [Debug](../fmt/trait.debug "trait std::fmt::Debug"), St: [Debug](../fmt/trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/scan.rs.html#29)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/iter/adapters/scan.rs.html#35)### impl<B, I, St, F> Iterator for Scan<I, St, F>where I: [Iterator](trait.iterator "trait std::iter::Iterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, <I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
#### type Item = B
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/iter/adapters/scan.rs.html#43)#### fn next(&mut self) -> Option<B>
Advances the iterator and returns the next value. [Read more](trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/iter/adapters/scan.rs.html#49)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/iter/adapters/scan.rs.html#55-59)#### fn try\_fold<Acc, Fold, R>(&mut self, init: Acc, fold: Fold) -> Rwhere Fold: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[Scan](struct.scan "struct std::iter::Scan")<I, St, F> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Acc>, [Scan](struct.scan "struct std::iter::Scan")<I, St, F>: [Sized](../marker/trait.sized "trait std::marker::Sized"),
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/adapters/scan.rs.html#78-81)#### fn fold<Acc, Fold>(self, init: Acc, fold: Fold) -> Accwhere Fold: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[Scan](struct.scan "struct std::iter::Scan")<I, St, F> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Acc, [Scan](struct.scan "struct std::iter::Scan")<I, St, F>: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#252-254)#### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#282-284)#### fn last(self) -> Option<Self::Item>
Consumes the iterator, returning the last element. [Read more](trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#328)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#376)#### fn nth(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element of the iterator. [Read more](trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)#### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)#### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)#### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)#### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)#### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)#### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)#### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](struct.peekable#method.peek) and [`peek_mut`](struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)#### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](trait.iterator#method.skip)s elements based on a predicate. [Read more](trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)#### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)#### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)#### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)#### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)#### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)#### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)#### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)#### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)#### fn collect<B>(self) -> Bwhere B: [FromIterator](trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](trait.extend "trait std::iter::Extend")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)#### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)#### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)#### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)#### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)#### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)#### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)#### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](trait.sum "trait std::iter::Sum")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](trait.product "trait std::iter::Product")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another. [Read more](trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are equal to those of another. [Read more](trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are unequal to those of another. [Read more](trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](trait.iterator#method.is_sorted_by_key)
Auto Trait Implementations
--------------------------
### impl<I, St, F> RefUnwindSafe for Scan<I, St, F>where F: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"), I: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"), St: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<I, St, F> Send for Scan<I, St, F>where F: [Send](../marker/trait.send "trait std::marker::Send"), I: [Send](../marker/trait.send "trait std::marker::Send"), St: [Send](../marker/trait.send "trait std::marker::Send"),
### impl<I, St, F> Sync for Scan<I, St, F>where F: [Sync](../marker/trait.sync "trait std::marker::Sync"), I: [Sync](../marker/trait.sync "trait std::marker::Sync"), St: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<I, St, F> Unpin for Scan<I, St, F>where F: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"), I: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"), St: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"),
### impl<I, St, F> UnwindSafe for Scan<I, St, F>where F: [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"), I: [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"), St: [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"),
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Struct std::iter::ArrayChunks Struct std::iter::ArrayChunks
=============================
```
pub struct ArrayChunks<I, const N: usize>where I: Iterator,{ /* private fields */ }
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
An iterator over `N` elements of the iterator at a time.
The chunks do not overlap. If `N` does not divide the length of the iterator, then the last up to `N-1` elements will be omitted.
This `struct` is created by the [`array_chunks`](trait.iterator#method.array_chunks "Iterator::array_chunks") method on [`Iterator`](trait.iterator "Iterator"). See its documentation for more.
Implementations
---------------
[source](https://doc.rust-lang.org/src/core/iter/adapters/array_chunks.rs.html#20)### impl<I, const N: usize> ArrayChunks<I, N>where I: [Iterator](trait.iterator "trait std::iter::Iterator"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/array_chunks.rs.html#35)#### pub fn into\_remainder(self) -> Option<IntoIter<<I as Iterator>::Item, N>>
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over the remaining elements of the original iterator that are not going to be returned by this iterator. The returned iterator will yield at most `N-1` elements.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/iter/adapters/array_chunks.rs.html#12)### impl<I, const N: usize> Clone for ArrayChunks<I, N>where I: [Clone](../clone/trait.clone "trait std::clone::Clone") + [Iterator](trait.iterator "trait std::iter::Iterator"), <I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [Clone](../clone/trait.clone "trait std::clone::Clone"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/array_chunks.rs.html#12)#### fn clone(&self) -> ArrayChunks<I, N>
Notable traits for [ArrayChunks](struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)1.0.0 · #### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/core/iter/adapters/array_chunks.rs.html#12)### impl<I, const N: usize> Debug for ArrayChunks<I, N>where I: [Debug](../fmt/trait.debug "trait std::fmt::Debug") + [Iterator](trait.iterator "trait std::iter::Iterator"), <I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [Debug](../fmt/trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/array_chunks.rs.html#12)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/iter/adapters/array_chunks.rs.html#95)### impl<I, const N: usize> DoubleEndedIterator for ArrayChunks<I, N>where I: [DoubleEndedIterator](trait.doubleendediterator "trait std::iter::DoubleEndedIterator") + [ExactSizeIterator](trait.exactsizeiterator "trait std::iter::ExactSizeIterator"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/array_chunks.rs.html#100)#### fn next\_back(&mut self) -> Option<<ArrayChunks<I, N> as Iterator>::Item>
Removes and returns an element from the end of the iterator. [Read more](trait.doubleendediterator#tymethod.next_back)
[source](https://doc.rust-lang.org/src/core/iter/adapters/array_chunks.rs.html#104-108)#### fn try\_rfold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, <[ArrayChunks](struct.arraychunks "struct std::iter::ArrayChunks")<I, N> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>, [ArrayChunks](struct.arraychunks "struct std::iter::ArrayChunks")<I, N>: [Sized](../marker/trait.sized "trait std::marker::Sized"),
This is the reverse version of [`Iterator::try_fold()`](trait.iterator#method.try_fold "Iterator::try_fold()"): it takes elements starting from the back of the iterator. [Read more](trait.doubleendediterator#method.try_rfold)
[source](https://doc.rust-lang.org/src/core/iter/adapters/array_chunks.rs.html#129-132)#### fn rfold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, <[ArrayChunks](struct.arraychunks "struct std::iter::ArrayChunks")<I, N> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B, [ArrayChunks](struct.arraychunks "struct std::iter::ArrayChunks")<I, N>: [Sized](../marker/trait.sized "trait std::marker::Sized"),
An iterator method that reduces the iterator’s elements to a single, final value, starting from the back. [Read more](trait.doubleendediterator#method.rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#134)#### fn advance\_back\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator from the back by `n` elements. [Read more](trait.doubleendediterator#method.advance_back_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#184)1.37.0 · #### fn nth\_back(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element from the end of the iterator. [Read more](trait.doubleendediterator#method.nth_back)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#347-350)1.27.0 · #### fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator from the back that satisfies a predicate. [Read more](trait.doubleendediterator#method.rfind)
[source](https://doc.rust-lang.org/src/core/iter/adapters/array_chunks.rs.html#169)### impl<I, const N: usize> ExactSizeIterator for ArrayChunks<I, N>where I: [ExactSizeIterator](trait.exactsizeiterator "trait std::iter::ExactSizeIterator"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/array_chunks.rs.html#174)#### fn len(&self) -> usize
Returns the exact remaining length of the iterator. [Read more](trait.exactsizeiterator#method.len)
[source](https://doc.rust-lang.org/src/core/iter/adapters/array_chunks.rs.html#179)#### fn is\_empty(&self) -> bool
🔬This is a nightly-only experimental API. (`exact_size_is_empty` [#35428](https://github.com/rust-lang/rust/issues/35428))
Returns `true` if the iterator is empty. [Read more](trait.exactsizeiterator#method.is_empty)
[source](https://doc.rust-lang.org/src/core/iter/adapters/array_chunks.rs.html#41)### impl<I, const N: usize> Iterator for ArrayChunks<I, N>where I: [Iterator](trait.iterator "trait std::iter::Iterator"),
#### type Item = [<I as Iterator>::Item; N]
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/iter/adapters/array_chunks.rs.html#48)#### fn next(&mut self) -> Option<<ArrayChunks<I, N> as Iterator>::Item>
Advances the iterator and returns the next value. [Read more](trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/iter/adapters/array_chunks.rs.html#53)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/iter/adapters/array_chunks.rs.html#60)#### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/iter/adapters/array_chunks.rs.html#64-68)#### fn try\_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, <[ArrayChunks](struct.arraychunks "struct std::iter::ArrayChunks")<I, N> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>, [ArrayChunks](struct.arraychunks "struct std::iter::ArrayChunks")<I, N>: [Sized](../marker/trait.sized "trait std::marker::Sized"),
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/adapters/array_chunks.rs.html#85-88)#### fn fold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, <[ArrayChunks](struct.arraychunks "struct std::iter::ArrayChunks")<I, N> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B, [ArrayChunks](struct.arraychunks "struct std::iter::ArrayChunks")<I, N>: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#282-284)1.0.0 · #### fn last(self) -> Option<Self::Item>
Consumes the iterator, returning the last element. [Read more](trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#328)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#376)1.0.0 · #### fn nth(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element of the iterator. [Read more](trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)1.0.0 · #### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)1.0.0 · #### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)1.0.0 · #### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)1.0.0 · #### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)1.0.0 · #### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)1.0.0 · #### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)1.0.0 · #### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](struct.peekable#method.peek) and [`peek_mut`](struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)1.0.0 · #### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](trait.iterator#method.skip)s elements based on a predicate. [Read more](trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)1.0.0 · #### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)1.0.0 · #### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)1.0.0 · #### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)1.0.0 · #### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)1.0.0 · #### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)1.0.0 · #### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)1.0.0 · #### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)1.0.0 · #### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)1.0.0 · #### fn collect<B>(self) -> Bwhere B: [FromIterator](trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](trait.extend "trait std::iter::Extend")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)1.0.0 · #### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)1.0.0 · #### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)1.0.0 · #### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)1.0.0 · #### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)1.0.0 · #### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)1.0.0 · #### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)1.0.0 · #### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](trait.sum "trait std::iter::Sum")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](trait.product "trait std::iter::Product")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another. [Read more](trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are equal to those of another. [Read more](trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are unequal to those of another. [Read more](trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](trait.iterator#method.is_sorted_by_key)
[source](https://doc.rust-lang.org/src/core/iter/adapters/array_chunks.rs.html#166)### impl<I, const N: usize> FusedIterator for ArrayChunks<I, N>where I: [FusedIterator](trait.fusediterator "trait std::iter::FusedIterator"),
Auto Trait Implementations
--------------------------
### impl<I, const N: usize> RefUnwindSafe for ArrayChunks<I, N>where I: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"), <I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<I, const N: usize> Send for ArrayChunks<I, N>where I: [Send](../marker/trait.send "trait std::marker::Send"), <I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [Send](../marker/trait.send "trait std::marker::Send"),
### impl<I, const N: usize> Sync for ArrayChunks<I, N>where I: [Sync](../marker/trait.sync "trait std::marker::Sync"), <I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<I, const N: usize> Unpin for ArrayChunks<I, N>where I: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"), <I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [Unpin](../marker/trait.unpin "trait std::marker::Unpin"),
### impl<I, const N: usize> UnwindSafe for ArrayChunks<I, N>where I: [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"), <I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"),
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Struct std::iter::Rev Struct std::iter::Rev
=====================
```
pub struct Rev<T> { /* private fields */ }
```
A double-ended iterator with the direction inverted.
This `struct` is created by the [`rev`](trait.iterator#method.rev) method on [`Iterator`](trait.iterator). See its documentation for more.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/iter/adapters/rev.rs.html#11)### impl<T> Clone for Rev<T>where T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/rev.rs.html#11)#### fn clone(&self) -> Rev<T>
Notable traits for [Rev](struct.rev "struct std::iter::Rev")<I>
```
impl<I> Iterator for Rev<I>where
I: DoubleEndedIterator,
type Item = <I as Iterator>::Item;
```
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)#### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/core/iter/adapters/rev.rs.html#11)### impl<T> Debug for Rev<T>where T: [Debug](../fmt/trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/rev.rs.html#11)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/iter/adapters/rev.rs.html#76)### impl<I> DoubleEndedIterator for Rev<I>where I: [DoubleEndedIterator](trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/rev.rs.html#81)#### fn next\_back(&mut self) -> Option<<I as Iterator>::Item>
Removes and returns an element from the end of the iterator. [Read more](trait.doubleendediterator#tymethod.next_back)
[source](https://doc.rust-lang.org/src/core/iter/adapters/rev.rs.html#86)#### fn advance\_back\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator from the back by `n` elements. [Read more](trait.doubleendediterator#method.advance_back_by)
[source](https://doc.rust-lang.org/src/core/iter/adapters/rev.rs.html#91)#### fn nth\_back(&mut self, n: usize) -> Option<<I as Iterator>::Item>
Returns the `n`th element from the end of the iterator. [Read more](trait.doubleendediterator#method.nth_back)
[source](https://doc.rust-lang.org/src/core/iter/adapters/rev.rs.html#95-99)#### fn try\_rfold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, <[Rev](struct.rev "struct std::iter::Rev")<I> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>, [Rev](struct.rev "struct std::iter::Rev")<I>: [Sized](../marker/trait.sized "trait std::marker::Sized"),
This is the reverse version of [`Iterator::try_fold()`](trait.iterator#method.try_fold "Iterator::try_fold()"): it takes elements starting from the back of the iterator. [Read more](trait.doubleendediterator#method.try_rfold)
[source](https://doc.rust-lang.org/src/core/iter/adapters/rev.rs.html#104-106)#### fn rfold<Acc, F>(self, init: Acc, f: F) -> Accwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[Rev](struct.rev "struct std::iter::Rev")<I> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Acc,
An iterator method that reduces the iterator’s elements to a single, final value, starting from the back. [Read more](trait.doubleendediterator#method.rfold)
[source](https://doc.rust-lang.org/src/core/iter/adapters/rev.rs.html#111-113)#### fn rfind<P>(&mut self, predicate: P) -> Option<<Rev<I> as Iterator>::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&<[Rev](struct.rev "struct std::iter::Rev")<I> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator from the back that satisfies a predicate. [Read more](trait.doubleendediterator#method.rfind)
[source](https://doc.rust-lang.org/src/core/iter/adapters/rev.rs.html#120)### impl<I> ExactSizeIterator for Rev<I>where I: [ExactSizeIterator](trait.exactsizeiterator "trait std::iter::ExactSizeIterator") + [DoubleEndedIterator](trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/rev.rs.html#124)#### fn len(&self) -> usize
Returns the exact remaining length of the iterator. [Read more](trait.exactsizeiterator#method.len)
[source](https://doc.rust-lang.org/src/core/iter/adapters/rev.rs.html#128)#### fn is\_empty(&self) -> bool
🔬This is a nightly-only experimental API. (`exact_size_is_empty` [#35428](https://github.com/rust-lang/rust/issues/35428))
Returns `true` if the iterator is empty. [Read more](trait.exactsizeiterator#method.is_empty)
[source](https://doc.rust-lang.org/src/core/iter/adapters/rev.rs.html#25)### impl<I> Iterator for Rev<I>where I: [DoubleEndedIterator](trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
#### type Item = <I as Iterator>::Item
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/iter/adapters/rev.rs.html#32)#### fn next(&mut self) -> Option<<I as Iterator>::Item>
Advances the iterator and returns the next value. [Read more](trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/iter/adapters/rev.rs.html#36)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/iter/adapters/rev.rs.html#41)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/adapters/rev.rs.html#46)#### fn nth(&mut self, n: usize) -> Option<<I as Iterator>::Item>
Returns the `n`th element of the iterator. [Read more](trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/iter/adapters/rev.rs.html#50-54)#### fn try\_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, <[Rev](struct.rev "struct std::iter::Rev")<I> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>, [Rev](struct.rev "struct std::iter::Rev")<I>: [Sized](../marker/trait.sized "trait std::marker::Sized"),
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/adapters/rev.rs.html#59-61)#### fn fold<Acc, F>(self, init: Acc, f: F) -> Accwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[Rev](struct.rev "struct std::iter::Rev")<I> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Acc,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/adapters/rev.rs.html#67-69)#### fn find<P>(&mut self, predicate: P) -> Option<<Rev<I> as Iterator>::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&<[Rev](struct.rev "struct std::iter::Rev")<I> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#252-254)#### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#282-284)#### fn last(self) -> Option<Self::Item>
Consumes the iterator, returning the last element. [Read more](trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)#### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)#### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)#### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)#### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)#### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)#### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)#### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](struct.peekable#method.peek) and [`peek_mut`](struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)#### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](trait.iterator#method.skip)s elements based on a predicate. [Read more](trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)#### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)#### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)#### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)#### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)#### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)#### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)#### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)#### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)#### fn collect<B>(self) -> Bwhere B: [FromIterator](trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](trait.extend "trait std::iter::Extend")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)#### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2079-2082)#### fn partition\_in\_place<'a, T, P>(self, predicate: P) -> usizewhere T: 'a, Self: [DoubleEndedIterator](trait.doubleendediterator "trait std::iter::DoubleEndedIterator")<Item = [&'a mut](../primitive.reference) T>, P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_partition_in_place` [#62543](https://github.com/rust-lang/rust/issues/62543))
Reorders the elements of this iterator *in-place* according to the given predicate, such that all those that return `true` precede all those that return `false`. Returns the number of `true` elements found. [Read more](trait.iterator#method.partition_in_place)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)#### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)#### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)#### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3161-3163)#### fn rev(self) -> Rev<Self>where Self: [DoubleEndedIterator](trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
Notable traits for [Rev](struct.rev "struct std::iter::Rev")<I>
```
impl<I> Iterator for Rev<I>where
I: DoubleEndedIterator,
type Item = <I as Iterator>::Item;
```
Reverses an iterator’s direction. [Read more](trait.iterator#method.rev)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)#### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)#### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](trait.sum "trait std::iter::Sum")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](trait.product "trait std::iter::Product")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another. [Read more](trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are equal to those of another. [Read more](trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are unequal to those of another. [Read more](trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](trait.iterator#method.is_sorted_by_key)
[source](https://doc.rust-lang.org/src/core/iter/adapters/rev.rs.html#134)1.26.0 · ### impl<I> FusedIterator for Rev<I>where I: [FusedIterator](trait.fusediterator "trait std::iter::FusedIterator") + [DoubleEndedIterator](trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/rev.rs.html#137)### impl<I> TrustedLen for Rev<I>where I: [TrustedLen](trait.trustedlen "trait std::iter::TrustedLen") + [DoubleEndedIterator](trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
Auto Trait Implementations
--------------------------
### impl<T> RefUnwindSafe for Rev<T>where T: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<T> Send for Rev<T>where T: [Send](../marker/trait.send "trait std::marker::Send"),
### impl<T> Sync for Rev<T>where T: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<T> Unpin for Rev<T>where T: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"),
### impl<T> UnwindSafe for Rev<T>where T: [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"),
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Struct std::iter::Take Struct std::iter::Take
======================
```
pub struct Take<I> { /* private fields */ }
```
An iterator that only iterates over the first `n` iterations of `iter`.
This `struct` is created by the [`take`](trait.iterator#method.take) method on [`Iterator`](trait.iterator). See its documentation for more.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/iter/adapters/take.rs.html#12)### impl<I> Clone for Take<I>where I: [Clone](../clone/trait.clone "trait std::clone::Clone"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/take.rs.html#12)#### fn clone(&self) -> Take<I>
Notable traits for [Take](struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)#### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/core/iter/adapters/take.rs.html#12)### impl<I> Debug for Take<I>where I: [Debug](../fmt/trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/take.rs.html#12)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/iter/adapters/take.rs.html#150)1.38.0 · ### impl<I> DoubleEndedIterator for Take<I>where I: [DoubleEndedIterator](trait.doubleendediterator "trait std::iter::DoubleEndedIterator") + [ExactSizeIterator](trait.exactsizeiterator "trait std::iter::ExactSizeIterator"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/take.rs.html#155)#### fn next\_back(&mut self) -> Option<<Take<I> as Iterator>::Item>
Removes and returns an element from the end of the iterator. [Read more](trait.doubleendediterator#tymethod.next_back)
[source](https://doc.rust-lang.org/src/core/iter/adapters/take.rs.html#166)#### fn nth\_back(&mut self, n: usize) -> Option<<Take<I> as Iterator>::Item>
Returns the `n`th element from the end of the iterator. [Read more](trait.doubleendediterator#method.nth_back)
[source](https://doc.rust-lang.org/src/core/iter/adapters/take.rs.html#181-185)#### fn try\_rfold<Acc, Fold, R>(&mut self, init: Acc, fold: Fold) -> Rwhere Fold: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[Take](struct.take "struct std::iter::Take")<I> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Acc>, [Take](struct.take "struct std::iter::Take")<I>: [Sized](../marker/trait.sized "trait std::marker::Sized"),
This is the reverse version of [`Iterator::try_fold()`](trait.iterator#method.try_fold "Iterator::try_fold()"): it takes elements starting from the back of the iterator. [Read more](trait.doubleendediterator#method.try_rfold)
[source](https://doc.rust-lang.org/src/core/iter/adapters/take.rs.html#200-203)#### fn rfold<Acc, Fold>(self, init: Acc, fold: Fold) -> Accwhere Fold: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[Take](struct.take "struct std::iter::Take")<I> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Acc, [Take](struct.take "struct std::iter::Take")<I>: [Sized](../marker/trait.sized "trait std::marker::Sized"),
An iterator method that reduces the iterator’s elements to a single, final value, starting from the back. [Read more](trait.doubleendediterator#method.rfold)
[source](https://doc.rust-lang.org/src/core/iter/adapters/take.rs.html#219)#### fn advance\_back\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator from the back by `n` elements. [Read more](trait.doubleendediterator#method.advance_back_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#347-350)1.27.0 · #### fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator from the back that satisfies a predicate. [Read more](trait.doubleendediterator#method.rfind)
[source](https://doc.rust-lang.org/src/core/iter/adapters/take.rs.html#238)### impl<I> ExactSizeIterator for Take<I>where I: [ExactSizeIterator](trait.exactsizeiterator "trait std::iter::ExactSizeIterator"),
[source](https://doc.rust-lang.org/src/core/iter/traits/exact_size.rs.html#106)#### fn len(&self) -> usize
Returns the exact remaining length of the iterator. [Read more](trait.exactsizeiterator#method.len)
[source](https://doc.rust-lang.org/src/core/iter/traits/exact_size.rs.html#138)#### fn is\_empty(&self) -> bool
🔬This is a nightly-only experimental API. (`exact_size_is_empty` [#35428](https://github.com/rust-lang/rust/issues/35428))
Returns `true` if the iterator is empty. [Read more](trait.exactsizeiterator#method.is_empty)
[source](https://doc.rust-lang.org/src/core/iter/adapters/take.rs.html#27)### impl<I> Iterator for Take<I>where I: [Iterator](trait.iterator "trait std::iter::Iterator"),
#### type Item = <I as Iterator>::Item
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/iter/adapters/take.rs.html#34)#### fn next(&mut self) -> Option<<I as Iterator>::Item>
Advances the iterator and returns the next value. [Read more](trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/iter/adapters/take.rs.html#44)#### fn nth(&mut self, n: usize) -> Option<<I as Iterator>::Item>
Returns the `n`th element of the iterator. [Read more](trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/iter/adapters/take.rs.html#58)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/iter/adapters/take.rs.html#76-80)#### fn try\_fold<Acc, Fold, R>(&mut self, init: Acc, fold: Fold) -> Rwhere Fold: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[Take](struct.take "struct std::iter::Take")<I> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Acc>, [Take](struct.take "struct std::iter::Take")<I>: [Sized](../marker/trait.sized "trait std::marker::Sized"),
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/adapters/take.rs.html#102-105)#### fn fold<Acc, Fold>(self, init: Acc, fold: Fold) -> Accwhere Fold: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[Take](struct.take "struct std::iter::Take")<I> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Acc, [Take](struct.take "struct std::iter::Take")<I>: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/adapters/take.rs.html#117)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#252-254)#### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#282-284)#### fn last(self) -> Option<Self::Item>
Consumes the iterator, returning the last element. [Read more](trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)#### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)#### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)#### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)#### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)#### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)#### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)#### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](struct.peekable#method.peek) and [`peek_mut`](struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)#### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](trait.iterator#method.skip)s elements based on a predicate. [Read more](trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)#### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)#### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)#### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)#### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)#### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)#### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)#### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)#### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)#### fn collect<B>(self) -> Bwhere B: [FromIterator](trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](trait.extend "trait std::iter::Extend")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)#### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)#### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)#### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)#### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)#### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)#### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)#### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](trait.sum "trait std::iter::Sum")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](trait.product "trait std::iter::Product")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another. [Read more](trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are equal to those of another. [Read more](trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are unequal to those of another. [Read more](trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](trait.iterator#method.is_sorted_by_key)
[source](https://doc.rust-lang.org/src/core/iter/adapters/take.rs.html#241)1.26.0 · ### impl<I> FusedIterator for Take<I>where I: [FusedIterator](trait.fusediterator "trait std::iter::FusedIterator"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/take.rs.html#244)### impl<I> TrustedLen for Take<I>where I: [TrustedLen](trait.trustedlen "trait std::iter::TrustedLen"),
Auto Trait Implementations
--------------------------
### impl<I> RefUnwindSafe for Take<I>where I: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<I> Send for Take<I>where I: [Send](../marker/trait.send "trait std::marker::Send"),
### impl<I> Sync for Take<I>where I: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<I> Unpin for Take<I>where I: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"),
### impl<I> UnwindSafe for Take<I>where I: [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"),
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Struct std::iter::Copied Struct std::iter::Copied
========================
```
pub struct Copied<I> { /* private fields */ }
```
An iterator that copies the elements of an underlying iterator.
This `struct` is created by the [`copied`](trait.iterator#method.copied) method on [`Iterator`](trait.iterator). See its documentation for more.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/iter/adapters/copied.rs.html#16)### impl<I> Clone for Copied<I>where I: [Clone](../clone/trait.clone "trait std::clone::Clone"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/copied.rs.html#16)#### fn clone(&self) -> Copied<I>
Notable traits for [Copied](struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)1.0.0 · #### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/core/iter/adapters/copied.rs.html#16)### impl<I> Debug for Copied<I>where I: [Debug](../fmt/trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/copied.rs.html#16)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/iter/adapters/copied.rs.html#95)### impl<'a, I, T> DoubleEndedIterator for Copied<I>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), I: [DoubleEndedIterator](trait.doubleendediterator "trait std::iter::DoubleEndedIterator")<Item = [&'a](../primitive.reference) T>,
[source](https://doc.rust-lang.org/src/core/iter/adapters/copied.rs.html#100)#### fn next\_back(&mut self) -> Option<T>
Removes and returns an element from the end of the iterator. [Read more](trait.doubleendediterator#tymethod.next_back)
[source](https://doc.rust-lang.org/src/core/iter/adapters/copied.rs.html#104-108)#### fn try\_rfold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, <[Copied](struct.copied "struct std::iter::Copied")<I> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>, [Copied](struct.copied "struct std::iter::Copied")<I>: [Sized](../marker/trait.sized "trait std::marker::Sized"),
This is the reverse version of [`Iterator::try_fold()`](trait.iterator#method.try_fold "Iterator::try_fold()"): it takes elements starting from the back of the iterator. [Read more](trait.doubleendediterator#method.try_rfold)
[source](https://doc.rust-lang.org/src/core/iter/adapters/copied.rs.html#113-115)#### fn rfold<Acc, F>(self, init: Acc, f: F) -> Accwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[Copied](struct.copied "struct std::iter::Copied")<I> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Acc,
An iterator method that reduces the iterator’s elements to a single, final value, starting from the back. [Read more](trait.doubleendediterator#method.rfold)
[source](https://doc.rust-lang.org/src/core/iter/adapters/copied.rs.html#121)#### fn advance\_back\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator from the back by `n` elements. [Read more](trait.doubleendediterator#method.advance_back_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#184)1.37.0 · #### fn nth\_back(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element from the end of the iterator. [Read more](trait.doubleendediterator#method.nth_back)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#347-350)1.27.0 · #### fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator from the back that satisfies a predicate. [Read more](trait.doubleendediterator#method.rfind)
[source](https://doc.rust-lang.org/src/core/iter/adapters/copied.rs.html#127)### impl<'a, I, T> ExactSizeIterator for Copied<I>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), I: [ExactSizeIterator](trait.exactsizeiterator "trait std::iter::ExactSizeIterator")<Item = [&'a](../primitive.reference) T>,
[source](https://doc.rust-lang.org/src/core/iter/adapters/copied.rs.html#132)#### fn len(&self) -> usize
Returns the exact remaining length of the iterator. [Read more](trait.exactsizeiterator#method.len)
[source](https://doc.rust-lang.org/src/core/iter/adapters/copied.rs.html#136)#### fn is\_empty(&self) -> bool
🔬This is a nightly-only experimental API. (`exact_size_is_empty` [#35428](https://github.com/rust-lang/rust/issues/35428))
Returns `true` if the iterator is empty. [Read more](trait.exactsizeiterator#method.is_empty)
[source](https://doc.rust-lang.org/src/core/iter/adapters/copied.rs.html#36)### impl<'a, I, T> Iterator for Copied<I>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), I: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
#### type Item = T
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/iter/adapters/copied.rs.html#43)#### fn next(&mut self) -> Option<T>
Advances the iterator and returns the next value. [Read more](trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/iter/adapters/copied.rs.html#47)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/iter/adapters/copied.rs.html#51-55)#### fn try\_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, <[Copied](struct.copied "struct std::iter::Copied")<I> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>, [Copied](struct.copied "struct std::iter::Copied")<I>: [Sized](../marker/trait.sized "trait std::marker::Sized"),
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/adapters/copied.rs.html#60-62)#### fn fold<Acc, F>(self, init: Acc, f: F) -> Accwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[Copied](struct.copied "struct std::iter::Copied")<I> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Acc,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/adapters/copied.rs.html#67)#### fn nth(&mut self, n: usize) -> Option<T>
Returns the `n`th element of the iterator. [Read more](trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/iter/adapters/copied.rs.html#71)#### fn last(self) -> Option<T>
Consumes the iterator, returning the last element. [Read more](trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/adapters/copied.rs.html#75)#### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/iter/adapters/copied.rs.html#80)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)1.0.0 · #### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)1.0.0 · #### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)1.0.0 · #### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)1.0.0 · #### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)1.0.0 · #### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)1.0.0 · #### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)1.0.0 · #### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](struct.peekable#method.peek) and [`peek_mut`](struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)1.0.0 · #### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](trait.iterator#method.skip)s elements based on a predicate. [Read more](trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)1.0.0 · #### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)1.0.0 · #### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)1.0.0 · #### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)1.0.0 · #### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)1.0.0 · #### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)1.0.0 · #### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)1.0.0 · #### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)1.0.0 · #### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)1.0.0 · #### fn collect<B>(self) -> Bwhere B: [FromIterator](trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](trait.extend "trait std::iter::Extend")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)1.0.0 · #### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)1.0.0 · #### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)1.0.0 · #### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)1.0.0 · #### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)1.0.0 · #### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)1.0.0 · #### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)#### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)1.0.0 · #### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](trait.sum "trait std::iter::Sum")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](trait.product "trait std::iter::Product")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another. [Read more](trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are equal to those of another. [Read more](trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are unequal to those of another. [Read more](trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](trait.iterator#method.is_sorted_by_key)
[source](https://doc.rust-lang.org/src/core/iter/adapters/copied.rs.html#142)### impl<'a, I, T> FusedIterator for Copied<I>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), I: [FusedIterator](trait.fusediterator "trait std::iter::FusedIterator")<Item = [&'a](../primitive.reference) T>,
[source](https://doc.rust-lang.org/src/core/iter/adapters/copied.rs.html#163)### impl<'a, I, T> TrustedLen for Copied<I>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), I: [TrustedLen](trait.trustedlen "trait std::iter::TrustedLen")<Item = [&'a](../primitive.reference) T>,
Auto Trait Implementations
--------------------------
### impl<I> RefUnwindSafe for Copied<I>where I: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<I> Send for Copied<I>where I: [Send](../marker/trait.send "trait std::marker::Send"),
### impl<I> Sync for Copied<I>where I: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<I> Unpin for Copied<I>where I: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"),
### impl<I> UnwindSafe for Copied<I>where I: [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"),
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Trait std::iter::FusedIterator Trait std::iter::FusedIterator
==============================
```
pub trait FusedIterator: Iterator { }
```
An iterator that always continues to yield `None` when exhausted.
Calling next on a fused iterator that has returned `None` once is guaranteed to return [`None`](../option/enum.option#variant.None "None") again. This trait should be implemented by all iterators that behave this way because it allows optimizing [`Iterator::fuse()`](trait.iterator#method.fuse "Iterator::fuse()").
Note: In general, you should not use `FusedIterator` in generic bounds if you need a fused iterator. Instead, you should just call [`Iterator::fuse()`](trait.iterator#method.fuse "Iterator::fuse()") on the iterator. If the iterator is already fused, the additional [`Fuse`](struct.fuse) wrapper will be a no-op with no performance penalty.
Implementors
------------
[source](https://doc.rust-lang.org/src/core/ascii.rs.html#134)### impl FusedIterator for std::ascii::EscapeDefault
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#396)### impl FusedIterator for std::char::EscapeDebug
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#359)### impl FusedIterator for std::char::EscapeDefault
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#251)### impl FusedIterator for std::char::EscapeUnicode
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#434)### impl FusedIterator for ToLowercase
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#468)### impl FusedIterator for ToUppercase
[source](https://doc.rust-lang.org/src/std/net/tcp.rs.html#1014)1.64.0 · ### impl FusedIterator for Incoming<'\_>
[source](https://doc.rust-lang.org/src/std/net/tcp.rs.html#1025)### impl FusedIterator for IntoIncoming
[source](https://doc.rust-lang.org/src/std/sys_common/wtf8.rs.html#962)1.62.0 · ### impl FusedIterator for EncodeWide<'\_>
[source](https://doc.rust-lang.org/src/std/path.rs.html#1106)1.28.0 · ### impl FusedIterator for Ancestors<'\_>
[source](https://doc.rust-lang.org/src/std/path.rs.html#988)### impl FusedIterator for Components<'\_>
[source](https://doc.rust-lang.org/src/std/path.rs.html#885)### impl FusedIterator for std::path::Iter<'\_>
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#343)### impl FusedIterator for Bytes<'\_>
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#180)### impl FusedIterator for CharIndices<'\_>
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#89)### impl FusedIterator for Chars<'\_>
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#1434)### impl FusedIterator for EncodeUtf16<'\_>
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#1125)### impl FusedIterator for Lines<'\_>
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#1164)### impl FusedIterator for LinesAny<'\_>
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#1290)1.34.0 · ### impl FusedIterator for SplitAsciiWhitespace<'\_>
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#1234)### impl FusedIterator for SplitWhitespace<'\_>
[source](https://doc.rust-lang.org/src/core/str/lossy.rs.html#263)### impl FusedIterator for Utf8Chunks<'\_>
[source](https://doc.rust-lang.org/src/alloc/string.rs.html#2955)### impl FusedIterator for std::string::Drain<'\_>
[source](https://doc.rust-lang.org/src/core/slice/ascii.rs.html#218)1.60.0 · ### impl<'a> FusedIterator for EscapeAscii<'a>
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#1499)1.34.0 · ### impl<'a> FusedIterator for std::str::EscapeDebug<'a>
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#1499)1.34.0 · ### impl<'a> FusedIterator for std::str::EscapeDefault<'a>
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#1499)1.34.0 · ### impl<'a> FusedIterator for std::str::EscapeUnicode<'a>
[source](https://doc.rust-lang.org/src/core/iter/adapters/cloned.rs.html#116)### impl<'a, I, T> FusedIterator for Cloned<I>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), I: [FusedIterator](trait.fusediterator "trait std::iter::FusedIterator")<Item = [&'a](../primitive.reference) T>,
[source](https://doc.rust-lang.org/src/core/iter/adapters/copied.rs.html#142)1.36.0 · ### impl<'a, I, T> FusedIterator for Copied<I>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), I: [FusedIterator](trait.fusediterator "trait std::iter::FusedIterator")<Item = [&'a](../primitive.reference) T>,
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#1010-1026)### impl<'a, P> FusedIterator for MatchIndices<'a, P>where P: [Pattern](../str/pattern/trait.pattern "trait std::str::pattern::Pattern")<'a>,
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#1067-1083)### impl<'a, P> FusedIterator for Matches<'a, P>where P: [Pattern](../str/pattern/trait.pattern "trait std::str::pattern::Pattern")<'a>,
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#1010-1026)### impl<'a, P> FusedIterator for RMatchIndices<'a, P>where P: [Pattern](../str/pattern/trait.pattern "trait std::str::pattern::Pattern")<'a>, <P as [Pattern](../str/pattern/trait.pattern "trait std::str::pattern::Pattern")<'a>>::[Searcher](../str/pattern/trait.pattern#associatedtype.Searcher "type std::str::pattern::Pattern::Searcher"): [ReverseSearcher](../str/pattern/trait.reversesearcher "trait std::str::pattern::ReverseSearcher")<'a>,
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#1067-1083)### impl<'a, P> FusedIterator for RMatches<'a, P>where P: [Pattern](../str/pattern/trait.pattern "trait std::str::pattern::Pattern")<'a>, <P as [Pattern](../str/pattern/trait.pattern "trait std::str::pattern::Pattern")<'a>>::[Searcher](../str/pattern/trait.pattern#associatedtype.Searcher "type std::str::pattern::Pattern::Searcher"): [ReverseSearcher](../str/pattern/trait.reversesearcher "trait std::str::pattern::ReverseSearcher")<'a>,
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#730-746)### impl<'a, P> FusedIterator for std::str::RSplit<'a, P>where P: [Pattern](../str/pattern/trait.pattern "trait std::str::pattern::Pattern")<'a>, <P as [Pattern](../str/pattern/trait.pattern "trait std::str::pattern::Pattern")<'a>>::[Searcher](../str/pattern/trait.pattern#associatedtype.Searcher "type std::str::pattern::Pattern::Searcher"): [ReverseSearcher](../str/pattern/trait.reversesearcher "trait std::str::pattern::ReverseSearcher")<'a>,
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#913-929)### impl<'a, P> FusedIterator for std::str::RSplitN<'a, P>where P: [Pattern](../str/pattern/trait.pattern "trait std::str::pattern::Pattern")<'a>, <P as [Pattern](../str/pattern/trait.pattern "trait std::str::pattern::Pattern")<'a>>::[Searcher](../str/pattern/trait.pattern#associatedtype.Searcher "type std::str::pattern::Pattern::Searcher"): [ReverseSearcher](../str/pattern/trait.reversesearcher "trait std::str::pattern::ReverseSearcher")<'a>,
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#790-806)### impl<'a, P> FusedIterator for RSplitTerminator<'a, P>where P: [Pattern](../str/pattern/trait.pattern "trait std::str::pattern::Pattern")<'a>, <P as [Pattern](../str/pattern/trait.pattern "trait std::str::pattern::Pattern")<'a>>::[Searcher](../str/pattern/trait.pattern#associatedtype.Searcher "type std::str::pattern::Pattern::Searcher"): [ReverseSearcher](../str/pattern/trait.reversesearcher "trait std::str::pattern::ReverseSearcher")<'a>,
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#730-746)### impl<'a, P> FusedIterator for std::str::Split<'a, P>where P: [Pattern](../str/pattern/trait.pattern "trait std::str::pattern::Pattern")<'a>,
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#1358)1.51.0 · ### impl<'a, P> FusedIterator for std::str::SplitInclusive<'a, P>where P: [Pattern](../str/pattern/trait.pattern "trait std::str::pattern::Pattern")<'a>,
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#913-929)### impl<'a, P> FusedIterator for std::str::SplitN<'a, P>where P: [Pattern](../str/pattern/trait.pattern "trait std::str::pattern::Pattern")<'a>,
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#790-806)### impl<'a, P> FusedIterator for SplitTerminator<'a, P>where P: [Pattern](../str/pattern/trait.pattern "trait std::str::pattern::Pattern")<'a>,
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#3292)### impl<'a, T, P> FusedIterator for GroupBy<'a, T, P>where T: 'a, P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T, [&](../primitive.reference)T) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#3381)### impl<'a, T, P> FusedIterator for GroupByMut<'a, T, P>where T: 'a, P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T, [&](../primitive.reference)T) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1279)### impl<'a, T, P> FusedIterator for std::slice::RSplitN<'a, T, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1281)### impl<'a, T, P> FusedIterator for RSplitNMut<'a, T, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1278)### impl<'a, T, P> FusedIterator for std::slice::SplitN<'a, T, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1280)### impl<'a, T, P> FusedIterator for SplitNMut<'a, T, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/iter/range.rs.html#856)### impl<A> FusedIterator for std::ops::Range<A>where A: [Step](trait.step "trait std::iter::Step"),
[source](https://doc.rust-lang.org/src/core/iter/range.rs.html#886)### impl<A> FusedIterator for RangeFrom<A>where A: [Step](trait.step "trait std::iter::Step"),
[source](https://doc.rust-lang.org/src/core/iter/range.rs.html#1253)### impl<A> FusedIterator for RangeInclusive<A>where A: [Step](trait.step "trait std::iter::Step"),
[source](https://doc.rust-lang.org/src/core/option.rs.html#2204)### impl<A> FusedIterator for std::option::IntoIter<A>
[source](https://doc.rust-lang.org/src/core/option.rs.html#2113)### impl<A> FusedIterator for std::option::Iter<'\_, A>
[source](https://doc.rust-lang.org/src/core/option.rs.html#2163)### impl<A> FusedIterator for std::option::IterMut<'\_, A>
[source](https://doc.rust-lang.org/src/core/iter/sources/repeat.rs.html#126)### impl<A> FusedIterator for Repeat<A>where A: [Clone](../clone/trait.clone "trait std::clone::Clone"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/chain.rs.html#270)### impl<A, B> FusedIterator for Chain<A, B>where A: [FusedIterator](trait.fusediterator "trait std::iter::FusedIterator"), B: [FusedIterator](trait.fusediterator "trait std::iter::FusedIterator")<Item = <A as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
[source](https://doc.rust-lang.org/src/core/iter/adapters/zip.rs.html#405)### impl<A, B> FusedIterator for Zip<A, B>where A: [FusedIterator](trait.fusediterator "trait std::iter::FusedIterator"), B: [FusedIterator](trait.fusediterator "trait std::iter::FusedIterator"),
[source](https://doc.rust-lang.org/src/core/iter/sources/once_with.rs.html#106)1.43.0 · ### impl<A, F> FusedIterator for OnceWith<F>where F: [FnOnce](../ops/trait.fnonce "trait std::ops::FnOnce")() -> A,
[source](https://doc.rust-lang.org/src/core/iter/sources/repeat_with.rs.html#95)1.28.0 · ### impl<A, F> FusedIterator for RepeatWith<F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> A,
[source](https://doc.rust-lang.org/src/core/iter/adapters/filter_map.rs.html#129)### impl<B, I, F> FusedIterator for FilterMap<I, F>where I: [FusedIterator](trait.fusediterator "trait std::iter::FusedIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
[source](https://doc.rust-lang.org/src/core/iter/adapters/map.rs.html#180)### impl<B, I, F> FusedIterator for Map<I, F>where I: [FusedIterator](trait.fusediterator "trait std::iter::FusedIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
[source](https://doc.rust-lang.org/src/core/iter/traits/marker.rs.html#20)### impl<I> FusedIterator for &mut Iwhere I: [FusedIterator](trait.fusediterator "trait std::iter::FusedIterator") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/cycle.rs.html#108)### impl<I> FusedIterator for Cycle<I>where I: [Clone](../clone/trait.clone "trait std::clone::Clone") + [Iterator](trait.iterator "trait std::iter::Iterator"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/enumerate.rs.html#246)### impl<I> FusedIterator for Enumerate<I>where I: [FusedIterator](trait.fusediterator "trait std::iter::FusedIterator"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/fuse.rs.html#30)### impl<I> FusedIterator for Fuse<I>where I: [Iterator](trait.iterator "trait std::iter::Iterator"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/peekable.rs.html#172)### impl<I> FusedIterator for Peekable<I>where I: [FusedIterator](trait.fusediterator "trait std::iter::FusedIterator"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/rev.rs.html#134)### impl<I> FusedIterator for Rev<I>where I: [FusedIterator](trait.fusediterator "trait std::iter::FusedIterator") + [DoubleEndedIterator](trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/skip.rs.html#233)### impl<I> FusedIterator for Skip<I>where I: [FusedIterator](trait.fusediterator "trait std::iter::FusedIterator"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/take.rs.html#241)### impl<I> FusedIterator for Take<I>where I: [FusedIterator](trait.fusediterator "trait std::iter::FusedIterator"),
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#1933)### impl<I, A> FusedIterator for Box<I, A>where I: [FusedIterator](trait.fusediterator "trait std::iter::FusedIterator") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"), A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/inspect.rs.html#149)### impl<I, F> FusedIterator for Inspect<I, F>where I: [FusedIterator](trait.fusediterator "trait std::iter::FusedIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
[source](https://doc.rust-lang.org/src/core/iter/adapters/filter.rs.html#135)### impl<I, P> FusedIterator for Filter<I, P>where I: [FusedIterator](trait.fusediterator "trait std::iter::FusedIterator"), P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/iter/adapters/skip_while.rs.html#100)### impl<I, P> FusedIterator for SkipWhile<I, P>where I: [FusedIterator](trait.fusediterator "trait std::iter::FusedIterator"), P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/iter/adapters/take_while.rs.html#113)### impl<I, P> FusedIterator for TakeWhile<I, P>where I: [FusedIterator](trait.fusediterator "trait std::iter::FusedIterator"), P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/iter/adapters/flatten.rs.html#290)1.29.0 · ### impl<I, U> FusedIterator for Flatten<I>where I: [FusedIterator](trait.fusediterator "trait std::iter::FusedIterator"), U: [Iterator](trait.iterator "trait std::iter::Iterator"), <I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), <<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item") as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[IntoIter](trait.intoiterator#associatedtype.IntoIter "type std::iter::IntoIterator::IntoIter") == U, <<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item") as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item") == <U as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/flatten.rs.html#129)### impl<I, U, F> FusedIterator for FlatMap<I, U, F>where I: [FusedIterator](trait.fusediterator "trait std::iter::FusedIterator"), U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
[source](https://doc.rust-lang.org/src/core/iter/adapters/array_chunks.rs.html#166)### impl<I, const N: usize> FusedIterator for std::iter::ArrayChunks<I, N>where I: [FusedIterator](trait.fusediterator "trait std::iter::FusedIterator"),
[source](https://doc.rust-lang.org/src/std/collections/hash/set.rs.html#1577)### impl<K> FusedIterator for std::collections::hash\_set::Drain<'\_, K>
[source](https://doc.rust-lang.org/src/std/collections/hash/set.rs.html#1547)### impl<K> FusedIterator for std::collections::hash\_set::IntoIter<K>
[source](https://doc.rust-lang.org/src/std/collections/hash/set.rs.html#1517)### impl<K> FusedIterator for std::collections::hash\_set::Iter<'\_, K>
[source](https://doc.rust-lang.org/src/std/collections/hash/set.rs.html#1604)### impl<K, F> FusedIterator for std::collections::hash\_set::DrainFilter<'\_, K, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)K) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/alloc/collections/btree/map.rs.html#1515)### impl<K, V> FusedIterator for std::collections::btree\_map::Iter<'\_, K, V>
[source](https://doc.rust-lang.org/src/alloc/collections/btree/map.rs.html#1603)### impl<K, V> FusedIterator for std::collections::btree\_map::IterMut<'\_, K, V>
[source](https://doc.rust-lang.org/src/alloc/collections/btree/map.rs.html#1765)### impl<K, V> FusedIterator for std::collections::btree\_map::Keys<'\_, K, V>
[source](https://doc.rust-lang.org/src/alloc/collections/btree/map.rs.html#2069)### impl<K, V> FusedIterator for std::collections::btree\_map::Range<'\_, K, V>
[source](https://doc.rust-lang.org/src/alloc/collections/btree/map.rs.html#2107)### impl<K, V> FusedIterator for RangeMut<'\_, K, V>
[source](https://doc.rust-lang.org/src/alloc/collections/btree/map.rs.html#1806)### impl<K, V> FusedIterator for std::collections::btree\_map::Values<'\_, K, V>
[source](https://doc.rust-lang.org/src/alloc/collections/btree/map.rs.html#1983)### impl<K, V> FusedIterator for std::collections::btree\_map::ValuesMut<'\_, K, V>
[source](https://doc.rust-lang.org/src/std/collections/hash/map.rs.html#2471)### impl<K, V> FusedIterator for std::collections::hash\_map::Drain<'\_, K, V>
[source](https://doc.rust-lang.org/src/std/collections/hash/map.rs.html#2305)### impl<K, V> FusedIterator for std::collections::hash\_map::IntoIter<K, V>
[source](https://doc.rust-lang.org/src/std/collections/hash/map.rs.html#2411)1.54.0 · ### impl<K, V> FusedIterator for std::collections::hash\_map::IntoKeys<K, V>
[source](https://doc.rust-lang.org/src/std/collections/hash/map.rs.html#2441)1.54.0 · ### impl<K, V> FusedIterator for std::collections::hash\_map::IntoValues<K, V>
[source](https://doc.rust-lang.org/src/std/collections/hash/map.rs.html#2248)### impl<K, V> FusedIterator for std::collections::hash\_map::Iter<'\_, K, V>
[source](https://doc.rust-lang.org/src/std/collections/hash/map.rs.html#2271)### impl<K, V> FusedIterator for std::collections::hash\_map::IterMut<'\_, K, V>
[source](https://doc.rust-lang.org/src/std/collections/hash/map.rs.html#2335)### impl<K, V> FusedIterator for std::collections::hash\_map::Keys<'\_, K, V>
[source](https://doc.rust-lang.org/src/std/collections/hash/map.rs.html#2358)### impl<K, V> FusedIterator for std::collections::hash\_map::Values<'\_, K, V>
[source](https://doc.rust-lang.org/src/std/collections/hash/map.rs.html#2381)### impl<K, V> FusedIterator for std::collections::hash\_map::ValuesMut<'\_, K, V>
[source](https://doc.rust-lang.org/src/alloc/collections/btree/map.rs.html#1723)### impl<K, V, A> FusedIterator for std::collections::btree\_map::IntoIter<K, V, A>where A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator") + [Clone](../clone/trait.clone "trait std::clone::Clone"),
[source](https://doc.rust-lang.org/src/alloc/collections/btree/map.rs.html#2025)1.54.0 · ### impl<K, V, A> FusedIterator for std::collections::btree\_map::IntoKeys<K, V, A>where A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator") + [Clone](../clone/trait.clone "trait std::clone::Clone"),
[source](https://doc.rust-lang.org/src/alloc/collections/btree/map.rs.html#2059)1.54.0 · ### impl<K, V, A> FusedIterator for std::collections::btree\_map::IntoValues<K, V, A>where A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator") + [Clone](../clone/trait.clone "trait std::clone::Clone"),
[source](https://doc.rust-lang.org/src/alloc/collections/btree/map.rs.html#1928)### impl<K, V, F> FusedIterator for std::collections::btree\_map::DrainFilter<'\_, K, V, F, Global>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)K, [&mut](../primitive.reference) V) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/std/collections/hash/map.rs.html#2502)### impl<K, V, F> FusedIterator for std::collections::hash\_map::DrainFilter<'\_, K, V, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)K, [&mut](../primitive.reference) V) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/alloc/collections/binary_heap.rs.html#1514)### impl<T> FusedIterator for std::collections::binary\_heap::Drain<'\_, T>
[source](https://doc.rust-lang.org/src/alloc/collections/binary_heap.rs.html#1568)### impl<T> FusedIterator for DrainSorted<'\_, T>where T: [Ord](../cmp/trait.ord "trait std::cmp::Ord"),
[source](https://doc.rust-lang.org/src/alloc/collections/binary_heap.rs.html#1412)### impl<T> FusedIterator for std::collections::binary\_heap::IntoIter<T>
[source](https://doc.rust-lang.org/src/alloc/collections/binary_heap.rs.html#1466)### impl<T> FusedIterator for IntoIterSorted<T>where T: [Ord](../cmp/trait.ord "trait std::cmp::Ord"),
[source](https://doc.rust-lang.org/src/alloc/collections/binary_heap.rs.html#1359)### impl<T> FusedIterator for std::collections::binary\_heap::Iter<'\_, T>
[source](https://doc.rust-lang.org/src/alloc/collections/btree/set.rs.html#1529)### impl<T> FusedIterator for std::collections::btree\_set::Iter<'\_, T>
[source](https://doc.rust-lang.org/src/alloc/collections/btree/set.rs.html#1595)### impl<T> FusedIterator for std::collections::btree\_set::Range<'\_, T>
[source](https://doc.rust-lang.org/src/alloc/collections/btree/set.rs.html#1697)### impl<T> FusedIterator for std::collections::btree\_set::SymmetricDifference<'\_, T>where T: [Ord](../cmp/trait.ord "trait std::cmp::Ord"),
[source](https://doc.rust-lang.org/src/alloc/collections/btree/set.rs.html#1786)### impl<T> FusedIterator for std::collections::btree\_set::Union<'\_, T>where T: [Ord](../cmp/trait.ord "trait std::cmp::Ord"),
[source](https://doc.rust-lang.org/src/alloc/collections/linked_list.rs.html#1809)### impl<T> FusedIterator for std::collections::linked\_list::IntoIter<T>
[source](https://doc.rust-lang.org/src/alloc/collections/linked_list.rs.html#1076)### impl<T> FusedIterator for std::collections::linked\_list::Iter<'\_, T>
[source](https://doc.rust-lang.org/src/alloc/collections/linked_list.rs.html#1130)### impl<T> FusedIterator for std::collections::linked\_list::IterMut<'\_, T>
[source](https://doc.rust-lang.org/src/alloc/collections/vec_deque/iter.rs.html#206)### impl<T> FusedIterator for std::collections::vec\_deque::Iter<'\_, T>
[source](https://doc.rust-lang.org/src/alloc/collections/vec_deque/iter_mut.rs.html#149)### impl<T> FusedIterator for std::collections::vec\_deque::IterMut<'\_, T>
[source](https://doc.rust-lang.org/src/core/result.rs.html#2014)### impl<T> FusedIterator for std::result::IntoIter<T>
[source](https://doc.rust-lang.org/src/core/result.rs.html#1919)### impl<T> FusedIterator for std::result::Iter<'\_, T>
[source](https://doc.rust-lang.org/src/core/result.rs.html#1968)### impl<T> FusedIterator for std::result::IterMut<'\_, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1598)### impl<T> FusedIterator for Chunks<'\_, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1944)1.31.0 · ### impl<T> FusedIterator for ChunksExact<'\_, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2111)1.31.0 · ### impl<T> FusedIterator for ChunksExactMut<'\_, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1779)### impl<T> FusedIterator for ChunksMut<'\_, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#135-145)### impl<T> FusedIterator for std::slice::Iter<'\_, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#366)### impl<T> FusedIterator for std::slice::IterMut<'\_, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2652)1.31.0 · ### impl<T> FusedIterator for RChunks<'\_, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#3006)1.31.0 · ### impl<T> FusedIterator for RChunksExact<'\_, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#3177)1.31.0 · ### impl<T> FusedIterator for RChunksExactMut<'\_, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2838)1.31.0 · ### impl<T> FusedIterator for RChunksMut<'\_, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1415)### impl<T> FusedIterator for Windows<'\_, T>
[source](https://doc.rust-lang.org/src/core/iter/sources/empty.rs.html#75)### impl<T> FusedIterator for Empty<T>
[source](https://doc.rust-lang.org/src/core/iter/sources/once.rs.html#99)### impl<T> FusedIterator for Once<T>
[source](https://doc.rust-lang.org/src/alloc/collections/btree/set.rs.html#1662)### impl<T, A> FusedIterator for std::collections::btree\_set::Difference<'\_, T, A>where T: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator") + [Clone](../clone/trait.clone "trait std::clone::Clone"),
[source](https://doc.rust-lang.org/src/alloc/collections/btree/set.rs.html#1757)### impl<T, A> FusedIterator for std::collections::btree\_set::Intersection<'\_, T, A>where T: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator") + [Clone](../clone/trait.clone "trait std::clone::Clone"),
[source](https://doc.rust-lang.org/src/alloc/collections/btree/set.rs.html#1557)### impl<T, A> FusedIterator for std::collections::btree\_set::IntoIter<T, A>where A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator") + [Clone](../clone/trait.clone "trait std::clone::Clone"),
[source](https://doc.rust-lang.org/src/alloc/collections/vec_deque/drain.rs.html#168)### impl<T, A> FusedIterator for std::collections::vec\_deque::Drain<'\_, T, A>where A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator"),
[source](https://doc.rust-lang.org/src/alloc/collections/vec_deque/into_iter.rs.html#69)### impl<T, A> FusedIterator for std::collections::vec\_deque::IntoIter<T, A>where A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator"),
[source](https://doc.rust-lang.org/src/alloc/vec/drain.rs.html#255)### impl<T, A> FusedIterator for std::vec::Drain<'\_, T, A>where A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator"),
[source](https://doc.rust-lang.org/src/alloc/vec/into_iter.rs.html#310)### impl<T, A> FusedIterator for std::vec::IntoIter<T, A>where A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator"),
[source](https://doc.rust-lang.org/src/core/iter/sources/successors.rs.html#59)1.34.0 · ### impl<T, F> FusedIterator for Successors<T, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [Option](../option/enum.option "enum std::option::Option")<T>,
[source](https://doc.rust-lang.org/src/alloc/collections/btree/set.rs.html#1338)### impl<T, F, A> FusedIterator for std::collections::btree\_set::DrainFilter<'\_, T, F, A>where A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator") + [Clone](../clone/trait.clone "trait std::clone::Clone"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#991)1.27.0 · ### impl<T, P> FusedIterator for std::slice::RSplit<'\_, T, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1077)1.27.0 · ### impl<T, P> FusedIterator for RSplitMut<'\_, T, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#519)### impl<T, P> FusedIterator for std::slice::Split<'\_, T, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#641)1.51.0 · ### impl<T, P> FusedIterator for std::slice::SplitInclusive<'\_, T, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#894)1.51.0 · ### impl<T, P> FusedIterator for SplitInclusiveMut<'\_, T, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#769)### impl<T, P> FusedIterator for SplitMut<'\_, T, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/std/collections/hash/set.rs.html#1702-1707)### impl<T, S> FusedIterator for std::collections::hash\_set::Difference<'\_, T, S>where T: [Eq](../cmp/trait.eq "trait std::cmp::Eq") + [Hash](../hash/trait.hash "trait std::hash::Hash"), S: [BuildHasher](../hash/trait.buildhasher "trait std::hash::BuildHasher"),
[source](https://doc.rust-lang.org/src/std/collections/hash/set.rs.html#1661-1666)### impl<T, S> FusedIterator for std::collections::hash\_set::Intersection<'\_, T, S>where T: [Eq](../cmp/trait.eq "trait std::cmp::Eq") + [Hash](../hash/trait.hash "trait std::hash::Hash"), S: [BuildHasher](../hash/trait.buildhasher "trait std::hash::BuildHasher"),
[source](https://doc.rust-lang.org/src/std/collections/hash/set.rs.html#1747-1752)### impl<T, S> FusedIterator for std::collections::hash\_set::SymmetricDifference<'\_, T, S>where T: [Eq](../cmp/trait.eq "trait std::cmp::Eq") + [Hash](../hash/trait.hash "trait std::hash::Hash"), S: [BuildHasher](../hash/trait.buildhasher "trait std::hash::BuildHasher"),
[source](https://doc.rust-lang.org/src/std/collections/hash/set.rs.html#1774-1779)### impl<T, S> FusedIterator for std::collections::hash\_set::Union<'\_, T, S>where T: [Eq](../cmp/trait.eq "trait std::cmp::Eq") + [Hash](../hash/trait.hash "trait std::hash::Hash"), S: [BuildHasher](../hash/trait.buildhasher "trait std::hash::BuildHasher"),
[source](https://doc.rust-lang.org/src/core/array/iter.rs.html#385)1.40.0 · ### impl<T, const N: usize> FusedIterator for std::array::IntoIter<T, N>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2361)### impl<T, const N: usize> FusedIterator for std::slice::ArrayChunks<'\_, T, N>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2479)### impl<T, const N: usize> FusedIterator for ArrayChunksMut<'\_, T, N>
| programming_docs |
rust Function std::iter::successors Function std::iter::successors
==============================
```
pub fn successors<T, F>(first: Option<T>, succ: F) -> Successors<T, F>ⓘNotable traits for Successors<T, F>impl<T, F> Iterator for Successors<T, F>where F: FnMut(&T) -> Option<T>, type Item = T;where F: FnMut(&T) -> Option<T>,
```
Creates a new iterator where each successive item is computed based on the preceding one.
The iterator starts with the given first item (if any) and calls the given `FnMut(&T) -> Option<T>` closure to compute each item’s successor.
```
use std::iter::successors;
let powers_of_10 = successors(Some(1_u16), |n| n.checked_mul(10));
assert_eq!(powers_of_10.collect::<Vec<_>>(), &[1, 10, 100, 1_000, 10_000]);
```
rust Trait std::iter::Step Trait std::iter::Step
=====================
```
pub trait Step: Clone + PartialOrd<Self> {
fn steps_between(start: &Self, end: &Self) -> Option<usize>;
fn forward_checked(start: Self, count: usize) -> Option<Self>;
fn backward_checked(start: Self, count: usize) -> Option<Self>;
fn forward(start: Self, count: usize) -> Self { ... }
unsafe fn forward_unchecked(start: Self, count: usize) -> Self { ... }
fn backward(start: Self, count: usize) -> Self { ... }
unsafe fn backward_unchecked(start: Self, count: usize) -> Self { ... }
}
```
🔬This is a nightly-only experimental API. (`step_trait` [#42168](https://github.com/rust-lang/rust/issues/42168))
Objects that have a notion of *successor* and *predecessor* operations.
The *successor* operation moves towards values that compare greater. The *predecessor* operation moves towards values that compare lesser.
Required Methods
----------------
[source](https://doc.rust-lang.org/src/core/iter/range.rs.html#41)#### fn steps\_between(start: &Self, end: &Self) -> Option<usize>
🔬This is a nightly-only experimental API. (`step_trait` [#42168](https://github.com/rust-lang/rust/issues/42168))
Returns the number of *successor* steps required to get from `start` to `end`.
Returns `None` if the number of steps would overflow `usize` (or is infinite, or if `end` would never be reached).
##### Invariants
For any `a`, `b`, and `n`:
* `steps_between(&a, &b) == Some(n)` if and only if `Step::forward_checked(&a, n) == Some(b)`
* `steps_between(&a, &b) == Some(n)` if and only if `Step::backward_checked(&b, n) == Some(a)`
* `steps_between(&a, &b) == Some(n)` only if `a <= b`
+ Corollary: `steps_between(&a, &b) == Some(0)` if and only if `a == b`
+ Note that `a <= b` does *not* imply `steps_between(&a, &b) != None`; this is the case when it would require more than `usize::MAX` steps to get to `b`
* `steps_between(&a, &b) == None` if `a > b`
[source](https://doc.rust-lang.org/src/core/iter/range.rs.html#62)#### fn forward\_checked(start: Self, count: usize) -> Option<Self>
🔬This is a nightly-only experimental API. (`step_trait` [#42168](https://github.com/rust-lang/rust/issues/42168))
Returns the value that would be obtained by taking the *successor* of `self` `count` times.
If this would overflow the range of values supported by `Self`, returns `None`.
##### Invariants
For any `a`, `n`, and `m`:
* `Step::forward_checked(a, n).and_then(|x| Step::forward_checked(x, m)) == Step::forward_checked(a, m).and_then(|x| Step::forward_checked(x, n))`
For any `a`, `n`, and `m` where `n + m` does not overflow:
* `Step::forward_checked(a, n).and_then(|x| Step::forward_checked(x, m)) == Step::forward_checked(a, n + m)`
For any `a` and `n`:
* `Step::forward_checked(a, n) == (0..n).try_fold(a, |x, _| Step::forward_checked(&x, 1))`
+ Corollary: `Step::forward_checked(&a, 0) == Some(a)`
[source](https://doc.rust-lang.org/src/core/iter/range.rs.html#131)#### fn backward\_checked(start: Self, count: usize) -> Option<Self>
🔬This is a nightly-only experimental API. (`step_trait` [#42168](https://github.com/rust-lang/rust/issues/42168))
Returns the value that would be obtained by taking the *predecessor* of `self` `count` times.
If this would overflow the range of values supported by `Self`, returns `None`.
##### Invariants
For any `a`, `n`, and `m`:
* `Step::backward_checked(a, n).and_then(|x| Step::backward_checked(x, m)) == n.checked_add(m).and_then(|x| Step::backward_checked(a, x))`
* `Step::backward_checked(a, n).and_then(|x| Step::backward_checked(x, m)) == try { Step::backward_checked(a, n.checked_add(m)?) }`
For any `a` and `n`:
* `Step::backward_checked(a, n) == (0..n).try_fold(a, |x, _| Step::backward_checked(&x, 1))`
+ Corollary: `Step::backward_checked(&a, 0) == Some(a)`
Provided Methods
----------------
[source](https://doc.rust-lang.org/src/core/iter/range.rs.html#87)#### fn forward(start: Self, count: usize) -> Self
🔬This is a nightly-only experimental API. (`step_trait` [#42168](https://github.com/rust-lang/rust/issues/42168))
Returns the value that would be obtained by taking the *successor* of `self` `count` times.
If this would overflow the range of values supported by `Self`, this function is allowed to panic, wrap, or saturate. The suggested behavior is to panic when debug assertions are enabled, and to wrap or saturate otherwise.
Unsafe code should not rely on the correctness of behavior after overflow.
##### Invariants
For any `a`, `n`, and `m`, where no overflow occurs:
* `Step::forward(Step::forward(a, n), m) == Step::forward(a, n + m)`
For any `a` and `n`, where no overflow occurs:
* `Step::forward_checked(a, n) == Some(Step::forward(a, n))`
* `Step::forward(a, n) == (0..n).fold(a, |x, _| Step::forward(x, 1))`
+ Corollary: `Step::forward(a, 0) == a`
* `Step::forward(a, n) >= a`
* `Step::backward(Step::forward(a, n), n) == a`
[source](https://doc.rust-lang.org/src/core/iter/range.rs.html#111)#### unsafe fn forward\_unchecked(start: Self, count: usize) -> Self
🔬This is a nightly-only experimental API. (`step_trait` [#42168](https://github.com/rust-lang/rust/issues/42168))
Returns the value that would be obtained by taking the *successor* of `self` `count` times.
##### Safety
It is undefined behavior for this operation to overflow the range of values supported by `Self`. If you cannot guarantee that this will not overflow, use `forward` or `forward_checked` instead.
##### Invariants
For any `a`:
* if there exists `b` such that `b > a`, it is safe to call `Step::forward_unchecked(a, 1)`
* if there exists `b`, `n` such that `steps_between(&a, &b) == Some(n)`, it is safe to call `Step::forward_unchecked(a, m)` for any `m <= n`.
For any `a` and `n`, where no overflow occurs:
* `Step::forward_unchecked(a, n)` is equivalent to `Step::forward(a, n)`
[source](https://doc.rust-lang.org/src/core/iter/range.rs.html#156)#### fn backward(start: Self, count: usize) -> Self
🔬This is a nightly-only experimental API. (`step_trait` [#42168](https://github.com/rust-lang/rust/issues/42168))
Returns the value that would be obtained by taking the *predecessor* of `self` `count` times.
If this would overflow the range of values supported by `Self`, this function is allowed to panic, wrap, or saturate. The suggested behavior is to panic when debug assertions are enabled, and to wrap or saturate otherwise.
Unsafe code should not rely on the correctness of behavior after overflow.
##### Invariants
For any `a`, `n`, and `m`, where no overflow occurs:
* `Step::backward(Step::backward(a, n), m) == Step::backward(a, n + m)`
For any `a` and `n`, where no overflow occurs:
* `Step::backward_checked(a, n) == Some(Step::backward(a, n))`
* `Step::backward(a, n) == (0..n).fold(a, |x, _| Step::backward(x, 1))`
+ Corollary: `Step::backward(a, 0) == a`
* `Step::backward(a, n) <= a`
* `Step::forward(Step::backward(a, n), n) == a`
[source](https://doc.rust-lang.org/src/core/iter/range.rs.html#180)#### unsafe fn backward\_unchecked(start: Self, count: usize) -> Self
🔬This is a nightly-only experimental API. (`step_trait` [#42168](https://github.com/rust-lang/rust/issues/42168))
Returns the value that would be obtained by taking the *predecessor* of `self` `count` times.
##### Safety
It is undefined behavior for this operation to overflow the range of values supported by `Self`. If you cannot guarantee that this will not overflow, use `backward` or `backward_checked` instead.
##### Invariants
For any `a`:
* if there exists `b` such that `b < a`, it is safe to call `Step::backward_unchecked(a, 1)`
* if there exists `b`, `n` such that `steps_between(&b, &a) == Some(n)`, it is safe to call `Step::backward_unchecked(a, m)` for any `m <= n`.
For any `a` and `n`, where no overflow occurs:
* `Step::backward_unchecked(a, n)` is equivalent to `Step::backward(a, n)`
Implementors
------------
[source](https://doc.rust-lang.org/src/core/iter/range.rs.html#409)### impl Step for char
[source](https://doc.rust-lang.org/src/core/iter/range.rs.html#391-394)### impl Step for i8
[source](https://doc.rust-lang.org/src/core/iter/range.rs.html#391-394)### impl Step for i16
[source](https://doc.rust-lang.org/src/core/iter/range.rs.html#391-394)### impl Step for i32
[source](https://doc.rust-lang.org/src/core/iter/range.rs.html#391-394)### impl Step for i64
[source](https://doc.rust-lang.org/src/core/iter/range.rs.html#391-394)### impl Step for i128
[source](https://doc.rust-lang.org/src/core/iter/range.rs.html#391-394)### impl Step for isize
[source](https://doc.rust-lang.org/src/core/iter/range.rs.html#391-394)### impl Step for u8
[source](https://doc.rust-lang.org/src/core/iter/range.rs.html#391-394)### impl Step for u16
[source](https://doc.rust-lang.org/src/core/iter/range.rs.html#391-394)### impl Step for u32
[source](https://doc.rust-lang.org/src/core/iter/range.rs.html#391-394)### impl Step for u64
[source](https://doc.rust-lang.org/src/core/iter/range.rs.html#391-394)### impl Step for u128
[source](https://doc.rust-lang.org/src/core/iter/range.rs.html#391-394)### impl Step for usize
rust Function std::iter::repeat Function std::iter::repeat
==========================
```
pub fn repeat<T>(elt: T) -> Repeat<T>ⓘNotable traits for Repeat<A>impl<A> Iterator for Repeat<A>where A: Clone, type Item = A;where T: Clone,
```
Creates a new iterator that endlessly repeats a single element.
The `repeat()` function repeats a single value over and over again.
Infinite iterators like `repeat()` are often used with adapters like [`Iterator::take()`](trait.iterator#method.take "Iterator::take()"), in order to make them finite.
If the element type of the iterator you need does not implement `Clone`, or if you do not want to keep the repeated element in memory, you can instead use the [`repeat_with()`](fn.repeat_with) function.
Examples
--------
Basic usage:
```
use std::iter;
// the number four 4ever:
let mut fours = iter::repeat(4);
assert_eq!(Some(4), fours.next());
assert_eq!(Some(4), fours.next());
assert_eq!(Some(4), fours.next());
assert_eq!(Some(4), fours.next());
assert_eq!(Some(4), fours.next());
// yup, still four
assert_eq!(Some(4), fours.next());
```
Going finite with [`Iterator::take()`](trait.iterator#method.take "Iterator::take()"):
```
use std::iter;
// that last example was too many fours. Let's only have four fours.
let mut four_fours = iter::repeat(4).take(4);
assert_eq!(Some(4), four_fours.next());
assert_eq!(Some(4), four_fours.next());
assert_eq!(Some(4), four_fours.next());
assert_eq!(Some(4), four_fours.next());
// ... and now we're done
assert_eq!(None, four_fours.next());
```
rust Struct std::iter::FilterMap Struct std::iter::FilterMap
===========================
```
pub struct FilterMap<I, F> { /* private fields */ }
```
An iterator that uses `f` to both filter and map elements from `iter`.
This `struct` is created by the [`filter_map`](trait.iterator#method.filter_map) method on [`Iterator`](trait.iterator). See its documentation for more.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/iter/adapters/filter_map.rs.html#14)### impl<I, F> Clone for FilterMap<I, F>where I: [Clone](../clone/trait.clone "trait std::clone::Clone"), F: [Clone](../clone/trait.clone "trait std::clone::Clone"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/filter_map.rs.html#14)#### fn clone(&self) -> FilterMap<I, F>
Notable traits for [FilterMap](struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)#### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/core/iter/adapters/filter_map.rs.html#26)1.9.0 · ### impl<I, F> Debug for FilterMap<I, F>where I: [Debug](../fmt/trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/filter_map.rs.html#27)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/iter/adapters/filter_map.rs.html#90)### impl<B, I, F> DoubleEndedIterator for FilterMap<I, F>where I: [DoubleEndedIterator](trait.doubleendediterator "trait std::iter::DoubleEndedIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
[source](https://doc.rust-lang.org/src/core/iter/adapters/filter_map.rs.html#95)#### fn next\_back(&mut self) -> Option<B>
Removes and returns an element from the end of the iterator. [Read more](trait.doubleendediterator#tymethod.next_back)
[source](https://doc.rust-lang.org/src/core/iter/adapters/filter_map.rs.html#110-114)#### fn try\_rfold<Acc, Fold, R>(&mut self, init: Acc, fold: Fold) -> Rwhere Fold: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[FilterMap](struct.filtermap "struct std::iter::FilterMap")<I, F> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Acc>, [FilterMap](struct.filtermap "struct std::iter::FilterMap")<I, F>: [Sized](../marker/trait.sized "trait std::marker::Sized"),
This is the reverse version of [`Iterator::try_fold()`](trait.iterator#method.try_fold "Iterator::try_fold()"): it takes elements starting from the back of the iterator. [Read more](trait.doubleendediterator#method.try_rfold)
[source](https://doc.rust-lang.org/src/core/iter/adapters/filter_map.rs.html#120-122)#### fn rfold<Acc, Fold>(self, init: Acc, fold: Fold) -> Accwhere Fold: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[FilterMap](struct.filtermap "struct std::iter::FilterMap")<I, F> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Acc,
An iterator method that reduces the iterator’s elements to a single, final value, starting from the back. [Read more](trait.doubleendediterator#method.rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#134)#### fn advance\_back\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator from the back by `n` elements. [Read more](trait.doubleendediterator#method.advance_back_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#184)1.37.0 · #### fn nth\_back(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element from the end of the iterator. [Read more](trait.doubleendediterator#method.nth_back)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#347-350)1.27.0 · #### fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator from the back that satisfies a predicate. [Read more](trait.doubleendediterator#method.rfind)
[source](https://doc.rust-lang.org/src/core/iter/adapters/filter_map.rs.html#53)### impl<B, I, F> Iterator for FilterMap<I, F>where I: [Iterator](trait.iterator "trait std::iter::Iterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
#### type Item = B
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/iter/adapters/filter_map.rs.html#60)#### fn next(&mut self) -> Option<B>
Advances the iterator and returns the next value. [Read more](trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/iter/adapters/filter_map.rs.html#65)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/iter/adapters/filter_map.rs.html#71-75)#### fn try\_fold<Acc, Fold, R>(&mut self, init: Acc, fold: Fold) -> Rwhere Fold: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[FilterMap](struct.filtermap "struct std::iter::FilterMap")<I, F> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Acc>, [FilterMap](struct.filtermap "struct std::iter::FilterMap")<I, F>: [Sized](../marker/trait.sized "trait std::marker::Sized"),
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/adapters/filter_map.rs.html#81-83)#### fn fold<Acc, Fold>(self, init: Acc, fold: Fold) -> Accwhere Fold: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[FilterMap](struct.filtermap "struct std::iter::FilterMap")<I, F> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Acc,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#252-254)#### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#282-284)#### fn last(self) -> Option<Self::Item>
Consumes the iterator, returning the last element. [Read more](trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#328)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#376)#### fn nth(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element of the iterator. [Read more](trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)#### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)#### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)#### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)#### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)#### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)#### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)#### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](struct.peekable#method.peek) and [`peek_mut`](struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)#### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](trait.iterator#method.skip)s elements based on a predicate. [Read more](trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)#### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)#### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)#### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)#### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)#### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)#### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)#### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)#### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)#### fn collect<B>(self) -> Bwhere B: [FromIterator](trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](trait.extend "trait std::iter::Extend")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)#### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)#### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)#### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)#### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)#### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)#### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)#### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](trait.sum "trait std::iter::Sum")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](trait.product "trait std::iter::Product")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another. [Read more](trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are equal to those of another. [Read more](trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are unequal to those of another. [Read more](trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](trait.iterator#method.is_sorted_by_key)
[source](https://doc.rust-lang.org/src/core/iter/adapters/filter_map.rs.html#129)1.26.0 · ### impl<B, I, F> FusedIterator for FilterMap<I, F>where I: [FusedIterator](trait.fusediterator "trait std::iter::FusedIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Auto Trait Implementations
--------------------------
### impl<I, F> RefUnwindSafe for FilterMap<I, F>where F: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"), I: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<I, F> Send for FilterMap<I, F>where F: [Send](../marker/trait.send "trait std::marker::Send"), I: [Send](../marker/trait.send "trait std::marker::Send"),
### impl<I, F> Sync for FilterMap<I, F>where F: [Sync](../marker/trait.sync "trait std::marker::Sync"), I: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<I, F> Unpin for FilterMap<I, F>where F: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"), I: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"),
### impl<I, F> UnwindSafe for FilterMap<I, F>where F: [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"), I: [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"),
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Struct std::iter::Once Struct std::iter::Once
======================
```
pub struct Once<T> { /* private fields */ }
```
An iterator that yields an element exactly once.
This `struct` is created by the [`once()`](fn.once "once()") function. See its documentation for more.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/iter/sources/once.rs.html#62)### impl<T> Clone for Once<T>where T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
[source](https://doc.rust-lang.org/src/core/iter/sources/once.rs.html#62)#### fn clone(&self) -> Once<T>
Notable traits for [Once](struct.once "struct std::iter::Once")<T>
```
impl<T> Iterator for Once<T>
type Item = T;
```
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)1.0.0 · #### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/core/iter/sources/once.rs.html#62)### impl<T> Debug for Once<T>where T: [Debug](../fmt/trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/iter/sources/once.rs.html#62)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/iter/sources/once.rs.html#82)### impl<T> DoubleEndedIterator for Once<T>
[source](https://doc.rust-lang.org/src/core/iter/sources/once.rs.html#83)#### fn next\_back(&mut self) -> Option<T>
Removes and returns an element from the end of the iterator. [Read more](trait.doubleendediterator#tymethod.next_back)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#134)#### fn advance\_back\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator from the back by `n` elements. [Read more](trait.doubleendediterator#method.advance_back_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#184)1.37.0 · #### fn nth\_back(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element from the end of the iterator. [Read more](trait.doubleendediterator#method.nth_back)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#221-225)1.27.0 · #### fn try\_rfold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
This is the reverse version of [`Iterator::try_fold()`](trait.iterator#method.try_fold "Iterator::try_fold()"): it takes elements starting from the back of the iterator. [Read more](trait.doubleendediterator#method.try_rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#292-295)1.27.0 · #### fn rfold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
An iterator method that reduces the iterator’s elements to a single, final value, starting from the back. [Read more](trait.doubleendediterator#method.rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#347-350)1.27.0 · #### fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator from the back that satisfies a predicate. [Read more](trait.doubleendediterator#method.rfind)
[source](https://doc.rust-lang.org/src/core/iter/sources/once.rs.html#89)### impl<T> ExactSizeIterator for Once<T>
[source](https://doc.rust-lang.org/src/core/iter/sources/once.rs.html#90)#### fn len(&self) -> usize
Returns the exact remaining length of the iterator. [Read more](trait.exactsizeiterator#method.len)
[source](https://doc.rust-lang.org/src/core/iter/traits/exact_size.rs.html#138)#### fn is\_empty(&self) -> bool
🔬This is a nightly-only experimental API. (`exact_size_is_empty` [#35428](https://github.com/rust-lang/rust/issues/35428))
Returns `true` if the iterator is empty. [Read more](trait.exactsizeiterator#method.is_empty)
[source](https://doc.rust-lang.org/src/core/iter/sources/once.rs.html#69)### impl<T> Iterator for Once<T>
#### type Item = T
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/iter/sources/once.rs.html#72)#### fn next(&mut self) -> Option<T>
Advances the iterator and returns the next value. [Read more](trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/iter/sources/once.rs.html#76)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#252-254)1.0.0 · #### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#282-284)1.0.0 · #### fn last(self) -> Option<Self::Item>
Consumes the iterator, returning the last element. [Read more](trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#328)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#376)1.0.0 · #### fn nth(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element of the iterator. [Read more](trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)1.0.0 · #### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)1.0.0 · #### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)1.0.0 · #### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)1.0.0 · #### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)1.0.0 · #### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)1.0.0 · #### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)1.0.0 · #### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](struct.peekable#method.peek) and [`peek_mut`](struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)1.0.0 · #### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](trait.iterator#method.skip)s elements based on a predicate. [Read more](trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)1.0.0 · #### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)1.0.0 · #### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)1.0.0 · #### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)1.0.0 · #### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)1.0.0 · #### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)1.0.0 · #### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)1.0.0 · #### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)1.0.0 · #### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)1.0.0 · #### fn collect<B>(self) -> Bwhere B: [FromIterator](trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](trait.extend "trait std::iter::Extend")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)1.0.0 · #### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2079-2082)#### fn partition\_in\_place<'a, T, P>(self, predicate: P) -> usizewhere T: 'a, Self: [DoubleEndedIterator](trait.doubleendediterator "trait std::iter::DoubleEndedIterator")<Item = [&'a mut](../primitive.reference) T>, P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_partition_in_place` [#62543](https://github.com/rust-lang/rust/issues/62543))
Reorders the elements of this iterator *in-place* according to the given predicate, such that all those that return `true` precede all those that return `false`. Returns the number of `true` elements found. [Read more](trait.iterator#method.partition_in_place)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2230-2234)1.27.0 · #### fn try\_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2407-2410)1.0.0 · #### fn fold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)1.0.0 · #### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)1.0.0 · #### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)1.0.0 · #### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)1.0.0 · #### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2920-2923)1.0.0 · #### fn rposition<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool), Self: [ExactSizeIterator](trait.exactsizeiterator "trait std::iter::ExactSizeIterator") + [DoubleEndedIterator](trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
Searches for an element in an iterator from the right, returning its index. [Read more](trait.iterator#method.rposition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3161-3163)1.0.0 · #### fn rev(self) -> Rev<Self>where Self: [DoubleEndedIterator](trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
Notable traits for [Rev](struct.rev "struct std::iter::Rev")<I>
```
impl<I> Iterator for Rev<I>where
I: DoubleEndedIterator,
type Item = <I as Iterator>::Item;
```
Reverses an iterator’s direction. [Read more](trait.iterator#method.rev)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)1.0.0 · #### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)1.0.0 · #### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](trait.sum "trait std::iter::Sum")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](trait.product "trait std::iter::Product")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another. [Read more](trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are equal to those of another. [Read more](trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are unequal to those of another. [Read more](trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](trait.iterator#method.is_sorted_by_key)
[source](https://doc.rust-lang.org/src/core/iter/sources/once.rs.html#99)1.26.0 · ### impl<T> FusedIterator for Once<T>
[source](https://doc.rust-lang.org/src/core/iter/sources/once.rs.html#96)### impl<T> TrustedLen for Once<T>
Auto Trait Implementations
--------------------------
### impl<T> RefUnwindSafe for Once<T>where T: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<T> Send for Once<T>where T: [Send](../marker/trait.send "trait std::marker::Send"),
### impl<T> Sync for Once<T>where T: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<T> Unpin for Once<T>where T: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"),
### impl<T> UnwindSafe for Once<T>where T: [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"),
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Struct std::iter::Empty Struct std::iter::Empty
=======================
```
pub struct Empty<T>(_);
```
An iterator that yields nothing.
This `struct` is created by the [`empty()`](fn.empty "empty()") function. See its documentation for more.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/iter/sources/empty.rs.html#80)### impl<T> Clone for Empty<T>
[source](https://doc.rust-lang.org/src/core/iter/sources/empty.rs.html#81)#### fn clone(&self) -> Empty<T>
Notable traits for [Empty](struct.empty "struct std::iter::Empty")<T>
```
impl<T> Iterator for Empty<T>
type Item = T;
```
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)1.0.0 · #### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/core/iter/sources/empty.rs.html#38)1.9.0 · ### impl<T> Debug for Empty<T>
[source](https://doc.rust-lang.org/src/core/iter/sources/empty.rs.html#39)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/iter/sources/empty.rs.html#90)const: [unstable](https://github.com/rust-lang/rust/issues/87864 "Tracking issue for const_default_impls") · ### impl<T> Default for Empty<T>
[source](https://doc.rust-lang.org/src/core/iter/sources/empty.rs.html#91)const: [unstable](https://github.com/rust-lang/rust/issues/87864 "Tracking issue for const_default_impls") · #### fn default() -> Empty<T>
Notable traits for [Empty](struct.empty "struct std::iter::Empty")<T>
```
impl<T> Iterator for Empty<T>
type Item = T;
```
Returns the “default value” for a type. [Read more](../default/trait.default#tymethod.default)
[source](https://doc.rust-lang.org/src/core/iter/sources/empty.rs.html#58)### impl<T> DoubleEndedIterator for Empty<T>
[source](https://doc.rust-lang.org/src/core/iter/sources/empty.rs.html#59)#### fn next\_back(&mut self) -> Option<T>
Removes and returns an element from the end of the iterator. [Read more](trait.doubleendediterator#tymethod.next_back)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#134)#### fn advance\_back\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator from the back by `n` elements. [Read more](trait.doubleendediterator#method.advance_back_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#184)1.37.0 · #### fn nth\_back(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element from the end of the iterator. [Read more](trait.doubleendediterator#method.nth_back)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#221-225)1.27.0 · #### fn try\_rfold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
This is the reverse version of [`Iterator::try_fold()`](trait.iterator#method.try_fold "Iterator::try_fold()"): it takes elements starting from the back of the iterator. [Read more](trait.doubleendediterator#method.try_rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#292-295)1.27.0 · #### fn rfold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
An iterator method that reduces the iterator’s elements to a single, final value, starting from the back. [Read more](trait.doubleendediterator#method.rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#347-350)1.27.0 · #### fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator from the back that satisfies a predicate. [Read more](trait.doubleendediterator#method.rfind)
[source](https://doc.rust-lang.org/src/core/iter/sources/empty.rs.html#65)### impl<T> ExactSizeIterator for Empty<T>
[source](https://doc.rust-lang.org/src/core/iter/sources/empty.rs.html#66)#### fn len(&self) -> usize
Returns the exact remaining length of the iterator. [Read more](trait.exactsizeiterator#method.len)
[source](https://doc.rust-lang.org/src/core/iter/traits/exact_size.rs.html#138)#### fn is\_empty(&self) -> bool
🔬This is a nightly-only experimental API. (`exact_size_is_empty` [#35428](https://github.com/rust-lang/rust/issues/35428))
Returns `true` if the iterator is empty. [Read more](trait.exactsizeiterator#method.is_empty)
[source](https://doc.rust-lang.org/src/core/iter/sources/empty.rs.html#45)### impl<T> Iterator for Empty<T>
#### type Item = T
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/iter/sources/empty.rs.html#48)#### fn next(&mut self) -> Option<T>
Advances the iterator and returns the next value. [Read more](trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/iter/sources/empty.rs.html#52)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#252-254)1.0.0 · #### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#282-284)1.0.0 · #### fn last(self) -> Option<Self::Item>
Consumes the iterator, returning the last element. [Read more](trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#328)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#376)1.0.0 · #### fn nth(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element of the iterator. [Read more](trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)1.0.0 · #### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)1.0.0 · #### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)1.0.0 · #### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)1.0.0 · #### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)1.0.0 · #### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)1.0.0 · #### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)1.0.0 · #### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](struct.peekable#method.peek) and [`peek_mut`](struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)1.0.0 · #### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](trait.iterator#method.skip)s elements based on a predicate. [Read more](trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)1.0.0 · #### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)1.0.0 · #### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)1.0.0 · #### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)1.0.0 · #### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)1.0.0 · #### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)1.0.0 · #### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)1.0.0 · #### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)1.0.0 · #### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)1.0.0 · #### fn collect<B>(self) -> Bwhere B: [FromIterator](trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](trait.extend "trait std::iter::Extend")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)1.0.0 · #### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2079-2082)#### fn partition\_in\_place<'a, T, P>(self, predicate: P) -> usizewhere T: 'a, Self: [DoubleEndedIterator](trait.doubleendediterator "trait std::iter::DoubleEndedIterator")<Item = [&'a mut](../primitive.reference) T>, P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_partition_in_place` [#62543](https://github.com/rust-lang/rust/issues/62543))
Reorders the elements of this iterator *in-place* according to the given predicate, such that all those that return `true` precede all those that return `false`. Returns the number of `true` elements found. [Read more](trait.iterator#method.partition_in_place)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2230-2234)1.27.0 · #### fn try\_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2407-2410)1.0.0 · #### fn fold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)1.0.0 · #### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)1.0.0 · #### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)1.0.0 · #### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)1.0.0 · #### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2920-2923)1.0.0 · #### fn rposition<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool), Self: [ExactSizeIterator](trait.exactsizeiterator "trait std::iter::ExactSizeIterator") + [DoubleEndedIterator](trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
Searches for an element in an iterator from the right, returning its index. [Read more](trait.iterator#method.rposition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3161-3163)1.0.0 · #### fn rev(self) -> Rev<Self>where Self: [DoubleEndedIterator](trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
Notable traits for [Rev](struct.rev "struct std::iter::Rev")<I>
```
impl<I> Iterator for Rev<I>where
I: DoubleEndedIterator,
type Item = <I as Iterator>::Item;
```
Reverses an iterator’s direction. [Read more](trait.iterator#method.rev)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)1.0.0 · #### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)1.0.0 · #### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3312-3314)1.0.0 · #### fn cycle(self) -> Cycle<Self>where Self: [Clone](../clone/trait.clone "trait std::clone::Clone"),
Notable traits for [Cycle](struct.cycle "struct std::iter::Cycle")<I>
```
impl<I> Iterator for Cycle<I>where
I: Clone + Iterator,
type Item = <I as Iterator>::Item;
```
Repeats an iterator endlessly. [Read more](trait.iterator#method.cycle)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](trait.sum "trait std::iter::Sum")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](trait.product "trait std::iter::Product")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another. [Read more](trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are equal to those of another. [Read more](trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are unequal to those of another. [Read more](trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](trait.iterator#method.is_sorted_by_key)
[source](https://doc.rust-lang.org/src/core/iter/sources/empty.rs.html#75)1.26.0 · ### impl<T> FusedIterator for Empty<T>
[source](https://doc.rust-lang.org/src/core/iter/sources/empty.rs.html#72)### impl<T> TrustedLen for Empty<T>
Auto Trait Implementations
--------------------------
### impl<T> RefUnwindSafe for Empty<T>
### impl<T> Send for Empty<T>
### impl<T> Sync for Empty<T>
### impl<T> Unpin for Empty<T>
### impl<T> UnwindSafe for Empty<T>
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Struct std::iter::SkipWhile Struct std::iter::SkipWhile
===========================
```
pub struct SkipWhile<I, P> { /* private fields */ }
```
An iterator that rejects elements while `predicate` returns `true`.
This `struct` is created by the [`skip_while`](trait.iterator#method.skip_while) method on [`Iterator`](trait.iterator). See its documentation for more.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/iter/adapters/skip_while.rs.html#14)### impl<I, P> Clone for SkipWhile<I, P>where I: [Clone](../clone/trait.clone "trait std::clone::Clone"), P: [Clone](../clone/trait.clone "trait std::clone::Clone"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/skip_while.rs.html#14)#### fn clone(&self) -> SkipWhile<I, P>
Notable traits for [SkipWhile](struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)#### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/core/iter/adapters/skip_while.rs.html#28)1.9.0 · ### impl<I, P> Debug for SkipWhile<I, P>where I: [Debug](../fmt/trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/skip_while.rs.html#29)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/iter/adapters/skip_while.rs.html#35)### impl<I, P> Iterator for SkipWhile<I, P>where I: [Iterator](trait.iterator "trait std::iter::Iterator"), P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
#### type Item = <I as Iterator>::Item
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/iter/adapters/skip_while.rs.html#42)#### fn next(&mut self) -> Option<<I as Iterator>::Item>
Advances the iterator and returns the next value. [Read more](trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/iter/adapters/skip_while.rs.html#63)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/iter/adapters/skip_while.rs.html#69-73)#### fn try\_fold<Acc, Fold, R>(&mut self, init: Acc, fold: Fold) -> Rwhere Fold: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[SkipWhile](struct.skipwhile "struct std::iter::SkipWhile")<I, P> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Acc>, [SkipWhile](struct.skipwhile "struct std::iter::SkipWhile")<I, P>: [Sized](../marker/trait.sized "trait std::marker::Sized"),
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/adapters/skip_while.rs.html#85-87)#### fn fold<Acc, Fold>(self, init: Acc, fold: Fold) -> Accwhere Fold: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[SkipWhile](struct.skipwhile "struct std::iter::SkipWhile")<I, P> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Acc,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#252-254)#### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#282-284)#### fn last(self) -> Option<Self::Item>
Consumes the iterator, returning the last element. [Read more](trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#328)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#376)#### fn nth(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element of the iterator. [Read more](trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)#### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)#### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)#### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)#### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)#### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)#### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)#### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](struct.peekable#method.peek) and [`peek_mut`](struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)#### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](trait.iterator#method.skip)s elements based on a predicate. [Read more](trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)#### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)#### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)#### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)#### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)#### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)#### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)#### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)#### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)#### fn collect<B>(self) -> Bwhere B: [FromIterator](trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](trait.extend "trait std::iter::Extend")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)#### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)#### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)#### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)#### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)#### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)#### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)#### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](trait.sum "trait std::iter::Sum")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](trait.product "trait std::iter::Product")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another. [Read more](trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are equal to those of another. [Read more](trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are unequal to those of another. [Read more](trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](trait.iterator#method.is_sorted_by_key)
[source](https://doc.rust-lang.org/src/core/iter/adapters/skip_while.rs.html#100)1.26.0 · ### impl<I, P> FusedIterator for SkipWhile<I, P>where I: [FusedIterator](trait.fusediterator "trait std::iter::FusedIterator"), P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Auto Trait Implementations
--------------------------
### impl<I, P> RefUnwindSafe for SkipWhile<I, P>where I: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"), P: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<I, P> Send for SkipWhile<I, P>where I: [Send](../marker/trait.send "trait std::marker::Send"), P: [Send](../marker/trait.send "trait std::marker::Send"),
### impl<I, P> Sync for SkipWhile<I, P>where I: [Sync](../marker/trait.sync "trait std::marker::Sync"), P: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<I, P> Unpin for SkipWhile<I, P>where I: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"), P: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"),
### impl<I, P> UnwindSafe for SkipWhile<I, P>where I: [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"), P: [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"),
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Struct std::iter::Fuse Struct std::iter::Fuse
======================
```
pub struct Fuse<I> { /* private fields */ }
```
An iterator that yields `None` forever after the underlying iterator yields `None` once.
This `struct` is created by [`Iterator::fuse`](trait.iterator#method.fuse "Iterator::fuse"). See its documentation for more.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/iter/adapters/fuse.rs.html#14)### impl<I> Clone for Fuse<I>where I: [Clone](../clone/trait.clone "trait std::clone::Clone"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/fuse.rs.html#14)#### fn clone(&self) -> Fuse<I>
Notable traits for [Fuse](struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)#### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/core/iter/adapters/fuse.rs.html#14)### impl<I> Debug for Fuse<I>where I: [Debug](../fmt/trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/fuse.rs.html#14)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/iter/adapters/fuse.rs.html#120)### impl<I> DoubleEndedIterator for Fuse<I>where I: [DoubleEndedIterator](trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/fuse.rs.html#125)#### fn next\_back(&mut self) -> Option<<I as Iterator>::Item>
Removes and returns an element from the end of the iterator. [Read more](trait.doubleendediterator#tymethod.next_back)
[source](https://doc.rust-lang.org/src/core/iter/adapters/fuse.rs.html#130)#### fn nth\_back(&mut self, n: usize) -> Option<<I as Iterator>::Item>
Returns the `n`th element from the end of the iterator. [Read more](trait.doubleendediterator#method.nth_back)
[source](https://doc.rust-lang.org/src/core/iter/adapters/fuse.rs.html#135-139)#### fn try\_rfold<Acc, Fold, R>(&mut self, acc: Acc, fold: Fold) -> Rwhere Fold: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[Fuse](struct.fuse "struct std::iter::Fuse")<I> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Acc>, [Fuse](struct.fuse "struct std::iter::Fuse")<I>: [Sized](../marker/trait.sized "trait std::marker::Sized"),
This is the reverse version of [`Iterator::try_fold()`](trait.iterator#method.try_fold "Iterator::try_fold()"): it takes elements starting from the back of the iterator. [Read more](trait.doubleendediterator#method.try_rfold)
[source](https://doc.rust-lang.org/src/core/iter/adapters/fuse.rs.html#145-147)#### fn rfold<Acc, Fold>(self, acc: Acc, fold: Fold) -> Accwhere Fold: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[Fuse](struct.fuse "struct std::iter::Fuse")<I> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Acc,
An iterator method that reduces the iterator’s elements to a single, final value, starting from the back. [Read more](trait.doubleendediterator#method.rfold)
[source](https://doc.rust-lang.org/src/core/iter/adapters/fuse.rs.html#156-158)#### fn rfind<P>(&mut self, predicate: P) -> Option<<Fuse<I> as Iterator>::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&<[Fuse](struct.fuse "struct std::iter::Fuse")<I> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator from the back that satisfies a predicate. [Read more](trait.doubleendediterator#method.rfind)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#134)#### fn advance\_back\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator from the back by `n` elements. [Read more](trait.doubleendediterator#method.advance_back_by)
[source](https://doc.rust-lang.org/src/core/iter/adapters/fuse.rs.html#165)### impl<I> ExactSizeIterator for Fuse<I>where I: [ExactSizeIterator](trait.exactsizeiterator "trait std::iter::ExactSizeIterator"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/fuse.rs.html#169)#### fn len(&self) -> usize
Returns the exact remaining length of the iterator. [Read more](trait.exactsizeiterator#method.len)
[source](https://doc.rust-lang.org/src/core/iter/adapters/fuse.rs.html#176)#### fn is\_empty(&self) -> bool
🔬This is a nightly-only experimental API. (`exact_size_is_empty` [#35428](https://github.com/rust-lang/rust/issues/35428))
Returns `true` if the iterator is empty. [Read more](trait.exactsizeiterator#method.is_empty)
[source](https://doc.rust-lang.org/src/core/iter/adapters/fuse.rs.html#35)### impl<I> Iterator for Fuse<I>where I: [Iterator](trait.iterator "trait std::iter::Iterator"),
#### type Item = <I as Iterator>::Item
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/iter/adapters/fuse.rs.html#42)#### fn next(&mut self) -> Option<<Fuse<I> as Iterator>::Item>
Advances the iterator and returns the next value. [Read more](trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/iter/adapters/fuse.rs.html#47)#### fn nth(&mut self, n: usize) -> Option<<I as Iterator>::Item>
Returns the `n`th element of the iterator. [Read more](trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/iter/adapters/fuse.rs.html#52)#### fn last(self) -> Option<<Fuse<I> as Iterator>::Item>
Consumes the iterator, returning the last element. [Read more](trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/adapters/fuse.rs.html#60)#### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/iter/adapters/fuse.rs.html#68)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/iter/adapters/fuse.rs.html#76-80)#### fn try\_fold<Acc, Fold, R>(&mut self, acc: Acc, fold: Fold) -> Rwhere Fold: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[Fuse](struct.fuse "struct std::iter::Fuse")<I> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Acc>, [Fuse](struct.fuse "struct std::iter::Fuse")<I>: [Sized](../marker/trait.sized "trait std::marker::Sized"),
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/adapters/fuse.rs.html#86-88)#### fn fold<Acc, Fold>(self, acc: Acc, fold: Fold) -> Accwhere Fold: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[Fuse](struct.fuse "struct std::iter::Fuse")<I> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Acc,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/adapters/fuse.rs.html#97-99)#### fn find<P>(&mut self, predicate: P) -> Option<<Fuse<I> as Iterator>::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&<[Fuse](struct.fuse "struct std::iter::Fuse")<I> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#328)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)#### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)#### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)#### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)#### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)#### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)#### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)#### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](struct.peekable#method.peek) and [`peek_mut`](struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)#### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](trait.iterator#method.skip)s elements based on a predicate. [Read more](trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)#### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)#### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)#### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)#### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)#### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)#### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)#### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)#### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)#### fn collect<B>(self) -> Bwhere B: [FromIterator](trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](trait.extend "trait std::iter::Extend")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)#### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)#### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)#### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)#### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)#### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)#### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](trait.sum "trait std::iter::Sum")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](trait.product "trait std::iter::Product")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another. [Read more](trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are equal to those of another. [Read more](trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are unequal to those of another. [Read more](trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](trait.iterator#method.is_sorted_by_key)
[source](https://doc.rust-lang.org/src/core/iter/adapters/fuse.rs.html#30)1.26.0 · ### impl<I> FusedIterator for Fuse<I>where I: [Iterator](trait.iterator "trait std::iter::Iterator"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/fuse.rs.html#188)### impl<I> TrustedLen for Fuse<I>where I: [TrustedLen](trait.trustedlen "trait std::iter::TrustedLen"),
Auto Trait Implementations
--------------------------
### impl<I> RefUnwindSafe for Fuse<I>where I: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<I> Send for Fuse<I>where I: [Send](../marker/trait.send "trait std::marker::Send"),
### impl<I> Sync for Fuse<I>where I: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<I> Unpin for Fuse<I>where I: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"),
### impl<I> UnwindSafe for Fuse<I>where I: [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"),
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Struct std::iter::Skip Struct std::iter::Skip
======================
```
pub struct Skip<I> { /* private fields */ }
```
An iterator that skips over `n` elements of `iter`.
This `struct` is created by the [`skip`](trait.iterator#method.skip) method on [`Iterator`](trait.iterator). See its documentation for more.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/iter/adapters/skip.rs.html#12)### impl<I> Clone for Skip<I>where I: [Clone](../clone/trait.clone "trait std::clone::Clone"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/skip.rs.html#12)#### fn clone(&self) -> Skip<I>
Notable traits for [Skip](struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)#### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/core/iter/adapters/skip.rs.html#12)### impl<I> Debug for Skip<I>where I: [Debug](../fmt/trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/skip.rs.html#12)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/iter/adapters/skip.rs.html#166)1.9.0 · ### impl<I> DoubleEndedIterator for Skip<I>where I: [DoubleEndedIterator](trait.doubleendediterator "trait std::iter::DoubleEndedIterator") + [ExactSizeIterator](trait.exactsizeiterator "trait std::iter::ExactSizeIterator"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/skip.rs.html#170)#### fn next\_back(&mut self) -> Option<<Skip<I> as Iterator>::Item>
Removes and returns an element from the end of the iterator. [Read more](trait.doubleendediterator#tymethod.next_back)
[source](https://doc.rust-lang.org/src/core/iter/adapters/skip.rs.html#175)#### fn nth\_back(&mut self, n: usize) -> Option<<I as Iterator>::Item>
Returns the `n`th element from the end of the iterator. [Read more](trait.doubleendediterator#method.nth_back)
[source](https://doc.rust-lang.org/src/core/iter/adapters/skip.rs.html#188-192)#### fn try\_rfold<Acc, Fold, R>(&mut self, init: Acc, fold: Fold) -> Rwhere Fold: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[Skip](struct.skip "struct std::iter::Skip")<I> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Acc>, [Skip](struct.skip "struct std::iter::Skip")<I>: [Sized](../marker/trait.sized "trait std::marker::Sized"),
This is the reverse version of [`Iterator::try_fold()`](trait.iterator#method.try_fold "Iterator::try_fold()"): it takes elements starting from the back of the iterator. [Read more](trait.doubleendediterator#method.try_rfold)
[source](https://doc.rust-lang.org/src/core/iter/adapters/skip.rs.html#209-211)#### fn rfold<Acc, Fold>(self, init: Acc, fold: Fold) -> Accwhere Fold: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[Skip](struct.skip "struct std::iter::Skip")<I> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Acc,
An iterator method that reduces the iterator’s elements to a single, final value, starting from the back. [Read more](trait.doubleendediterator#method.rfold)
[source](https://doc.rust-lang.org/src/core/iter/adapters/skip.rs.html#222)#### fn advance\_back\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator from the back by `n` elements. [Read more](trait.doubleendediterator#method.advance_back_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#347-350)1.27.0 · #### fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator from the back that satisfies a predicate. [Read more](trait.doubleendediterator#method.rfind)
[source](https://doc.rust-lang.org/src/core/iter/adapters/skip.rs.html#163)### impl<I> ExactSizeIterator for Skip<I>where I: [ExactSizeIterator](trait.exactsizeiterator "trait std::iter::ExactSizeIterator"),
[source](https://doc.rust-lang.org/src/core/iter/traits/exact_size.rs.html#106)#### fn len(&self) -> usize
Returns the exact remaining length of the iterator. [Read more](trait.exactsizeiterator#method.len)
[source](https://doc.rust-lang.org/src/core/iter/traits/exact_size.rs.html#138)#### fn is\_empty(&self) -> bool
🔬This is a nightly-only experimental API. (`exact_size_is_empty` [#35428](https://github.com/rust-lang/rust/issues/35428))
Returns `true` if the iterator is empty. [Read more](trait.exactsizeiterator#method.is_empty)
[source](https://doc.rust-lang.org/src/core/iter/adapters/skip.rs.html#27)### impl<I> Iterator for Skip<I>where I: [Iterator](trait.iterator "trait std::iter::Iterator"),
#### type Item = <I as Iterator>::Item
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/iter/adapters/skip.rs.html#34)#### fn next(&mut self) -> Option<<I as Iterator>::Item>
Advances the iterator and returns the next value. [Read more](trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/iter/adapters/skip.rs.html#43)#### fn nth(&mut self, n: usize) -> Option<<I as Iterator>::Item>
Returns the `n`th element of the iterator. [Read more](trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/iter/adapters/skip.rs.html#65)#### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/iter/adapters/skip.rs.html#76)#### fn last(self) -> Option<<I as Iterator>::Item>
Consumes the iterator, returning the last element. [Read more](trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/adapters/skip.rs.html#85)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/iter/adapters/skip.rs.html#98-102)#### fn try\_fold<Acc, Fold, R>(&mut self, init: Acc, fold: Fold) -> Rwhere Fold: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[Skip](struct.skip "struct std::iter::Skip")<I> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Acc>, [Skip](struct.skip "struct std::iter::Skip")<I>: [Sized](../marker/trait.sized "trait std::marker::Sized"),
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/adapters/skip.rs.html#116-118)#### fn fold<Acc, Fold>(self, init: Acc, fold: Fold) -> Accwhere Fold: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[Skip](struct.skip "struct std::iter::Skip")<I> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Acc,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/adapters/skip.rs.html#131)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)#### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)#### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)#### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)#### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)#### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)#### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)#### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](struct.peekable#method.peek) and [`peek_mut`](struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)#### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](trait.iterator#method.skip)s elements based on a predicate. [Read more](trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)#### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)#### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)#### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)#### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)#### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)#### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)#### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)#### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)#### fn collect<B>(self) -> Bwhere B: [FromIterator](trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](trait.extend "trait std::iter::Extend")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)#### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)#### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)#### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)#### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)#### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)#### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)#### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](trait.sum "trait std::iter::Sum")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](trait.product "trait std::iter::Product")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another. [Read more](trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are equal to those of another. [Read more](trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are unequal to those of another. [Read more](trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](trait.iterator#method.is_sorted_by_key)
[source](https://doc.rust-lang.org/src/core/iter/adapters/skip.rs.html#233)1.26.0 · ### impl<I> FusedIterator for Skip<I>where I: [FusedIterator](trait.fusediterator "trait std::iter::FusedIterator"),
Auto Trait Implementations
--------------------------
### impl<I> RefUnwindSafe for Skip<I>where I: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<I> Send for Skip<I>where I: [Send](../marker/trait.send "trait std::marker::Send"),
### impl<I> Sync for Skip<I>where I: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<I> Unpin for Skip<I>where I: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"),
### impl<I> UnwindSafe for Skip<I>where I: [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"),
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Struct std::iter::TakeWhile Struct std::iter::TakeWhile
===========================
```
pub struct TakeWhile<I, P> { /* private fields */ }
```
An iterator that only accepts elements while `predicate` returns `true`.
This `struct` is created by the [`take_while`](trait.iterator#method.take_while) method on [`Iterator`](trait.iterator). See its documentation for more.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/iter/adapters/take_while.rs.html#14)### impl<I, P> Clone for TakeWhile<I, P>where I: [Clone](../clone/trait.clone "trait std::clone::Clone"), P: [Clone](../clone/trait.clone "trait std::clone::Clone"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/take_while.rs.html#14)#### fn clone(&self) -> TakeWhile<I, P>
Notable traits for [TakeWhile](struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)#### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/core/iter/adapters/take_while.rs.html#28)1.9.0 · ### impl<I, P> Debug for TakeWhile<I, P>where I: [Debug](../fmt/trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/take_while.rs.html#29)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/iter/adapters/take_while.rs.html#35)### impl<I, P> Iterator for TakeWhile<I, P>where I: [Iterator](trait.iterator "trait std::iter::Iterator"), P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
#### type Item = <I as Iterator>::Item
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/iter/adapters/take_while.rs.html#42)#### fn next(&mut self) -> Option<<I as Iterator>::Item>
Advances the iterator and returns the next value. [Read more](trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/iter/adapters/take_while.rs.html#57)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/iter/adapters/take_while.rs.html#67-71)#### fn try\_fold<Acc, Fold, R>(&mut self, init: Acc, fold: Fold) -> Rwhere Fold: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[TakeWhile](struct.takewhile "struct std::iter::TakeWhile")<I, P> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Acc>, [TakeWhile](struct.takewhile "struct std::iter::TakeWhile")<I, P>: [Sized](../marker/trait.sized "trait std::marker::Sized"),
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/adapters/take_while.rs.html#98-101)#### fn fold<Acc, Fold>(self, init: Acc, fold: Fold) -> Accwhere Fold: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[TakeWhile](struct.takewhile "struct std::iter::TakeWhile")<I, P> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Acc, [TakeWhile](struct.takewhile "struct std::iter::TakeWhile")<I, P>: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#252-254)#### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#282-284)#### fn last(self) -> Option<Self::Item>
Consumes the iterator, returning the last element. [Read more](trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#328)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#376)#### fn nth(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element of the iterator. [Read more](trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)#### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)#### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)#### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)#### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)#### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)#### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)#### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](struct.peekable#method.peek) and [`peek_mut`](struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)#### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](trait.iterator#method.skip)s elements based on a predicate. [Read more](trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)#### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)#### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)#### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)#### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)#### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)#### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)#### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)#### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)#### fn collect<B>(self) -> Bwhere B: [FromIterator](trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](trait.extend "trait std::iter::Extend")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)#### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)#### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)#### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)#### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)#### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)#### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)#### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](trait.sum "trait std::iter::Sum")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](trait.product "trait std::iter::Product")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another. [Read more](trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are equal to those of another. [Read more](trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are unequal to those of another. [Read more](trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](trait.iterator#method.is_sorted_by_key)
[source](https://doc.rust-lang.org/src/core/iter/adapters/take_while.rs.html#113)1.26.0 · ### impl<I, P> FusedIterator for TakeWhile<I, P>where I: [FusedIterator](trait.fusediterator "trait std::iter::FusedIterator"), P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Auto Trait Implementations
--------------------------
### impl<I, P> RefUnwindSafe for TakeWhile<I, P>where I: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"), P: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<I, P> Send for TakeWhile<I, P>where I: [Send](../marker/trait.send "trait std::marker::Send"), P: [Send](../marker/trait.send "trait std::marker::Send"),
### impl<I, P> Sync for TakeWhile<I, P>where I: [Sync](../marker/trait.sync "trait std::marker::Sync"), P: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<I, P> Unpin for TakeWhile<I, P>where I: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"), P: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"),
### impl<I, P> UnwindSafe for TakeWhile<I, P>where I: [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"), P: [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"),
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Struct std::iter::Flatten Struct std::iter::Flatten
=========================
```
pub struct Flatten<I>where I: Iterator, <I as Iterator>::Item: IntoIterator,{ /* private fields */ }
```
An iterator that flattens one level of nesting in an iterator of things that can be turned into iterators.
This `struct` is created by the [`flatten`](trait.iterator#method.flatten) method on [`Iterator`](trait.iterator "Iterator"). See its documentation for more.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/iter/adapters/flatten.rs.html#192)### impl<I, U> Clone for Flatten<I>where I: [Clone](../clone/trait.clone "trait std::clone::Clone") + [Iterator](trait.iterator "trait std::iter::Iterator"), U: [Clone](../clone/trait.clone "trait std::clone::Clone") + [Iterator](trait.iterator "trait std::iter::Iterator"), <I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), <<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item") as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[IntoIter](trait.intoiterator#associatedtype.IntoIter "type std::iter::IntoIterator::IntoIter") == U, <<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item") as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item") == <U as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/flatten.rs.html#197)#### fn clone(&self) -> Flatten<I>
Notable traits for [Flatten](struct.flatten "struct std::iter::Flatten")<I>
```
impl<I, U> Iterator for Flatten<I>where
I: Iterator,
U: Iterator,
<I as Iterator>::Item: IntoIterator,
<<I as Iterator>::Item as IntoIterator>::IntoIter == U,
<<I as Iterator>::Item as IntoIterator>::Item == <U as Iterator>::Item,
type Item = <U as Iterator>::Item;
```
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)1.0.0 · #### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/core/iter/adapters/flatten.rs.html#181)### impl<I, U> Debug for Flatten<I>where I: [Debug](../fmt/trait.debug "trait std::fmt::Debug") + [Iterator](trait.iterator "trait std::iter::Iterator"), U: [Debug](../fmt/trait.debug "trait std::fmt::Debug") + [Iterator](trait.iterator "trait std::iter::Iterator"), <I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), <<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item") as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[IntoIter](trait.intoiterator#associatedtype.IntoIter "type std::iter::IntoIterator::IntoIter") == U, <<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item") as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item") == <U as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/flatten.rs.html#186)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/iter/adapters/flatten.rs.html#255)### impl<I, U> DoubleEndedIterator for Flatten<I>where I: [DoubleEndedIterator](trait.doubleendediterator "trait std::iter::DoubleEndedIterator"), U: [DoubleEndedIterator](trait.doubleendediterator "trait std::iter::DoubleEndedIterator"), <I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), <<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item") as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[IntoIter](trait.intoiterator#associatedtype.IntoIter "type std::iter::IntoIterator::IntoIter") == U, <<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item") as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item") == <U as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/flatten.rs.html#261)#### fn next\_back(&mut self) -> Option<<U as Iterator>::Item>
Removes and returns an element from the end of the iterator. [Read more](trait.doubleendediterator#tymethod.next_back)
[source](https://doc.rust-lang.org/src/core/iter/adapters/flatten.rs.html#266-270)#### fn try\_rfold<Acc, Fold, R>(&mut self, init: Acc, fold: Fold) -> Rwhere Fold: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[Flatten](struct.flatten "struct std::iter::Flatten")<I> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Acc>, [Flatten](struct.flatten "struct std::iter::Flatten")<I>: [Sized](../marker/trait.sized "trait std::marker::Sized"),
This is the reverse version of [`Iterator::try_fold()`](trait.iterator#method.try_fold "Iterator::try_fold()"): it takes elements starting from the back of the iterator. [Read more](trait.doubleendediterator#method.try_rfold)
[source](https://doc.rust-lang.org/src/core/iter/adapters/flatten.rs.html#276-278)#### fn rfold<Acc, Fold>(self, init: Acc, fold: Fold) -> Accwhere Fold: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[Flatten](struct.flatten "struct std::iter::Flatten")<I> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Acc,
An iterator method that reduces the iterator’s elements to a single, final value, starting from the back. [Read more](trait.doubleendediterator#method.rfold)
[source](https://doc.rust-lang.org/src/core/iter/adapters/flatten.rs.html#284)#### fn advance\_back\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator from the back by `n` elements. [Read more](trait.doubleendediterator#method.advance_back_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#184)1.37.0 · #### fn nth\_back(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element from the end of the iterator. [Read more](trait.doubleendediterator#method.nth_back)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#347-350)1.27.0 · #### fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator from the back that satisfies a predicate. [Read more](trait.doubleendediterator#method.rfind)
[source](https://doc.rust-lang.org/src/core/iter/adapters/flatten.rs.html#203)### impl<I, U> Iterator for Flatten<I>where I: [Iterator](trait.iterator "trait std::iter::Iterator"), U: [Iterator](trait.iterator "trait std::iter::Iterator"), <I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), <<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item") as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[IntoIter](trait.intoiterator#associatedtype.IntoIter "type std::iter::IntoIterator::IntoIter") == U, <<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item") as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item") == <U as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
#### type Item = <U as Iterator>::Item
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/iter/adapters/flatten.rs.html#211)#### fn next(&mut self) -> Option<<U as Iterator>::Item>
Advances the iterator and returns the next value. [Read more](trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/iter/adapters/flatten.rs.html#216)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/iter/adapters/flatten.rs.html#221-225)#### fn try\_fold<Acc, Fold, R>(&mut self, init: Acc, fold: Fold) -> Rwhere Fold: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[Flatten](struct.flatten "struct std::iter::Flatten")<I> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Acc>, [Flatten](struct.flatten "struct std::iter::Flatten")<I>: [Sized](../marker/trait.sized "trait std::marker::Sized"),
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/adapters/flatten.rs.html#231-233)#### fn fold<Acc, Fold>(self, init: Acc, fold: Fold) -> Accwhere Fold: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[Flatten](struct.flatten "struct std::iter::Flatten")<I> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Acc,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/adapters/flatten.rs.html#239)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/adapters/flatten.rs.html#244)#### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/iter/adapters/flatten.rs.html#249)#### fn last(self) -> Option<<Flatten<I> as Iterator>::Item>
Consumes the iterator, returning the last element. [Read more](trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#376)1.0.0 · #### fn nth(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element of the iterator. [Read more](trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)1.0.0 · #### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)1.0.0 · #### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)1.0.0 · #### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)1.0.0 · #### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)1.0.0 · #### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)1.0.0 · #### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)1.0.0 · #### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](struct.peekable#method.peek) and [`peek_mut`](struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)1.0.0 · #### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](trait.iterator#method.skip)s elements based on a predicate. [Read more](trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)1.0.0 · #### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)1.0.0 · #### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)1.0.0 · #### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)1.0.0 · #### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)1.0.0 · #### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)1.0.0 · #### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)1.0.0 · #### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)1.0.0 · #### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)1.0.0 · #### fn collect<B>(self) -> Bwhere B: [FromIterator](trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](trait.extend "trait std::iter::Extend")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)1.0.0 · #### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)1.0.0 · #### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)1.0.0 · #### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)1.0.0 · #### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)1.0.0 · #### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)1.0.0 · #### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)1.0.0 · #### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](trait.sum "trait std::iter::Sum")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](trait.product "trait std::iter::Product")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another. [Read more](trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are equal to those of another. [Read more](trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are unequal to those of another. [Read more](trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](trait.iterator#method.is_sorted_by_key)
[source](https://doc.rust-lang.org/src/core/iter/adapters/flatten.rs.html#290)### impl<I, U> FusedIterator for Flatten<I>where I: [FusedIterator](trait.fusediterator "trait std::iter::FusedIterator"), U: [Iterator](trait.iterator "trait std::iter::Iterator"), <I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), <<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item") as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[IntoIter](trait.intoiterator#associatedtype.IntoIter "type std::iter::IntoIterator::IntoIter") == U, <<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item") as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item") == <U as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/flatten.rs.html#298)### impl<I> TrustedLen for Flatten<I>where I: [TrustedLen](trait.trustedlen "trait std::iter::TrustedLen"), <I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): TrustedConstSize,
Auto Trait Implementations
--------------------------
### impl<I> RefUnwindSafe for Flatten<I>where I: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"), <<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item") as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[IntoIter](trait.intoiterator#associatedtype.IntoIter "type std::iter::IntoIterator::IntoIter"): [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<I> Send for Flatten<I>where I: [Send](../marker/trait.send "trait std::marker::Send"), <<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item") as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[IntoIter](trait.intoiterator#associatedtype.IntoIter "type std::iter::IntoIterator::IntoIter"): [Send](../marker/trait.send "trait std::marker::Send"),
### impl<I> Sync for Flatten<I>where I: [Sync](../marker/trait.sync "trait std::marker::Sync"), <<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item") as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[IntoIter](trait.intoiterator#associatedtype.IntoIter "type std::iter::IntoIterator::IntoIter"): [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<I> Unpin for Flatten<I>where I: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"), <<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item") as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[IntoIter](trait.intoiterator#associatedtype.IntoIter "type std::iter::IntoIterator::IntoIter"): [Unpin](../marker/trait.unpin "trait std::marker::Unpin"),
### impl<I> UnwindSafe for Flatten<I>where I: [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"), <<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item") as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[IntoIter](trait.intoiterator#associatedtype.IntoIter "type std::iter::IntoIterator::IntoIter"): [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"),
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Struct std::iter::Zip Struct std::iter::Zip
=====================
```
pub struct Zip<A, B> { /* private fields */ }
```
An iterator that iterates two other iterators simultaneously.
This `struct` is created by [`zip`](fn.zip "zip") or [`Iterator::zip`](trait.iterator#method.zip "Iterator::zip"). See their documentation for more.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/iter/adapters/zip.rs.html#10)### impl<A, B> Clone for Zip<A, B>where A: [Clone](../clone/trait.clone "trait std::clone::Clone"), B: [Clone](../clone/trait.clone "trait std::clone::Clone"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/zip.rs.html#10)#### fn clone(&self) -> Zip<A, B>
Notable traits for [Zip](struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)#### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/core/iter/adapters/zip.rs.html#441)### impl<A, B> Debug for Zip<A, B>where A: [Debug](../fmt/trait.debug "trait std::fmt::Debug"), B: [Debug](../fmt/trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/zip.rs.html#442)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/iter/adapters/zip.rs.html#109)### impl<A, B> DoubleEndedIterator for Zip<A, B>where A: [DoubleEndedIterator](trait.doubleendediterator "trait std::iter::DoubleEndedIterator") + [ExactSizeIterator](trait.exactsizeiterator "trait std::iter::ExactSizeIterator"), B: [DoubleEndedIterator](trait.doubleendediterator "trait std::iter::DoubleEndedIterator") + [ExactSizeIterator](trait.exactsizeiterator "trait std::iter::ExactSizeIterator"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/zip.rs.html#115)#### fn next\_back( &mut self) -> Option<(<A as Iterator>::Item, <B as Iterator>::Item)>
Removes and returns an element from the end of the iterator. [Read more](trait.doubleendediterator#tymethod.next_back)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#134)#### fn advance\_back\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator from the back by `n` elements. [Read more](trait.doubleendediterator#method.advance_back_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#184)1.37.0 · #### fn nth\_back(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element from the end of the iterator. [Read more](trait.doubleendediterator#method.nth_back)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#221-225)1.27.0 · #### fn try\_rfold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
This is the reverse version of [`Iterator::try_fold()`](trait.iterator#method.try_fold "Iterator::try_fold()"): it takes elements starting from the back of the iterator. [Read more](trait.doubleendediterator#method.try_rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#292-295)1.27.0 · #### fn rfold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
An iterator method that reduces the iterator’s elements to a single, final value, starting from the back. [Read more](trait.doubleendediterator#method.rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#347-350)1.27.0 · #### fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator from the back that satisfies a predicate. [Read more](trait.doubleendediterator#method.rfind)
[source](https://doc.rust-lang.org/src/core/iter/adapters/zip.rs.html#378)### impl<A, B> ExactSizeIterator for Zip<A, B>where A: [ExactSizeIterator](trait.exactsizeiterator "trait std::iter::ExactSizeIterator"), B: [ExactSizeIterator](trait.exactsizeiterator "trait std::iter::ExactSizeIterator"),
[source](https://doc.rust-lang.org/src/core/iter/traits/exact_size.rs.html#106)#### fn len(&self) -> usize
Returns the exact remaining length of the iterator. [Read more](trait.exactsizeiterator#method.len)
[source](https://doc.rust-lang.org/src/core/iter/traits/exact_size.rs.html#138)#### fn is\_empty(&self) -> bool
🔬This is a nightly-only experimental API. (`exact_size_is_empty` [#35428](https://github.com/rust-lang/rust/issues/35428))
Returns `true` if the iterator is empty. [Read more](trait.exactsizeiterator#method.is_empty)
[source](https://doc.rust-lang.org/src/core/iter/adapters/zip.rs.html#75)### impl<A, B> Iterator for Zip<A, B>where A: [Iterator](trait.iterator "trait std::iter::Iterator"), B: [Iterator](trait.iterator "trait std::iter::Iterator"),
#### type Item = (<A as Iterator>::Item, <B as Iterator>::Item)
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/iter/adapters/zip.rs.html#83)#### fn next(&mut self) -> Option<<Zip<A, B> as Iterator>::Item>
Advances the iterator and returns the next value. [Read more](trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/iter/adapters/zip.rs.html#88)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/iter/adapters/zip.rs.html#93)#### fn nth(&mut self, n: usize) -> Option<<Zip<A, B> as Iterator>::Item>
Returns the `n`th element of the iterator. [Read more](trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#252-254)#### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#282-284)#### fn last(self) -> Option<Self::Item>
Consumes the iterator, returning the last element. [Read more](trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#328)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)#### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)#### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)#### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)#### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)#### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)#### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)#### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](struct.peekable#method.peek) and [`peek_mut`](struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)#### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](trait.iterator#method.skip)s elements based on a predicate. [Read more](trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)#### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)#### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)#### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)#### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)#### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)#### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)#### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)#### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)#### fn collect<B>(self) -> Bwhere B: [FromIterator](trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](trait.extend "trait std::iter::Extend")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)#### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2230-2234)1.27.0 · #### fn try\_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2407-2410)#### fn fold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)#### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)#### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)#### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)#### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)#### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)#### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](trait.sum "trait std::iter::Sum")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](trait.product "trait std::iter::Product")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another. [Read more](trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are equal to those of another. [Read more](trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are unequal to those of another. [Read more](trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](trait.iterator#method.is_sorted_by_key)
[source](https://doc.rust-lang.org/src/core/iter/adapters/zip.rs.html#405)1.26.0 · ### impl<A, B> FusedIterator for Zip<A, B>where A: [FusedIterator](trait.fusediterator "trait std::iter::FusedIterator"), B: [FusedIterator](trait.fusediterator "trait std::iter::FusedIterator"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/zip.rs.html#413)### impl<A, B> TrustedLen for Zip<A, B>where A: [TrustedLen](trait.trustedlen "trait std::iter::TrustedLen"), B: [TrustedLen](trait.trustedlen "trait std::iter::TrustedLen"),
Auto Trait Implementations
--------------------------
### impl<A, B> RefUnwindSafe for Zip<A, B>where A: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"), B: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<A, B> Send for Zip<A, B>where A: [Send](../marker/trait.send "trait std::marker::Send"), B: [Send](../marker/trait.send "trait std::marker::Send"),
### impl<A, B> Sync for Zip<A, B>where A: [Sync](../marker/trait.sync "trait std::marker::Sync"), B: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<A, B> Unpin for Zip<A, B>where A: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"), B: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"),
### impl<A, B> UnwindSafe for Zip<A, B>where A: [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"), B: [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"),
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Function std::iter::empty Function std::iter::empty
=========================
```
pub const fn empty<T>() -> Empty<T>ⓘNotable traits for Empty<T>impl<T> Iterator for Empty<T> type Item = T;
```
Creates an iterator that yields nothing.
Examples
--------
Basic usage:
```
use std::iter;
// this could have been an iterator over i32, but alas, it's just not.
let mut nope = iter::empty::<i32>();
assert_eq!(None, nope.next());
```
rust Trait std::iter::ExactSizeIterator Trait std::iter::ExactSizeIterator
==================================
```
pub trait ExactSizeIterator: Iterator {
fn len(&self) -> usize { ... }
fn is_empty(&self) -> bool { ... }
}
```
An iterator that knows its exact length.
Many [`Iterator`](trait.iterator "Iterator")s don’t know how many times they will iterate, but some do. If an iterator knows how many times it can iterate, providing access to that information can be useful. For example, if you want to iterate backwards, a good start is to know where the end is.
When implementing an `ExactSizeIterator`, you must also implement [`Iterator`](trait.iterator "Iterator"). When doing so, the implementation of [`Iterator::size_hint`](trait.iterator#method.size_hint "Iterator::size_hint") *must* return the exact size of the iterator.
The [`len`](trait.exactsizeiterator#method.len) method has a default implementation, so you usually shouldn’t implement it. However, you may be able to provide a more performant implementation than the default, so overriding it in this case makes sense.
Note that this trait is a safe trait and as such does *not* and *cannot* guarantee that the returned length is correct. This means that `unsafe` code **must not** rely on the correctness of [`Iterator::size_hint`](trait.iterator#method.size_hint "Iterator::size_hint"). The unstable and unsafe [`TrustedLen`](trait.trustedlen) trait gives this additional guarantee.
Examples
--------
Basic usage:
```
// a finite range knows exactly how many times it will iterate
let five = 0..5;
assert_eq!(5, five.len());
```
In the [module-level docs](index), we implemented an [`Iterator`](trait.iterator "Iterator"), `Counter`. Let’s implement `ExactSizeIterator` for it as well:
```
impl ExactSizeIterator for Counter {
// We can easily calculate the remaining number of iterations.
fn len(&self) -> usize {
5 - self.count
}
}
// And now we can use it!
let mut counter = Counter::new();
assert_eq!(5, counter.len());
let _ = counter.next();
assert_eq!(4, counter.len());
```
Provided Methods
----------------
[source](https://doc.rust-lang.org/src/core/iter/traits/exact_size.rs.html#106)#### fn len(&self) -> usize
Returns the exact remaining length of the iterator.
The implementation ensures that the iterator will return exactly `len()` more times a [`Some(T)`](../option/enum.option#variant.Some) value, before returning [`None`](../option/enum.option#variant.None "None"). This method has a default implementation, so you usually should not implement it directly. However, if you can provide a more efficient implementation, you can do so. See the [trait-level](trait.exactsizeiterator) docs for an example.
This function has the same safety guarantees as the [`Iterator::size_hint`](trait.iterator#method.size_hint "Iterator::size_hint") function.
##### Examples
Basic usage:
```
// a finite range knows exactly how many times it will iterate
let mut range = 0..5;
assert_eq!(5, range.len());
let _ = range.next();
assert_eq!(4, range.len());
```
[source](https://doc.rust-lang.org/src/core/iter/traits/exact_size.rs.html#138)#### fn is\_empty(&self) -> bool
🔬This is a nightly-only experimental API. (`exact_size_is_empty` [#35428](https://github.com/rust-lang/rust/issues/35428))
Returns `true` if the iterator is empty.
This method has a default implementation using [`ExactSizeIterator::len()`](trait.exactsizeiterator#method.len "ExactSizeIterator::len()"), so you don’t need to implement it yourself.
##### Examples
Basic usage:
```
#![feature(exact_size_is_empty)]
let mut one_element = std::iter::once(0);
assert!(!one_element.is_empty());
assert_eq!(one_element.next(), Some(0));
assert!(one_element.is_empty());
assert_eq!(one_element.next(), None);
```
Implementors
------------
[source](https://doc.rust-lang.org/src/core/ascii.rs.html#132)### impl ExactSizeIterator for std::ascii::EscapeDefault
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#393)1.20.0 · ### impl ExactSizeIterator for EscapeDebug
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#347)1.11.0 · ### impl ExactSizeIterator for std::char::EscapeDefault
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#234)1.11.0 · ### impl ExactSizeIterator for EscapeUnicode
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#437)1.35.0 · ### impl ExactSizeIterator for ToLowercase
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#471)1.35.0 · ### impl ExactSizeIterator for ToUppercase
[source](https://doc.rust-lang.org/src/std/env.rs.html#813-820)### impl ExactSizeIterator for Args
[source](https://doc.rust-lang.org/src/std/env.rs.html#854-861)### impl ExactSizeIterator for ArgsOs
[source](https://doc.rust-lang.org/src/core/iter/range.rs.html#775-785)### impl ExactSizeIterator for Range<i8>
[source](https://doc.rust-lang.org/src/core/iter/range.rs.html#775-785)### impl ExactSizeIterator for Range<i16>
[source](https://doc.rust-lang.org/src/core/iter/range.rs.html#775-785)### impl ExactSizeIterator for Range<i32>
[source](https://doc.rust-lang.org/src/core/iter/range.rs.html#775-785)### impl ExactSizeIterator for Range<isize>
[source](https://doc.rust-lang.org/src/core/iter/range.rs.html#775-785)### impl ExactSizeIterator for Range<u8>
[source](https://doc.rust-lang.org/src/core/iter/range.rs.html#775-785)### impl ExactSizeIterator for Range<u16>
[source](https://doc.rust-lang.org/src/core/iter/range.rs.html#775-785)### impl ExactSizeIterator for Range<u32>
[source](https://doc.rust-lang.org/src/core/iter/range.rs.html#775-785)### impl ExactSizeIterator for Range<usize>
[source](https://doc.rust-lang.org/src/core/iter/range.rs.html#803-813)1.26.0 · ### impl ExactSizeIterator for RangeInclusive<i8>
[source](https://doc.rust-lang.org/src/core/iter/range.rs.html#803-813)1.26.0 · ### impl ExactSizeIterator for RangeInclusive<i16>
[source](https://doc.rust-lang.org/src/core/iter/range.rs.html#803-813)1.26.0 · ### impl ExactSizeIterator for RangeInclusive<u8>
[source](https://doc.rust-lang.org/src/core/iter/range.rs.html#803-813)1.26.0 · ### impl ExactSizeIterator for RangeInclusive<u16>
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#330)### impl ExactSizeIterator for Bytes<'\_>
[source](https://doc.rust-lang.org/src/std/process.rs.html#1079-1086)1.57.0 · ### impl<'a> ExactSizeIterator for CommandArgs<'a>
[source](https://doc.rust-lang.org/src/std/sys_common/process.rs.html#112-119)1.57.0 · ### impl<'a> ExactSizeIterator for CommandEnvs<'a>
[source](https://doc.rust-lang.org/src/core/iter/adapters/cloned.rs.html#101)1.1.0 · ### impl<'a, I, T> ExactSizeIterator for Cloned<I>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), I: [ExactSizeIterator](trait.exactsizeiterator "trait std::iter::ExactSizeIterator")<Item = [&'a](../primitive.reference) T>,
[source](https://doc.rust-lang.org/src/core/iter/adapters/copied.rs.html#127)1.36.0 · ### impl<'a, I, T> ExactSizeIterator for Copied<I>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), I: [ExactSizeIterator](trait.exactsizeiterator "trait std::iter::ExactSizeIterator")<Item = [&'a](../primitive.reference) T>,
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2996)1.31.0 · ### impl<'a, T> ExactSizeIterator for RChunksExact<'a, T>
[source](https://doc.rust-lang.org/src/core/option.rs.html#2201)### impl<A> ExactSizeIterator for std::option::IntoIter<A>
[source](https://doc.rust-lang.org/src/core/option.rs.html#2110)### impl<A> ExactSizeIterator for std::option::Iter<'\_, A>
[source](https://doc.rust-lang.org/src/core/option.rs.html#2160)### impl<A> ExactSizeIterator for std::option::IterMut<'\_, A>
[source](https://doc.rust-lang.org/src/core/iter/adapters/zip.rs.html#378)### impl<A, B> ExactSizeIterator for Zip<A, B>where A: [ExactSizeIterator](trait.exactsizeiterator "trait std::iter::ExactSizeIterator"), B: [ExactSizeIterator](trait.exactsizeiterator "trait std::iter::ExactSizeIterator"),
[source](https://doc.rust-lang.org/src/core/iter/sources/once_with.rs.html#99)1.43.0 · ### impl<A, F> ExactSizeIterator for OnceWith<F>where F: [FnOnce](../ops/trait.fnonce "trait std::ops::FnOnce")() -> A,
[source](https://doc.rust-lang.org/src/core/iter/adapters/map.rs.html#166)### impl<B, I, F> ExactSizeIterator for Map<I, F>where I: [ExactSizeIterator](trait.exactsizeiterator "trait std::iter::ExactSizeIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
[source](https://doc.rust-lang.org/src/core/iter/traits/exact_size.rs.html#144)### impl<I> ExactSizeIterator for &mut Iwhere I: [ExactSizeIterator](trait.exactsizeiterator "trait std::iter::ExactSizeIterator") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/enumerate.rs.html#219)### impl<I> ExactSizeIterator for Enumerate<I>where I: [ExactSizeIterator](trait.exactsizeiterator "trait std::iter::ExactSizeIterator"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/fuse.rs.html#165)### impl<I> ExactSizeIterator for Fuse<I>where I: [ExactSizeIterator](trait.exactsizeiterator "trait std::iter::ExactSizeIterator"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/peekable.rs.html#169)### impl<I> ExactSizeIterator for Peekable<I>where I: [ExactSizeIterator](trait.exactsizeiterator "trait std::iter::ExactSizeIterator"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/rev.rs.html#120)### impl<I> ExactSizeIterator for Rev<I>where I: [ExactSizeIterator](trait.exactsizeiterator "trait std::iter::ExactSizeIterator") + [DoubleEndedIterator](trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/skip.rs.html#163)### impl<I> ExactSizeIterator for Skip<I>where I: [ExactSizeIterator](trait.exactsizeiterator "trait std::iter::ExactSizeIterator"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/step_by.rs.html#235)1.28.0 · ### impl<I> ExactSizeIterator for StepBy<I>where I: [ExactSizeIterator](trait.exactsizeiterator "trait std::iter::ExactSizeIterator"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/take.rs.html#238)### impl<I> ExactSizeIterator for Take<I>where I: [ExactSizeIterator](trait.exactsizeiterator "trait std::iter::ExactSizeIterator"),
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#1923)### impl<I, A> ExactSizeIterator for Box<I, A>where I: [ExactSizeIterator](trait.exactsizeiterator "trait std::iter::ExactSizeIterator") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"), A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator"),
[source](https://doc.rust-lang.org/src/alloc/vec/splice.rs.html#51)1.21.0 · ### impl<I, A> ExactSizeIterator for Splice<'\_, I, A>where I: [Iterator](trait.iterator "trait std::iter::Iterator"), A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/inspect.rs.html#135)### impl<I, F> ExactSizeIterator for Inspect<I, F>where I: [ExactSizeIterator](trait.exactsizeiterator "trait std::iter::ExactSizeIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
[source](https://doc.rust-lang.org/src/core/iter/adapters/array_chunks.rs.html#169)### impl<I, const N: usize> ExactSizeIterator for std::iter::ArrayChunks<I, N>where I: [ExactSizeIterator](trait.exactsizeiterator "trait std::iter::ExactSizeIterator"),
[source](https://doc.rust-lang.org/src/std/collections/hash/set.rs.html#1570-1575)### impl<K> ExactSizeIterator for std::collections::hash\_set::Drain<'\_, K>
[source](https://doc.rust-lang.org/src/std/collections/hash/set.rs.html#1540-1545)### impl<K> ExactSizeIterator for std::collections::hash\_set::IntoIter<K>
[source](https://doc.rust-lang.org/src/std/collections/hash/set.rs.html#1510-1515)### impl<K> ExactSizeIterator for std::collections::hash\_set::Iter<'\_, K>
[source](https://doc.rust-lang.org/src/alloc/collections/btree/map.rs.html#1530)### impl<K, V> ExactSizeIterator for std::collections::btree\_map::Iter<'\_, K, V>
[source](https://doc.rust-lang.org/src/alloc/collections/btree/map.rs.html#1596)### impl<K, V> ExactSizeIterator for std::collections::btree\_map::IterMut<'\_, K, V>
[source](https://doc.rust-lang.org/src/alloc/collections/btree/map.rs.html#1758)### impl<K, V> ExactSizeIterator for std::collections::btree\_map::Keys<'\_, K, V>
[source](https://doc.rust-lang.org/src/alloc/collections/btree/map.rs.html#1799)### impl<K, V> ExactSizeIterator for std::collections::btree\_map::Values<'\_, K, V>
[source](https://doc.rust-lang.org/src/alloc/collections/btree/map.rs.html#1976)1.10.0 · ### impl<K, V> ExactSizeIterator for std::collections::btree\_map::ValuesMut<'\_, K, V>
[source](https://doc.rust-lang.org/src/std/collections/hash/map.rs.html#2464-2469)1.6.0 · ### impl<K, V> ExactSizeIterator for std::collections::hash\_map::Drain<'\_, K, V>
[source](https://doc.rust-lang.org/src/std/collections/hash/map.rs.html#2298-2303)### impl<K, V> ExactSizeIterator for std::collections::hash\_map::IntoIter<K, V>
[source](https://doc.rust-lang.org/src/std/collections/hash/map.rs.html#2404-2409)1.54.0 · ### impl<K, V> ExactSizeIterator for std::collections::hash\_map::IntoKeys<K, V>
[source](https://doc.rust-lang.org/src/std/collections/hash/map.rs.html#2434-2439)1.54.0 · ### impl<K, V> ExactSizeIterator for std::collections::hash\_map::IntoValues<K, V>
[source](https://doc.rust-lang.org/src/std/collections/hash/map.rs.html#2240-2245)### impl<K, V> ExactSizeIterator for std::collections::hash\_map::Iter<'\_, K, V>
[source](https://doc.rust-lang.org/src/std/collections/hash/map.rs.html#2264-2269)### impl<K, V> ExactSizeIterator for std::collections::hash\_map::IterMut<'\_, K, V>
[source](https://doc.rust-lang.org/src/std/collections/hash/map.rs.html#2328-2333)### impl<K, V> ExactSizeIterator for std::collections::hash\_map::Keys<'\_, K, V>
[source](https://doc.rust-lang.org/src/std/collections/hash/map.rs.html#2351-2356)### impl<K, V> ExactSizeIterator for std::collections::hash\_map::Values<'\_, K, V>
[source](https://doc.rust-lang.org/src/std/collections/hash/map.rs.html#2374-2379)1.10.0 · ### impl<K, V> ExactSizeIterator for std::collections::hash\_map::ValuesMut<'\_, K, V>
[source](https://doc.rust-lang.org/src/alloc/collections/btree/map.rs.html#1716)### impl<K, V, A> ExactSizeIterator for std::collections::btree\_map::IntoIter<K, V, A>where A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator") + [Clone](../clone/trait.clone "trait std::clone::Clone"),
[source](https://doc.rust-lang.org/src/alloc/collections/btree/map.rs.html#2018)1.54.0 · ### impl<K, V, A> ExactSizeIterator for std::collections::btree\_map::IntoKeys<K, V, A>where A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator") + [Clone](../clone/trait.clone "trait std::clone::Clone"),
[source](https://doc.rust-lang.org/src/alloc/collections/btree/map.rs.html#2052)1.54.0 · ### impl<K, V, A> ExactSizeIterator for std::collections::btree\_map::IntoValues<K, V, A>where A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator") + [Clone](../clone/trait.clone "trait std::clone::Clone"),
[source](https://doc.rust-lang.org/src/alloc/collections/binary_heap.rs.html#1507)1.6.0 · ### impl<T> ExactSizeIterator for std::collections::binary\_heap::Drain<'\_, T>
[source](https://doc.rust-lang.org/src/alloc/collections/binary_heap.rs.html#1565)### impl<T> ExactSizeIterator for DrainSorted<'\_, T>where T: [Ord](../cmp/trait.ord "trait std::cmp::Ord"),
[source](https://doc.rust-lang.org/src/alloc/collections/binary_heap.rs.html#1405)### impl<T> ExactSizeIterator for std::collections::binary\_heap::IntoIter<T>
[source](https://doc.rust-lang.org/src/alloc/collections/binary_heap.rs.html#1463)### impl<T> ExactSizeIterator for IntoIterSorted<T>where T: [Ord](../cmp/trait.ord "trait std::cmp::Ord"),
[source](https://doc.rust-lang.org/src/alloc/collections/binary_heap.rs.html#1352)### impl<T> ExactSizeIterator for std::collections::binary\_heap::Iter<'\_, T>
[source](https://doc.rust-lang.org/src/alloc/collections/btree/set.rs.html#1522)### impl<T> ExactSizeIterator for std::collections::btree\_set::Iter<'\_, T>
[source](https://doc.rust-lang.org/src/alloc/collections/linked_list.rs.html#1806)### impl<T> ExactSizeIterator for std::collections::linked\_list::IntoIter<T>
[source](https://doc.rust-lang.org/src/alloc/collections/linked_list.rs.html#1073)### impl<T> ExactSizeIterator for std::collections::linked\_list::Iter<'\_, T>
[source](https://doc.rust-lang.org/src/alloc/collections/linked_list.rs.html#1127)### impl<T> ExactSizeIterator for std::collections::linked\_list::IterMut<'\_, T>
[source](https://doc.rust-lang.org/src/alloc/collections/vec_deque/iter.rs.html#199)### impl<T> ExactSizeIterator for std::collections::vec\_deque::Iter<'\_, T>
[source](https://doc.rust-lang.org/src/alloc/collections/vec_deque/iter_mut.rs.html#142)### impl<T> ExactSizeIterator for std::collections::vec\_deque::IterMut<'\_, T>
[source](https://doc.rust-lang.org/src/core/result.rs.html#2011)### impl<T> ExactSizeIterator for std::result::IntoIter<T>
[source](https://doc.rust-lang.org/src/core/result.rs.html#1916)### impl<T> ExactSizeIterator for std::result::Iter<'\_, T>
[source](https://doc.rust-lang.org/src/core/result.rs.html#1965)### impl<T> ExactSizeIterator for std::result::IterMut<'\_, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1592)### impl<T> ExactSizeIterator for Chunks<'\_, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1934)1.31.0 · ### impl<T> ExactSizeIterator for ChunksExact<'\_, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2101)1.31.0 · ### impl<T> ExactSizeIterator for ChunksExactMut<'\_, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1773)### impl<T> ExactSizeIterator for ChunksMut<'\_, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#135-145)### impl<T> ExactSizeIterator for std::slice::Iter<'\_, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#366)### impl<T> ExactSizeIterator for std::slice::IterMut<'\_, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2646)1.31.0 · ### impl<T> ExactSizeIterator for RChunks<'\_, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#3167)1.31.0 · ### impl<T> ExactSizeIterator for RChunksExactMut<'\_, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2832)1.31.0 · ### impl<T> ExactSizeIterator for RChunksMut<'\_, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1409)### impl<T> ExactSizeIterator for Windows<'\_, T>
[source](https://doc.rust-lang.org/src/core/iter/sources/empty.rs.html#65)1.2.0 · ### impl<T> ExactSizeIterator for Empty<T>
[source](https://doc.rust-lang.org/src/core/iter/sources/once.rs.html#89)1.2.0 · ### impl<T> ExactSizeIterator for Once<T>
[source](https://doc.rust-lang.org/src/alloc/collections/btree/set.rs.html#1550)### impl<T, A> ExactSizeIterator for std::collections::btree\_set::IntoIter<T, A>where A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator") + [Clone](../clone/trait.clone "trait std::clone::Clone"),
[source](https://doc.rust-lang.org/src/alloc/collections/vec_deque/drain.rs.html#165)1.6.0 · ### impl<T, A> ExactSizeIterator for std::collections::vec\_deque::Drain<'\_, T, A>where A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator"),
[source](https://doc.rust-lang.org/src/alloc/collections/vec_deque/into_iter.rs.html#62)### impl<T, A> ExactSizeIterator for std::collections::vec\_deque::IntoIter<T, A>where A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator"),
[source](https://doc.rust-lang.org/src/alloc/vec/drain.rs.html#245)1.6.0 · ### impl<T, A> ExactSizeIterator for std::vec::Drain<'\_, T, A>where A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator"),
[source](https://doc.rust-lang.org/src/alloc/vec/into_iter.rs.html#303)### impl<T, A> ExactSizeIterator for std::vec::IntoIter<T, A>where A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator"),
[source](https://doc.rust-lang.org/src/core/array/iter.rs.html#373)1.40.0 · ### impl<T, const N: usize> ExactSizeIterator for std::array::IntoIter<T, N>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2351)### impl<T, const N: usize> ExactSizeIterator for std::slice::ArrayChunks<'\_, T, N>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2469)### impl<T, const N: usize> ExactSizeIterator for ArrayChunksMut<'\_, T, N>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2241)### impl<T, const N: usize> ExactSizeIterator for ArrayWindows<'\_, T, N>
| programming_docs |
rust Struct std::iter::ByRefSized Struct std::iter::ByRefSized
============================
```
pub struct ByRefSized<'a, I>(pub &'a mut I);
```
🔬This is a nightly-only experimental API. (`std_internals`)
Like `Iterator::by_ref`, but requiring `Sized` so it can forward generics.
Ideally this will no longer be required, eventually, but as can be seen in the benchmarks (as of Feb 2022 at least) `by_ref` can have performance cost.
Tuple Fields
------------
`0: [&'a mut](../primitive.reference) I`
🔬This is a nightly-only experimental API. (`std_internals`)
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/iter/adapters/by_ref_sized.rs.html#8)### impl<'a, I> Debug for ByRefSized<'a, I>where I: [Debug](../fmt/trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/by_ref_sized.rs.html#8)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/iter/adapters/by_ref_sized.rs.html#58)### impl<I> DoubleEndedIterator for ByRefSized<'\_, I>where I: [DoubleEndedIterator](trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/by_ref_sized.rs.html#60)#### fn next\_back(&mut self) -> Option<<ByRefSized<'\_, I> as Iterator>::Item>
Removes and returns an element from the end of the iterator. [Read more](trait.doubleendediterator#tymethod.next_back)
[source](https://doc.rust-lang.org/src/core/iter/adapters/by_ref_sized.rs.html#65)#### fn advance\_back\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator from the back by `n` elements. [Read more](trait.doubleendediterator#method.advance_back_by)
[source](https://doc.rust-lang.org/src/core/iter/adapters/by_ref_sized.rs.html#70)#### fn nth\_back(&mut self, n: usize) -> Option<<ByRefSized<'\_, I> as Iterator>::Item>
Returns the `n`th element from the end of the iterator. [Read more](trait.doubleendediterator#method.nth_back)
[source](https://doc.rust-lang.org/src/core/iter/adapters/by_ref_sized.rs.html#75-77)#### fn rfold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, <[ByRefSized](struct.byrefsized "struct std::iter::ByRefSized")<'\_, I> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
An iterator method that reduces the iterator’s elements to a single, final value, starting from the back. [Read more](trait.doubleendediterator#method.rfold)
[source](https://doc.rust-lang.org/src/core/iter/adapters/by_ref_sized.rs.html#84-87)#### fn try\_rfold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, <[ByRefSized](struct.byrefsized "struct std::iter::ByRefSized")<'\_, I> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
This is the reverse version of [`Iterator::try_fold()`](trait.iterator#method.try_fold "Iterator::try_fold()"): it takes elements starting from the back of the iterator. [Read more](trait.doubleendediterator#method.try_rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#347-350)1.27.0 · #### fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator from the back that satisfies a predicate. [Read more](trait.doubleendediterator#method.rfind)
[source](https://doc.rust-lang.org/src/core/iter/adapters/by_ref_sized.rs.html#15)### impl<I> Iterator for ByRefSized<'\_, I>where I: [Iterator](trait.iterator "trait std::iter::Iterator"),
#### type Item = <I as Iterator>::Item
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/iter/adapters/by_ref_sized.rs.html#19)#### fn next(&mut self) -> Option<<ByRefSized<'\_, I> as Iterator>::Item>
Advances the iterator and returns the next value. [Read more](trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/iter/adapters/by_ref_sized.rs.html#24)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/iter/adapters/by_ref_sized.rs.html#29)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/adapters/by_ref_sized.rs.html#34)#### fn nth(&mut self, n: usize) -> Option<<ByRefSized<'\_, I> as Iterator>::Item>
Returns the `n`th element of the iterator. [Read more](trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/iter/adapters/by_ref_sized.rs.html#39-41)#### fn fold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, <[ByRefSized](struct.byrefsized "struct std::iter::ByRefSized")<'\_, I> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/adapters/by_ref_sized.rs.html#48-51)#### fn try\_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, <[ByRefSized](struct.byrefsized "struct std::iter::ByRefSized")<'\_, I> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#252-254)1.0.0 · #### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#282-284)1.0.0 · #### fn last(self) -> Option<Self::Item>
Consumes the iterator, returning the last element. [Read more](trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)1.0.0 · #### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)1.0.0 · #### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)1.0.0 · #### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)1.0.0 · #### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)1.0.0 · #### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)1.0.0 · #### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)1.0.0 · #### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](struct.peekable#method.peek) and [`peek_mut`](struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)1.0.0 · #### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](trait.iterator#method.skip)s elements based on a predicate. [Read more](trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)1.0.0 · #### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)1.0.0 · #### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)1.0.0 · #### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)1.0.0 · #### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)1.0.0 · #### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)1.0.0 · #### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)1.0.0 · #### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)1.0.0 · #### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)1.0.0 · #### fn collect<B>(self) -> Bwhere B: [FromIterator](trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](trait.extend "trait std::iter::Extend")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)1.0.0 · #### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)1.0.0 · #### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)1.0.0 · #### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)1.0.0 · #### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)1.0.0 · #### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)1.0.0 · #### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)1.0.0 · #### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](trait.sum "trait std::iter::Sum")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](trait.product "trait std::iter::Product")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another. [Read more](trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are equal to those of another. [Read more](trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are unequal to those of another. [Read more](trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](trait.iterator#method.is_sorted_by_key)
Auto Trait Implementations
--------------------------
### impl<'a, I> RefUnwindSafe for ByRefSized<'a, I>where I: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<'a, I> Send for ByRefSized<'a, I>where I: [Send](../marker/trait.send "trait std::marker::Send"),
### impl<'a, I> Sync for ByRefSized<'a, I>where I: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<'a, I> Unpin for ByRefSized<'a, I>
### impl<'a, I> !UnwindSafe for ByRefSized<'a, I>
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Struct std::iter::Peekable Struct std::iter::Peekable
==========================
```
pub struct Peekable<I>where I: Iterator,{ /* private fields */ }
```
An iterator with a `peek()` that returns an optional reference to the next element.
This `struct` is created by the [`peekable`](trait.iterator#method.peekable) method on [`Iterator`](trait.iterator). See its documentation for more.
Implementations
---------------
[source](https://doc.rust-lang.org/src/core/iter/adapters/peekable.rs.html#174)### impl<I> Peekable<I>where I: [Iterator](trait.iterator "trait std::iter::Iterator"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/peekable.rs.html#214)#### pub fn peek(&mut self) -> Option<&<I as Iterator>::Item>
Returns a reference to the next() value without advancing the iterator.
Like [`next`](trait.iterator#tymethod.next), if there is a value, it is wrapped in a `Some(T)`. But if the iteration is over, `None` is returned.
Because `peek()` returns a reference, and many iterators iterate over references, there can be a possibly confusing situation where the return value is a double reference. You can see this effect in the examples below.
##### Examples
Basic usage:
```
let xs = [1, 2, 3];
let mut iter = xs.iter().peekable();
// peek() lets us see into the future
assert_eq!(iter.peek(), Some(&&1));
assert_eq!(iter.next(), Some(&1));
assert_eq!(iter.next(), Some(&2));
// The iterator does not advance even if we `peek` multiple times
assert_eq!(iter.peek(), Some(&&3));
assert_eq!(iter.peek(), Some(&&3));
assert_eq!(iter.next(), Some(&3));
// After the iterator is finished, so is `peek()`
assert_eq!(iter.peek(), None);
assert_eq!(iter.next(), None);
```
[source](https://doc.rust-lang.org/src/core/iter/adapters/peekable.rs.html#254)1.53.0 · #### pub fn peek\_mut(&mut self) -> Option<&mut <I as Iterator>::Item>
Returns a mutable reference to the next() value without advancing the iterator.
Like [`next`](trait.iterator#tymethod.next), if there is a value, it is wrapped in a `Some(T)`. But if the iteration is over, `None` is returned.
Because `peek_mut()` returns a reference, and many iterators iterate over references, there can be a possibly confusing situation where the return value is a double reference. You can see this effect in the examples below.
##### Examples
Basic usage:
```
let mut iter = [1, 2, 3].iter().peekable();
// Like with `peek()`, we can see into the future without advancing the iterator.
assert_eq!(iter.peek_mut(), Some(&mut &1));
assert_eq!(iter.peek_mut(), Some(&mut &1));
assert_eq!(iter.next(), Some(&1));
// Peek into the iterator and set the value behind the mutable reference.
if let Some(p) = iter.peek_mut() {
assert_eq!(*p, &2);
*p = &5;
}
// The value we put in reappears as the iterator continues.
assert_eq!(iter.collect::<Vec<_>>(), vec![&5, &3]);
```
[source](https://doc.rust-lang.org/src/core/iter/adapters/peekable.rs.html#285)1.51.0 · #### pub fn next\_if( &mut self, func: impl FnOnce(&<I as Iterator>::Item) -> bool) -> Option<<I as Iterator>::Item>
Consume and return the next value of this iterator if a condition is true.
If `func` returns `true` for the next value of this iterator, consume and return it. Otherwise, return `None`.
##### Examples
Consume a number if it’s equal to 0.
```
let mut iter = (0..5).peekable();
// The first item of the iterator is 0; consume it.
assert_eq!(iter.next_if(|&x| x == 0), Some(0));
// The next item returned is now 1, so `consume` will return `false`.
assert_eq!(iter.next_if(|&x| x == 0), None);
// `next_if` saves the value of the next item if it was not equal to `expected`.
assert_eq!(iter.next(), Some(1));
```
Consume any number less than 10.
```
let mut iter = (1..20).peekable();
// Consume all numbers less than 10
while iter.next_if(|&x| x < 10).is_some() {}
// The next value returned will be 10
assert_eq!(iter.next(), Some(10));
```
[source](https://doc.rust-lang.org/src/core/iter/adapters/peekable.rs.html#311-314)1.51.0 · #### pub fn next\_if\_eq<T>(&mut self, expected: &T) -> Option<<I as Iterator>::Item>where T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"), <I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<T>,
Consume and return the next item if it is equal to `expected`.
##### Example
Consume a number if it’s equal to 0.
```
let mut iter = (0..5).peekable();
// The first item of the iterator is 0; consume it.
assert_eq!(iter.next_if_eq(&0), Some(0));
// The next item returned is now 1, so `consume` will return `false`.
assert_eq!(iter.next_if_eq(&0), None);
// `next_if_eq` saves the value of the next item if it was not equal to `expected`.
assert_eq!(iter.next(), Some(1));
```
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/iter/adapters/peekable.rs.html#12)### impl<I> Clone for Peekable<I>where I: [Clone](../clone/trait.clone "trait std::clone::Clone") + [Iterator](trait.iterator "trait std::iter::Iterator"), <I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [Clone](../clone/trait.clone "trait std::clone::Clone"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/peekable.rs.html#12)#### fn clone(&self) -> Peekable<I>
Notable traits for [Peekable](struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)#### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/core/iter/adapters/peekable.rs.html#12)### impl<I> Debug for Peekable<I>where I: [Debug](../fmt/trait.debug "trait std::fmt::Debug") + [Iterator](trait.iterator "trait std::iter::Iterator"), <I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [Debug](../fmt/trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/peekable.rs.html#12)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/iter/adapters/peekable.rs.html#119)1.38.0 · ### impl<I> DoubleEndedIterator for Peekable<I>where I: [DoubleEndedIterator](trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/peekable.rs.html#124)#### fn next\_back(&mut self) -> Option<<Peekable<I> as Iterator>::Item>
Removes and returns an element from the end of the iterator. [Read more](trait.doubleendediterator#tymethod.next_back)
[source](https://doc.rust-lang.org/src/core/iter/adapters/peekable.rs.html#133-137)#### fn try\_rfold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, <[Peekable](struct.peekable "struct std::iter::Peekable")<I> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>, [Peekable](struct.peekable "struct std::iter::Peekable")<I>: [Sized](../marker/trait.sized "trait std::marker::Sized"),
This is the reverse version of [`Iterator::try_fold()`](trait.iterator#method.try_fold "Iterator::try_fold()"): it takes elements starting from the back of the iterator. [Read more](trait.doubleendediterator#method.try_rfold)
[source](https://doc.rust-lang.org/src/core/iter/adapters/peekable.rs.html#153-155)#### fn rfold<Acc, Fold>(self, init: Acc, fold: Fold) -> Accwhere Fold: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[Peekable](struct.peekable "struct std::iter::Peekable")<I> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Acc,
An iterator method that reduces the iterator’s elements to a single, final value, starting from the back. [Read more](trait.doubleendediterator#method.rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#134)#### fn advance\_back\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator from the back by `n` elements. [Read more](trait.doubleendediterator#method.advance_back_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#184)1.37.0 · #### fn nth\_back(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element from the end of the iterator. [Read more](trait.doubleendediterator#method.nth_back)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#347-350)1.27.0 · #### fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator from the back that satisfies a predicate. [Read more](trait.doubleendediterator#method.rfind)
[source](https://doc.rust-lang.org/src/core/iter/adapters/peekable.rs.html#169)### impl<I> ExactSizeIterator for Peekable<I>where I: [ExactSizeIterator](trait.exactsizeiterator "trait std::iter::ExactSizeIterator"),
[source](https://doc.rust-lang.org/src/core/iter/traits/exact_size.rs.html#106)#### fn len(&self) -> usize
Returns the exact remaining length of the iterator. [Read more](trait.exactsizeiterator#method.len)
[source](https://doc.rust-lang.org/src/core/iter/traits/exact_size.rs.html#138)#### fn is\_empty(&self) -> bool
🔬This is a nightly-only experimental API. (`exact_size_is_empty` [#35428](https://github.com/rust-lang/rust/issues/35428))
Returns `true` if the iterator is empty. [Read more](trait.exactsizeiterator#method.is_empty)
[source](https://doc.rust-lang.org/src/core/iter/adapters/peekable.rs.html#32)### impl<I> Iterator for Peekable<I>where I: [Iterator](trait.iterator "trait std::iter::Iterator"),
#### type Item = <I as Iterator>::Item
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/iter/adapters/peekable.rs.html#36)#### fn next(&mut self) -> Option<<I as Iterator>::Item>
Advances the iterator and returns the next value. [Read more](trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/iter/adapters/peekable.rs.html#45)#### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/iter/adapters/peekable.rs.html#54)#### fn nth(&mut self, n: usize) -> Option<<I as Iterator>::Item>
Returns the `n`th element of the iterator. [Read more](trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/iter/adapters/peekable.rs.html#64)#### fn last(self) -> Option<<I as Iterator>::Item>
Consumes the iterator, returning the last element. [Read more](trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/adapters/peekable.rs.html#74)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/iter/adapters/peekable.rs.html#90-94)#### fn try\_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, <[Peekable](struct.peekable "struct std::iter::Peekable")<I> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>, [Peekable](struct.peekable "struct std::iter::Peekable")<I>: [Sized](../marker/trait.sized "trait std::marker::Sized"),
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/adapters/peekable.rs.html#105-107)#### fn fold<Acc, Fold>(self, init: Acc, fold: Fold) -> Accwhere Fold: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[Peekable](struct.peekable "struct std::iter::Peekable")<I> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Acc,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#328)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)#### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)#### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)#### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)#### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)#### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)#### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)#### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](struct.peekable#method.peek) and [`peek_mut`](struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)#### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](trait.iterator#method.skip)s elements based on a predicate. [Read more](trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)#### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)#### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)#### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)#### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)#### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)#### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)#### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)#### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)#### fn collect<B>(self) -> Bwhere B: [FromIterator](trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](trait.extend "trait std::iter::Extend")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)#### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)#### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)#### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)#### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)#### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)#### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)#### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](trait.sum "trait std::iter::Sum")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](trait.product "trait std::iter::Product")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another. [Read more](trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are equal to those of another. [Read more](trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are unequal to those of another. [Read more](trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](trait.iterator#method.is_sorted_by_key)
[source](https://doc.rust-lang.org/src/core/iter/adapters/peekable.rs.html#172)1.26.0 · ### impl<I> FusedIterator for Peekable<I>where I: [FusedIterator](trait.fusediterator "trait std::iter::FusedIterator"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/peekable.rs.html#321)### impl<I> TrustedLen for Peekable<I>where I: [TrustedLen](trait.trustedlen "trait std::iter::TrustedLen"),
Auto Trait Implementations
--------------------------
### impl<I> RefUnwindSafe for Peekable<I>where I: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"), <I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<I> Send for Peekable<I>where I: [Send](../marker/trait.send "trait std::marker::Send"), <I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [Send](../marker/trait.send "trait std::marker::Send"),
### impl<I> Sync for Peekable<I>where I: [Sync](../marker/trait.sync "trait std::marker::Sync"), <I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<I> Unpin for Peekable<I>where I: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"), <I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [Unpin](../marker/trait.unpin "trait std::marker::Unpin"),
### impl<I> UnwindSafe for Peekable<I>where I: [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"), <I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"),
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Struct std::iter::MapWhile Struct std::iter::MapWhile
==========================
```
pub struct MapWhile<I, P> { /* private fields */ }
```
An iterator that only accepts elements while `predicate` returns `Some(_)`.
This `struct` is created by the [`map_while`](trait.iterator#method.map_while) method on [`Iterator`](trait.iterator). See its documentation for more.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/iter/adapters/map_while.rs.html#14)### impl<I, P> Clone for MapWhile<I, P>where I: [Clone](../clone/trait.clone "trait std::clone::Clone"), P: [Clone](../clone/trait.clone "trait std::clone::Clone"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/map_while.rs.html#14)#### fn clone(&self) -> MapWhile<I, P>
Notable traits for [MapWhile](struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)1.0.0 · #### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/core/iter/adapters/map_while.rs.html#27)### impl<I, P> Debug for MapWhile<I, P>where I: [Debug](../fmt/trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/map_while.rs.html#28)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/iter/adapters/map_while.rs.html#34)### impl<B, I, P> Iterator for MapWhile<I, P>where I: [Iterator](trait.iterator "trait std::iter::Iterator"), P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
#### type Item = B
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/iter/adapters/map_while.rs.html#41)#### fn next(&mut self) -> Option<B>
Advances the iterator and returns the next value. [Read more](trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/iter/adapters/map_while.rs.html#47)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/iter/adapters/map_while.rs.html#53-57)#### fn try\_fold<Acc, Fold, R>(&mut self, init: Acc, fold: Fold) -> Rwhere Fold: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[MapWhile](struct.mapwhile "struct std::iter::MapWhile")<I, P> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Acc>, [MapWhile](struct.mapwhile "struct std::iter::MapWhile")<I, P>: [Sized](../marker/trait.sized "trait std::marker::Sized"),
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/adapters/map_while.rs.html#68-71)#### fn fold<Acc, Fold>(self, init: Acc, fold: Fold) -> Accwhere Fold: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[MapWhile](struct.mapwhile "struct std::iter::MapWhile")<I, P> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Acc, [MapWhile](struct.mapwhile "struct std::iter::MapWhile")<I, P>: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#252-254)1.0.0 · #### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#282-284)1.0.0 · #### fn last(self) -> Option<Self::Item>
Consumes the iterator, returning the last element. [Read more](trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#328)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#376)1.0.0 · #### fn nth(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element of the iterator. [Read more](trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)1.0.0 · #### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)1.0.0 · #### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)1.0.0 · #### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)1.0.0 · #### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)1.0.0 · #### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)1.0.0 · #### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)1.0.0 · #### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](struct.peekable#method.peek) and [`peek_mut`](struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)1.0.0 · #### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](trait.iterator#method.skip)s elements based on a predicate. [Read more](trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)1.0.0 · #### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)#### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)1.0.0 · #### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)1.0.0 · #### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)1.0.0 · #### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)1.0.0 · #### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)1.0.0 · #### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)1.0.0 · #### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)1.0.0 · #### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)1.0.0 · #### fn collect<B>(self) -> Bwhere B: [FromIterator](trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](trait.extend "trait std::iter::Extend")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)1.0.0 · #### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)1.0.0 · #### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)1.0.0 · #### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)1.0.0 · #### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)1.0.0 · #### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)1.0.0 · #### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)1.0.0 · #### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](trait.sum "trait std::iter::Sum")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](trait.product "trait std::iter::Product")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another. [Read more](trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are equal to those of another. [Read more](trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are unequal to those of another. [Read more](trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](trait.iterator#method.is_sorted_by_key)
Auto Trait Implementations
--------------------------
### impl<I, P> RefUnwindSafe for MapWhile<I, P>where I: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"), P: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<I, P> Send for MapWhile<I, P>where I: [Send](../marker/trait.send "trait std::marker::Send"), P: [Send](../marker/trait.send "trait std::marker::Send"),
### impl<I, P> Sync for MapWhile<I, P>where I: [Sync](../marker/trait.sync "trait std::marker::Sync"), P: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<I, P> Unpin for MapWhile<I, P>where I: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"), P: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"),
### impl<I, P> UnwindSafe for MapWhile<I, P>where I: [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"), P: [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"),
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Struct std::iter::IntersperseWith Struct std::iter::IntersperseWith
=================================
```
pub struct IntersperseWith<I, G>where I: Iterator,{ /* private fields */ }
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
An iterator adapter that places a separator between all elements.
This `struct` is created by [`Iterator::intersperse_with`](trait.iterator#method.intersperse_with "Iterator::intersperse_with"). See its documentation for more information.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/iter/adapters/intersperse.rs.html#91)### impl<I, G> Clone for IntersperseWith<I, G>where I: [Iterator](trait.iterator "trait std::iter::Iterator") + [Clone](../clone/trait.clone "trait std::clone::Clone"), G: [Clone](../clone/trait.clone "trait std::clone::Clone"), <I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [Clone](../clone/trait.clone "trait std::clone::Clone"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/intersperse.rs.html#97)#### fn clone(&self) -> IntersperseWith<I, G>
Notable traits for [IntersperseWith](struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)1.0.0 · #### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/core/iter/adapters/intersperse.rs.html#75)### impl<I, G> Debug for IntersperseWith<I, G>where I: [Iterator](trait.iterator "trait std::iter::Iterator") + [Debug](../fmt/trait.debug "trait std::fmt::Debug"), G: [Debug](../fmt/trait.debug "trait std::fmt::Debug"), <I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [Debug](../fmt/trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/intersperse.rs.html#81)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/iter/adapters/intersperse.rs.html#117)### impl<I, G> Iterator for IntersperseWith<I, G>where I: [Iterator](trait.iterator "trait std::iter::Iterator"), G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> <I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
#### type Item = <I as Iterator>::Item
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/iter/adapters/intersperse.rs.html#125)#### fn next(&mut self) -> Option<<I as Iterator>::Item>
Advances the iterator and returns the next value. [Read more](trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/iter/adapters/intersperse.rs.html#135-138)#### fn fold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, <[IntersperseWith](struct.interspersewith "struct std::iter::IntersperseWith")<I, G> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B, [IntersperseWith](struct.interspersewith "struct std::iter::IntersperseWith")<I, G>: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/adapters/intersperse.rs.html#143)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#252-254)1.0.0 · #### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#282-284)1.0.0 · #### fn last(self) -> Option<Self::Item>
Consumes the iterator, returning the last element. [Read more](trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#328)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#376)1.0.0 · #### fn nth(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element of the iterator. [Read more](trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)1.0.0 · #### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)1.0.0 · #### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)1.0.0 · #### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)1.0.0 · #### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)1.0.0 · #### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)1.0.0 · #### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)1.0.0 · #### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](struct.peekable#method.peek) and [`peek_mut`](struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)1.0.0 · #### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](trait.iterator#method.skip)s elements based on a predicate. [Read more](trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)1.0.0 · #### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)1.0.0 · #### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)1.0.0 · #### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)1.0.0 · #### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)1.0.0 · #### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)1.0.0 · #### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)1.0.0 · #### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)1.0.0 · #### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)1.0.0 · #### fn collect<B>(self) -> Bwhere B: [FromIterator](trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](trait.extend "trait std::iter::Extend")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)1.0.0 · #### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2230-2234)1.27.0 · #### fn try\_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)1.0.0 · #### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)1.0.0 · #### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)1.0.0 · #### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)1.0.0 · #### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)1.0.0 · #### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)1.0.0 · #### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](trait.sum "trait std::iter::Sum")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](trait.product "trait std::iter::Product")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another. [Read more](trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are equal to those of another. [Read more](trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are unequal to those of another. [Read more](trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](trait.iterator#method.is_sorted_by_key)
Auto Trait Implementations
--------------------------
### impl<I, G> RefUnwindSafe for IntersperseWith<I, G>where G: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"), I: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"), <I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<I, G> Send for IntersperseWith<I, G>where G: [Send](../marker/trait.send "trait std::marker::Send"), I: [Send](../marker/trait.send "trait std::marker::Send"), <I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [Send](../marker/trait.send "trait std::marker::Send"),
### impl<I, G> Sync for IntersperseWith<I, G>where G: [Sync](../marker/trait.sync "trait std::marker::Sync"), I: [Sync](../marker/trait.sync "trait std::marker::Sync"), <I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<I, G> Unpin for IntersperseWith<I, G>where G: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"), I: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"), <I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [Unpin](../marker/trait.unpin "trait std::marker::Unpin"),
### impl<I, G> UnwindSafe for IntersperseWith<I, G>where G: [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"), I: [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"), <I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"),
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Struct std::iter::Inspect Struct std::iter::Inspect
=========================
```
pub struct Inspect<I, F> { /* private fields */ }
```
An iterator that calls a function with a reference to each element before yielding it.
This `struct` is created by the [`inspect`](trait.iterator#method.inspect) method on [`Iterator`](trait.iterator). See its documentation for more.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/iter/adapters/inspect.rs.html#15)### impl<I, F> Clone for Inspect<I, F>where I: [Clone](../clone/trait.clone "trait std::clone::Clone"), F: [Clone](../clone/trait.clone "trait std::clone::Clone"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/inspect.rs.html#15)#### fn clone(&self) -> Inspect<I, F>
Notable traits for [Inspect](struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)#### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/core/iter/adapters/inspect.rs.html#27)1.9.0 · ### impl<I, F> Debug for Inspect<I, F>where I: [Debug](../fmt/trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/inspect.rs.html#28)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/iter/adapters/inspect.rs.html#105)### impl<I, F> DoubleEndedIterator for Inspect<I, F>where I: [DoubleEndedIterator](trait.doubleendediterator "trait std::iter::DoubleEndedIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
[source](https://doc.rust-lang.org/src/core/iter/adapters/inspect.rs.html#110)#### fn next\_back(&mut self) -> Option<<I as Iterator>::Item>
Removes and returns an element from the end of the iterator. [Read more](trait.doubleendediterator#tymethod.next_back)
[source](https://doc.rust-lang.org/src/core/iter/adapters/inspect.rs.html#116-120)#### fn try\_rfold<Acc, Fold, R>(&mut self, init: Acc, fold: Fold) -> Rwhere Fold: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[Inspect](struct.inspect "struct std::iter::Inspect")<I, F> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Acc>, [Inspect](struct.inspect "struct std::iter::Inspect")<I, F>: [Sized](../marker/trait.sized "trait std::marker::Sized"),
This is the reverse version of [`Iterator::try_fold()`](trait.iterator#method.try_fold "Iterator::try_fold()"): it takes elements starting from the back of the iterator. [Read more](trait.doubleendediterator#method.try_rfold)
[source](https://doc.rust-lang.org/src/core/iter/adapters/inspect.rs.html#126-128)#### fn rfold<Acc, Fold>(self, init: Acc, fold: Fold) -> Accwhere Fold: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[Inspect](struct.inspect "struct std::iter::Inspect")<I, F> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Acc,
An iterator method that reduces the iterator’s elements to a single, final value, starting from the back. [Read more](trait.doubleendediterator#method.rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#134)#### fn advance\_back\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator from the back by `n` elements. [Read more](trait.doubleendediterator#method.advance_back_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#184)1.37.0 · #### fn nth\_back(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element from the end of the iterator. [Read more](trait.doubleendediterator#method.nth_back)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#347-350)1.27.0 · #### fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator from the back that satisfies a predicate. [Read more](trait.doubleendediterator#method.rfind)
[source](https://doc.rust-lang.org/src/core/iter/adapters/inspect.rs.html#135)### impl<I, F> ExactSizeIterator for Inspect<I, F>where I: [ExactSizeIterator](trait.exactsizeiterator "trait std::iter::ExactSizeIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
[source](https://doc.rust-lang.org/src/core/iter/adapters/inspect.rs.html#139)#### fn len(&self) -> usize
Returns the exact remaining length of the iterator. [Read more](trait.exactsizeiterator#method.len)
[source](https://doc.rust-lang.org/src/core/iter/adapters/inspect.rs.html#143)#### fn is\_empty(&self) -> bool
🔬This is a nightly-only experimental API. (`exact_size_is_empty` [#35428](https://github.com/rust-lang/rust/issues/35428))
Returns `true` if the iterator is empty. [Read more](trait.exactsizeiterator#method.is_empty)
[source](https://doc.rust-lang.org/src/core/iter/adapters/inspect.rs.html#68)### impl<I, F> Iterator for Inspect<I, F>where I: [Iterator](trait.iterator "trait std::iter::Iterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
#### type Item = <I as Iterator>::Item
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/iter/adapters/inspect.rs.html#75)#### fn next(&mut self) -> Option<<I as Iterator>::Item>
Advances the iterator and returns the next value. [Read more](trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/iter/adapters/inspect.rs.html#81)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/iter/adapters/inspect.rs.html#86-90)#### fn try\_fold<Acc, Fold, R>(&mut self, init: Acc, fold: Fold) -> Rwhere Fold: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[Inspect](struct.inspect "struct std::iter::Inspect")<I, F> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Acc>, [Inspect](struct.inspect "struct std::iter::Inspect")<I, F>: [Sized](../marker/trait.sized "trait std::marker::Sized"),
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/adapters/inspect.rs.html#96-98)#### fn fold<Acc, Fold>(self, init: Acc, fold: Fold) -> Accwhere Fold: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[Inspect](struct.inspect "struct std::iter::Inspect")<I, F> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Acc,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#252-254)#### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#282-284)#### fn last(self) -> Option<Self::Item>
Consumes the iterator, returning the last element. [Read more](trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#328)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#376)#### fn nth(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element of the iterator. [Read more](trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)#### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)#### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)#### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)#### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)#### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)#### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)#### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](struct.peekable#method.peek) and [`peek_mut`](struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)#### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](trait.iterator#method.skip)s elements based on a predicate. [Read more](trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)#### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)#### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)#### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)#### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)#### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)#### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)#### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)#### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)#### fn collect<B>(self) -> Bwhere B: [FromIterator](trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](trait.extend "trait std::iter::Extend")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)#### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)#### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)#### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)#### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)#### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)#### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)#### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](trait.sum "trait std::iter::Sum")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](trait.product "trait std::iter::Product")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another. [Read more](trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are equal to those of another. [Read more](trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are unequal to those of another. [Read more](trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](trait.iterator#method.is_sorted_by_key)
[source](https://doc.rust-lang.org/src/core/iter/adapters/inspect.rs.html#149)1.26.0 · ### impl<I, F> FusedIterator for Inspect<I, F>where I: [FusedIterator](trait.fusediterator "trait std::iter::FusedIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Auto Trait Implementations
--------------------------
### impl<I, F> RefUnwindSafe for Inspect<I, F>where F: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"), I: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<I, F> Send for Inspect<I, F>where F: [Send](../marker/trait.send "trait std::marker::Send"), I: [Send](../marker/trait.send "trait std::marker::Send"),
### impl<I, F> Sync for Inspect<I, F>where F: [Sync](../marker/trait.sync "trait std::marker::Sync"), I: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<I, F> Unpin for Inspect<I, F>where F: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"), I: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"),
### impl<I, F> UnwindSafe for Inspect<I, F>where F: [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"), I: [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"),
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Struct std::iter::Intersperse Struct std::iter::Intersperse
=============================
```
pub struct Intersperse<I>where I: Iterator, <I as Iterator>::Item: Clone,{ /* private fields */ }
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
An iterator adapter that places a separator between all elements.
This `struct` is created by [`Iterator::intersperse`](trait.iterator#method.intersperse "Iterator::intersperse"). See its documentation for more information.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/iter/adapters/intersperse.rs.html#8)### impl<I> Clone for Intersperse<I>where I: [Clone](../clone/trait.clone "trait std::clone::Clone") + [Iterator](trait.iterator "trait std::iter::Iterator"), <I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [Clone](../clone/trait.clone "trait std::clone::Clone"), <I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [Clone](../clone/trait.clone "trait std::clone::Clone"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/intersperse.rs.html#8)#### fn clone(&self) -> Intersperse<I>
Notable traits for [Intersperse](struct.intersperse "struct std::iter::Intersperse")<I>
```
impl<I> Iterator for Intersperse<I>where
I: Iterator,
<I as Iterator>::Item: Clone,
type Item = <I as Iterator>::Item;
```
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)1.0.0 · #### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/core/iter/adapters/intersperse.rs.html#8)### impl<I> Debug for Intersperse<I>where I: [Debug](../fmt/trait.debug "trait std::fmt::Debug") + [Iterator](trait.iterator "trait std::iter::Iterator"), <I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [Clone](../clone/trait.clone "trait std::clone::Clone"), <I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [Debug](../fmt/trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/intersperse.rs.html#8)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/iter/adapters/intersperse.rs.html#28)### impl<I> Iterator for Intersperse<I>where I: [Iterator](trait.iterator "trait std::iter::Iterator"), <I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Item = <I as Iterator>::Item
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/iter/adapters/intersperse.rs.html#36)#### fn next(&mut self) -> Option<<I as Iterator>::Item>
Advances the iterator and returns the next value. [Read more](trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/iter/adapters/intersperse.rs.html#46-49)#### fn fold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, <[Intersperse](struct.intersperse "struct std::iter::Intersperse")<I> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B, [Intersperse](struct.intersperse "struct std::iter::Intersperse")<I>: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/adapters/intersperse.rs.html#55)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#252-254)1.0.0 · #### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#282-284)1.0.0 · #### fn last(self) -> Option<Self::Item>
Consumes the iterator, returning the last element. [Read more](trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#328)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#376)1.0.0 · #### fn nth(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element of the iterator. [Read more](trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)1.0.0 · #### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)1.0.0 · #### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)1.0.0 · #### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)1.0.0 · #### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)1.0.0 · #### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)1.0.0 · #### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)1.0.0 · #### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](struct.peekable#method.peek) and [`peek_mut`](struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)1.0.0 · #### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](trait.iterator#method.skip)s elements based on a predicate. [Read more](trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)1.0.0 · #### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)1.0.0 · #### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)1.0.0 · #### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)1.0.0 · #### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)1.0.0 · #### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)1.0.0 · #### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)1.0.0 · #### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)1.0.0 · #### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)1.0.0 · #### fn collect<B>(self) -> Bwhere B: [FromIterator](trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](trait.extend "trait std::iter::Extend")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)1.0.0 · #### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2230-2234)1.27.0 · #### fn try\_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)1.0.0 · #### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)1.0.0 · #### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)1.0.0 · #### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)1.0.0 · #### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)1.0.0 · #### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)1.0.0 · #### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](trait.sum "trait std::iter::Sum")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](trait.product "trait std::iter::Product")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another. [Read more](trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are equal to those of another. [Read more](trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are unequal to those of another. [Read more](trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](trait.iterator#method.is_sorted_by_key)
Auto Trait Implementations
--------------------------
### impl<I> RefUnwindSafe for Intersperse<I>where I: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"), <I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<I> Send for Intersperse<I>where I: [Send](../marker/trait.send "trait std::marker::Send"), <I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [Send](../marker/trait.send "trait std::marker::Send"),
### impl<I> Sync for Intersperse<I>where I: [Sync](../marker/trait.sync "trait std::marker::Sync"), <I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<I> Unpin for Intersperse<I>where I: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"), <I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [Unpin](../marker/trait.unpin "trait std::marker::Unpin"),
### impl<I> UnwindSafe for Intersperse<I>where I: [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"), <I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"),
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Function std::iter::once Function std::iter::once
========================
```
pub fn once<T>(value: T) -> Once<T>ⓘNotable traits for Once<T>impl<T> Iterator for Once<T> type Item = T;
```
Creates an iterator that yields an element exactly once.
This is commonly used to adapt a single value into a [`chain()`](trait.iterator#method.chain) of other kinds of iteration. Maybe you have an iterator that covers almost everything, but you need an extra special case. Maybe you have a function which works on iterators, but you only need to process one value.
Examples
--------
Basic usage:
```
use std::iter;
// one is the loneliest number
let mut one = iter::once(1);
assert_eq!(Some(1), one.next());
// just one, that's all we get
assert_eq!(None, one.next());
```
Chaining together with another iterator. Let’s say that we want to iterate over each file of the `.foo` directory, but also a configuration file, `.foorc`:
```
use std::iter;
use std::fs;
use std::path::PathBuf;
let dirs = fs::read_dir(".foo").unwrap();
// we need to convert from an iterator of DirEntry-s to an iterator of
// PathBufs, so we use map
let dirs = dirs.map(|file| file.unwrap().path());
// now, our iterator just for our config file
let config = iter::once(PathBuf::from(".foorc"));
// chain the two iterators together into one big iterator
let files = dirs.chain(config);
// this will give us all of the files in .foo as well as .foorc
for f in files {
println!("{f:?}");
}
```
rust Struct std::iter::Map Struct std::iter::Map
=====================
```
pub struct Map<I, F> { /* private fields */ }
```
An iterator that maps the values of `iter` with `f`.
This `struct` is created by the [`map`](trait.iterator#method.map) method on [`Iterator`](trait.iterator). See its documentation for more.
Notes about side effects
------------------------
The [`map`](trait.iterator#method.map) iterator implements [`DoubleEndedIterator`](trait.doubleendediterator), meaning that you can also [`map`](trait.iterator#method.map) backwards:
```
let v: Vec<i32> = [1, 2, 3].into_iter().map(|x| x + 1).rev().collect();
assert_eq!(v, [4, 3, 2]);
```
But if your closure has state, iterating backwards may act in a way you do not expect. Let’s go through an example. First, in the forward direction:
```
let mut c = 0;
for pair in ['a', 'b', 'c'].into_iter()
.map(|letter| { c += 1; (letter, c) }) {
println!("{pair:?}");
}
```
This will print `('a', 1), ('b', 2), ('c', 3)`.
Now consider this twist where we add a call to `rev`. This version will print `('c', 1), ('b', 2), ('a', 3)`. Note that the letters are reversed, but the values of the counter still go in order. This is because `map()` is still being called lazily on each item, but we are popping items off the back of the vector now, instead of shifting them from the front.
```
let mut c = 0;
for pair in ['a', 'b', 'c'].into_iter()
.map(|letter| { c += 1; (letter, c) })
.rev() {
println!("{pair:?}");
}
```
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/iter/adapters/map.rs.html#60)### impl<I, F> Clone for Map<I, F>where I: [Clone](../clone/trait.clone "trait std::clone::Clone"), F: [Clone](../clone/trait.clone "trait std::clone::Clone"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/map.rs.html#60)#### fn clone(&self) -> Map<I, F>
Notable traits for [Map](struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)#### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/core/iter/adapters/map.rs.html#74)1.9.0 · ### impl<I, F> Debug for Map<I, F>where I: [Debug](../fmt/trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/map.rs.html#75)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/iter/adapters/map.rs.html#139)### impl<B, I, F> DoubleEndedIterator for Map<I, F>where I: [DoubleEndedIterator](trait.doubleendediterator "trait std::iter::DoubleEndedIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
[source](https://doc.rust-lang.org/src/core/iter/adapters/map.rs.html#144)#### fn next\_back(&mut self) -> Option<B>
Removes and returns an element from the end of the iterator. [Read more](trait.doubleendediterator#tymethod.next_back)
[source](https://doc.rust-lang.org/src/core/iter/adapters/map.rs.html#148-152)#### fn try\_rfold<Acc, G, R>(&mut self, init: Acc, g: G) -> Rwhere G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[Map](struct.map "struct std::iter::Map")<I, F> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Acc>, [Map](struct.map "struct std::iter::Map")<I, F>: [Sized](../marker/trait.sized "trait std::marker::Sized"),
This is the reverse version of [`Iterator::try_fold()`](trait.iterator#method.try_fold "Iterator::try_fold()"): it takes elements starting from the back of the iterator. [Read more](trait.doubleendediterator#method.try_rfold)
[source](https://doc.rust-lang.org/src/core/iter/adapters/map.rs.html#157-159)#### fn rfold<Acc, G>(self, init: Acc, g: G) -> Accwhere G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[Map](struct.map "struct std::iter::Map")<I, F> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Acc,
An iterator method that reduces the iterator’s elements to a single, final value, starting from the back. [Read more](trait.doubleendediterator#method.rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#134)#### fn advance\_back\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator from the back by `n` elements. [Read more](trait.doubleendediterator#method.advance_back_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#184)1.37.0 · #### fn nth\_back(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element from the end of the iterator. [Read more](trait.doubleendediterator#method.nth_back)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#347-350)1.27.0 · #### fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator from the back that satisfies a predicate. [Read more](trait.doubleendediterator#method.rfind)
[source](https://doc.rust-lang.org/src/core/iter/adapters/map.rs.html#166)### impl<B, I, F> ExactSizeIterator for Map<I, F>where I: [ExactSizeIterator](trait.exactsizeiterator "trait std::iter::ExactSizeIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
[source](https://doc.rust-lang.org/src/core/iter/adapters/map.rs.html#170)#### fn len(&self) -> usize
Returns the exact remaining length of the iterator. [Read more](trait.exactsizeiterator#method.len)
[source](https://doc.rust-lang.org/src/core/iter/adapters/map.rs.html#174)#### fn is\_empty(&self) -> bool
🔬This is a nightly-only experimental API. (`exact_size_is_empty` [#35428](https://github.com/rust-lang/rust/issues/35428))
Returns `true` if the iterator is empty. [Read more](trait.exactsizeiterator#method.is_empty)
[source](https://doc.rust-lang.org/src/core/iter/adapters/map.rs.html#95)### impl<B, I, F> Iterator for Map<I, F>where I: [Iterator](trait.iterator "trait std::iter::Iterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
#### type Item = B
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/iter/adapters/map.rs.html#102)#### fn next(&mut self) -> Option<B>
Advances the iterator and returns the next value. [Read more](trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/iter/adapters/map.rs.html#107)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/iter/adapters/map.rs.html#111-115)#### fn try\_fold<Acc, G, R>(&mut self, init: Acc, g: G) -> Rwhere G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[Map](struct.map "struct std::iter::Map")<I, F> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Acc>, [Map](struct.map "struct std::iter::Map")<I, F>: [Sized](../marker/trait.sized "trait std::marker::Sized"),
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/adapters/map.rs.html#120-122)#### fn fold<Acc, G>(self, init: Acc, g: G) -> Accwhere G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[Map](struct.map "struct std::iter::Map")<I, F> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Acc,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#252-254)#### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#282-284)#### fn last(self) -> Option<Self::Item>
Consumes the iterator, returning the last element. [Read more](trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#328)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#376)#### fn nth(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element of the iterator. [Read more](trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)#### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)#### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)#### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)#### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)#### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)#### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)#### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](struct.peekable#method.peek) and [`peek_mut`](struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)#### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](trait.iterator#method.skip)s elements based on a predicate. [Read more](trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)#### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)#### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)#### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)#### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)#### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)#### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)#### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)#### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)#### fn collect<B>(self) -> Bwhere B: [FromIterator](trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](trait.extend "trait std::iter::Extend")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)#### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)#### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)#### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)#### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)#### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)#### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)#### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](trait.sum "trait std::iter::Sum")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](trait.product "trait std::iter::Product")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another. [Read more](trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are equal to those of another. [Read more](trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are unequal to those of another. [Read more](trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](trait.iterator#method.is_sorted_by_key)
[source](https://doc.rust-lang.org/src/core/iter/adapters/map.rs.html#180)1.26.0 · ### impl<B, I, F> FusedIterator for Map<I, F>where I: [FusedIterator](trait.fusediterator "trait std::iter::FusedIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
[source](https://doc.rust-lang.org/src/core/iter/adapters/map.rs.html#183)### impl<B, I, F> TrustedLen for Map<I, F>where I: [TrustedLen](trait.trustedlen "trait std::iter::TrustedLen"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Auto Trait Implementations
--------------------------
### impl<I, F> RefUnwindSafe for Map<I, F>where F: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"), I: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<I, F> Send for Map<I, F>where F: [Send](../marker/trait.send "trait std::marker::Send"), I: [Send](../marker/trait.send "trait std::marker::Send"),
### impl<I, F> Sync for Map<I, F>where F: [Sync](../marker/trait.sync "trait std::marker::Sync"), I: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<I, F> Unpin for Map<I, F>where F: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"), I: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"),
### impl<I, F> UnwindSafe for Map<I, F>where F: [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"), I: [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"),
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Trait std::iter::Sum Trait std::iter::Sum
====================
```
pub trait Sum<A = Self> {
fn sum<I>(iter: I) -> Self where I: Iterator<Item = A>;
}
```
Trait to represent types that can be created by summing up an iterator.
This trait is used to implement [`Iterator::sum()`](trait.iterator#method.sum "Iterator::sum()"). Types which implement this trait can be generated by using the [`sum()`](trait.iterator#method.sum) method on an iterator. Like [`FromIterator`](trait.fromiterator), this trait should rarely be called directly.
Required Methods
----------------
[source](https://doc.rust-lang.org/src/core/iter/traits/accum.rs.html#17)#### fn sum<I>(iter: I) -> Selfwhere I: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = A>,
Method which takes an iterator and generates `Self` from the elements by “summing up” the items.
Implementors
------------
[source](https://doc.rust-lang.org/src/core/iter/traits/accum.rs.html#142)### impl Sum<f32> for f32
[source](https://doc.rust-lang.org/src/core/iter/traits/accum.rs.html#142)### impl Sum<f64> for f64
[source](https://doc.rust-lang.org/src/core/iter/traits/accum.rs.html#141)### impl Sum<i8> for i8
[source](https://doc.rust-lang.org/src/core/iter/traits/accum.rs.html#141)### impl Sum<i16> for i16
[source](https://doc.rust-lang.org/src/core/iter/traits/accum.rs.html#141)### impl Sum<i32> for i32
[source](https://doc.rust-lang.org/src/core/iter/traits/accum.rs.html#141)### impl Sum<i64> for i64
[source](https://doc.rust-lang.org/src/core/iter/traits/accum.rs.html#141)### impl Sum<i128> for i128
[source](https://doc.rust-lang.org/src/core/iter/traits/accum.rs.html#141)### impl Sum<isize> for isize
[source](https://doc.rust-lang.org/src/core/iter/traits/accum.rs.html#141)### impl Sum<u8> for u8
[source](https://doc.rust-lang.org/src/core/iter/traits/accum.rs.html#141)### impl Sum<u16> for u16
[source](https://doc.rust-lang.org/src/core/iter/traits/accum.rs.html#141)### impl Sum<u32> for u32
[source](https://doc.rust-lang.org/src/core/iter/traits/accum.rs.html#141)### impl Sum<u64> for u64
[source](https://doc.rust-lang.org/src/core/iter/traits/accum.rs.html#141)### impl Sum<u128> for u128
[source](https://doc.rust-lang.org/src/core/iter/traits/accum.rs.html#141)### impl Sum<usize> for usize
[source](https://doc.rust-lang.org/src/core/iter/traits/accum.rs.html#141)1.14.0 · ### impl Sum<Wrapping<i8>> for Wrapping<i8>
[source](https://doc.rust-lang.org/src/core/iter/traits/accum.rs.html#141)1.14.0 · ### impl Sum<Wrapping<i16>> for Wrapping<i16>
[source](https://doc.rust-lang.org/src/core/iter/traits/accum.rs.html#141)1.14.0 · ### impl Sum<Wrapping<i32>> for Wrapping<i32>
[source](https://doc.rust-lang.org/src/core/iter/traits/accum.rs.html#141)1.14.0 · ### impl Sum<Wrapping<i64>> for Wrapping<i64>
[source](https://doc.rust-lang.org/src/core/iter/traits/accum.rs.html#141)1.14.0 · ### impl Sum<Wrapping<i128>> for Wrapping<i128>
[source](https://doc.rust-lang.org/src/core/iter/traits/accum.rs.html#141)1.14.0 · ### impl Sum<Wrapping<isize>> for Wrapping<isize>
[source](https://doc.rust-lang.org/src/core/iter/traits/accum.rs.html#141)1.14.0 · ### impl Sum<Wrapping<u8>> for Wrapping<u8>
[source](https://doc.rust-lang.org/src/core/iter/traits/accum.rs.html#141)1.14.0 · ### impl Sum<Wrapping<u16>> for Wrapping<u16>
[source](https://doc.rust-lang.org/src/core/iter/traits/accum.rs.html#141)1.14.0 · ### impl Sum<Wrapping<u32>> for Wrapping<u32>
[source](https://doc.rust-lang.org/src/core/iter/traits/accum.rs.html#141)1.14.0 · ### impl Sum<Wrapping<u64>> for Wrapping<u64>
[source](https://doc.rust-lang.org/src/core/iter/traits/accum.rs.html#141)1.14.0 · ### impl Sum<Wrapping<u128>> for Wrapping<u128>
[source](https://doc.rust-lang.org/src/core/iter/traits/accum.rs.html#141)1.14.0 · ### impl Sum<Wrapping<usize>> for Wrapping<usize>
[source](https://doc.rust-lang.org/src/core/time.rs.html#1009)1.16.0 · ### impl Sum<Duration> for Duration
[source](https://doc.rust-lang.org/src/core/iter/traits/accum.rs.html#142)### impl<'a> Sum<&'a f32> for f32
[source](https://doc.rust-lang.org/src/core/iter/traits/accum.rs.html#142)### impl<'a> Sum<&'a f64> for f64
[source](https://doc.rust-lang.org/src/core/iter/traits/accum.rs.html#141)### impl<'a> Sum<&'a i8> for i8
[source](https://doc.rust-lang.org/src/core/iter/traits/accum.rs.html#141)### impl<'a> Sum<&'a i16> for i16
[source](https://doc.rust-lang.org/src/core/iter/traits/accum.rs.html#141)### impl<'a> Sum<&'a i32> for i32
[source](https://doc.rust-lang.org/src/core/iter/traits/accum.rs.html#141)### impl<'a> Sum<&'a i64> for i64
[source](https://doc.rust-lang.org/src/core/iter/traits/accum.rs.html#141)### impl<'a> Sum<&'a i128> for i128
[source](https://doc.rust-lang.org/src/core/iter/traits/accum.rs.html#141)### impl<'a> Sum<&'a isize> for isize
[source](https://doc.rust-lang.org/src/core/iter/traits/accum.rs.html#141)### impl<'a> Sum<&'a u8> for u8
[source](https://doc.rust-lang.org/src/core/iter/traits/accum.rs.html#141)### impl<'a> Sum<&'a u16> for u16
[source](https://doc.rust-lang.org/src/core/iter/traits/accum.rs.html#141)### impl<'a> Sum<&'a u32> for u32
[source](https://doc.rust-lang.org/src/core/iter/traits/accum.rs.html#141)### impl<'a> Sum<&'a u64> for u64
[source](https://doc.rust-lang.org/src/core/iter/traits/accum.rs.html#141)### impl<'a> Sum<&'a u128> for u128
[source](https://doc.rust-lang.org/src/core/iter/traits/accum.rs.html#141)### impl<'a> Sum<&'a usize> for usize
[source](https://doc.rust-lang.org/src/core/iter/traits/accum.rs.html#141)1.14.0 · ### impl<'a> Sum<&'a Wrapping<i8>> for Wrapping<i8>
[source](https://doc.rust-lang.org/src/core/iter/traits/accum.rs.html#141)1.14.0 · ### impl<'a> Sum<&'a Wrapping<i16>> for Wrapping<i16>
[source](https://doc.rust-lang.org/src/core/iter/traits/accum.rs.html#141)1.14.0 · ### impl<'a> Sum<&'a Wrapping<i32>> for Wrapping<i32>
[source](https://doc.rust-lang.org/src/core/iter/traits/accum.rs.html#141)1.14.0 · ### impl<'a> Sum<&'a Wrapping<i64>> for Wrapping<i64>
[source](https://doc.rust-lang.org/src/core/iter/traits/accum.rs.html#141)1.14.0 · ### impl<'a> Sum<&'a Wrapping<i128>> for Wrapping<i128>
[source](https://doc.rust-lang.org/src/core/iter/traits/accum.rs.html#141)1.14.0 · ### impl<'a> Sum<&'a Wrapping<isize>> for Wrapping<isize>
[source](https://doc.rust-lang.org/src/core/iter/traits/accum.rs.html#141)1.14.0 · ### impl<'a> Sum<&'a Wrapping<u8>> for Wrapping<u8>
[source](https://doc.rust-lang.org/src/core/iter/traits/accum.rs.html#141)1.14.0 · ### impl<'a> Sum<&'a Wrapping<u16>> for Wrapping<u16>
[source](https://doc.rust-lang.org/src/core/iter/traits/accum.rs.html#141)1.14.0 · ### impl<'a> Sum<&'a Wrapping<u32>> for Wrapping<u32>
[source](https://doc.rust-lang.org/src/core/iter/traits/accum.rs.html#141)1.14.0 · ### impl<'a> Sum<&'a Wrapping<u64>> for Wrapping<u64>
[source](https://doc.rust-lang.org/src/core/iter/traits/accum.rs.html#141)1.14.0 · ### impl<'a> Sum<&'a Wrapping<u128>> for Wrapping<u128>
[source](https://doc.rust-lang.org/src/core/iter/traits/accum.rs.html#141)1.14.0 · ### impl<'a> Sum<&'a Wrapping<usize>> for Wrapping<usize>
[source](https://doc.rust-lang.org/src/core/time.rs.html#1016)1.16.0 · ### impl<'a> Sum<&'a Duration> for Duration
[source](https://doc.rust-lang.org/src/core/up/up/portable-simd/crates/core_simd/src/iter.rs.html#47)### impl<'a, const LANES: usize> Sum<&'a Simd<f32, LANES>> for Simd<f32, LANES>where [LaneCount](../simd/struct.lanecount "struct std::simd::LaneCount")<LANES>: [SupportedLaneCount](../simd/trait.supportedlanecount "trait std::simd::SupportedLaneCount"),
[source](https://doc.rust-lang.org/src/core/up/up/portable-simd/crates/core_simd/src/iter.rs.html#48)### impl<'a, const LANES: usize> Sum<&'a Simd<f64, LANES>> for Simd<f64, LANES>where [LaneCount](../simd/struct.lanecount "struct std::simd::LaneCount")<LANES>: [SupportedLaneCount](../simd/trait.supportedlanecount "trait std::simd::SupportedLaneCount"),
[source](https://doc.rust-lang.org/src/core/up/up/portable-simd/crates/core_simd/src/iter.rs.html#54)### impl<'a, const LANES: usize> Sum<&'a Simd<i8, LANES>> for Simd<i8, LANES>where [LaneCount](../simd/struct.lanecount "struct std::simd::LaneCount")<LANES>: [SupportedLaneCount](../simd/trait.supportedlanecount "trait std::simd::SupportedLaneCount"),
[source](https://doc.rust-lang.org/src/core/up/up/portable-simd/crates/core_simd/src/iter.rs.html#55)### impl<'a, const LANES: usize> Sum<&'a Simd<i16, LANES>> for Simd<i16, LANES>where [LaneCount](../simd/struct.lanecount "struct std::simd::LaneCount")<LANES>: [SupportedLaneCount](../simd/trait.supportedlanecount "trait std::simd::SupportedLaneCount"),
[source](https://doc.rust-lang.org/src/core/up/up/portable-simd/crates/core_simd/src/iter.rs.html#56)### impl<'a, const LANES: usize> Sum<&'a Simd<i32, LANES>> for Simd<i32, LANES>where [LaneCount](../simd/struct.lanecount "struct std::simd::LaneCount")<LANES>: [SupportedLaneCount](../simd/trait.supportedlanecount "trait std::simd::SupportedLaneCount"),
[source](https://doc.rust-lang.org/src/core/up/up/portable-simd/crates/core_simd/src/iter.rs.html#57)### impl<'a, const LANES: usize> Sum<&'a Simd<i64, LANES>> for Simd<i64, LANES>where [LaneCount](../simd/struct.lanecount "struct std::simd::LaneCount")<LANES>: [SupportedLaneCount](../simd/trait.supportedlanecount "trait std::simd::SupportedLaneCount"),
[source](https://doc.rust-lang.org/src/core/up/up/portable-simd/crates/core_simd/src/iter.rs.html#58)### impl<'a, const LANES: usize> Sum<&'a Simd<isize, LANES>> for Simd<isize, LANES>where [LaneCount](../simd/struct.lanecount "struct std::simd::LaneCount")<LANES>: [SupportedLaneCount](../simd/trait.supportedlanecount "trait std::simd::SupportedLaneCount"),
[source](https://doc.rust-lang.org/src/core/up/up/portable-simd/crates/core_simd/src/iter.rs.html#49)### impl<'a, const LANES: usize> Sum<&'a Simd<u8, LANES>> for Simd<u8, LANES>where [LaneCount](../simd/struct.lanecount "struct std::simd::LaneCount")<LANES>: [SupportedLaneCount](../simd/trait.supportedlanecount "trait std::simd::SupportedLaneCount"),
[source](https://doc.rust-lang.org/src/core/up/up/portable-simd/crates/core_simd/src/iter.rs.html#50)### impl<'a, const LANES: usize> Sum<&'a Simd<u16, LANES>> for Simd<u16, LANES>where [LaneCount](../simd/struct.lanecount "struct std::simd::LaneCount")<LANES>: [SupportedLaneCount](../simd/trait.supportedlanecount "trait std::simd::SupportedLaneCount"),
[source](https://doc.rust-lang.org/src/core/up/up/portable-simd/crates/core_simd/src/iter.rs.html#51)### impl<'a, const LANES: usize> Sum<&'a Simd<u32, LANES>> for Simd<u32, LANES>where [LaneCount](../simd/struct.lanecount "struct std::simd::LaneCount")<LANES>: [SupportedLaneCount](../simd/trait.supportedlanecount "trait std::simd::SupportedLaneCount"),
[source](https://doc.rust-lang.org/src/core/up/up/portable-simd/crates/core_simd/src/iter.rs.html#52)### impl<'a, const LANES: usize> Sum<&'a Simd<u64, LANES>> for Simd<u64, LANES>where [LaneCount](../simd/struct.lanecount "struct std::simd::LaneCount")<LANES>: [SupportedLaneCount](../simd/trait.supportedlanecount "trait std::simd::SupportedLaneCount"),
[source](https://doc.rust-lang.org/src/core/up/up/portable-simd/crates/core_simd/src/iter.rs.html#53)### impl<'a, const LANES: usize> Sum<&'a Simd<usize, LANES>> for Simd<usize, LANES>where [LaneCount](../simd/struct.lanecount "struct std::simd::LaneCount")<LANES>: [SupportedLaneCount](../simd/trait.supportedlanecount "trait std::simd::SupportedLaneCount"),
[source](https://doc.rust-lang.org/src/core/iter/traits/accum.rs.html#191)1.37.0 · ### impl<T, U> Sum<Option<U>> for Option<T>where T: [Sum](trait.sum "trait std::iter::Sum")<U>,
[source](https://doc.rust-lang.org/src/core/iter/traits/accum.rs.html#145)1.16.0 · ### impl<T, U, E> Sum<Result<U, E>> for Result<T, E>where T: [Sum](trait.sum "trait std::iter::Sum")<U>,
[source](https://doc.rust-lang.org/src/core/up/up/portable-simd/crates/core_simd/src/iter.rs.html#47)### impl<const LANES: usize> Sum<Simd<f32, LANES>> for Simd<f32, LANES>where [LaneCount](../simd/struct.lanecount "struct std::simd::LaneCount")<LANES>: [SupportedLaneCount](../simd/trait.supportedlanecount "trait std::simd::SupportedLaneCount"),
[source](https://doc.rust-lang.org/src/core/up/up/portable-simd/crates/core_simd/src/iter.rs.html#48)### impl<const LANES: usize> Sum<Simd<f64, LANES>> for Simd<f64, LANES>where [LaneCount](../simd/struct.lanecount "struct std::simd::LaneCount")<LANES>: [SupportedLaneCount](../simd/trait.supportedlanecount "trait std::simd::SupportedLaneCount"),
[source](https://doc.rust-lang.org/src/core/up/up/portable-simd/crates/core_simd/src/iter.rs.html#54)### impl<const LANES: usize> Sum<Simd<i8, LANES>> for Simd<i8, LANES>where [LaneCount](../simd/struct.lanecount "struct std::simd::LaneCount")<LANES>: [SupportedLaneCount](../simd/trait.supportedlanecount "trait std::simd::SupportedLaneCount"),
[source](https://doc.rust-lang.org/src/core/up/up/portable-simd/crates/core_simd/src/iter.rs.html#55)### impl<const LANES: usize> Sum<Simd<i16, LANES>> for Simd<i16, LANES>where [LaneCount](../simd/struct.lanecount "struct std::simd::LaneCount")<LANES>: [SupportedLaneCount](../simd/trait.supportedlanecount "trait std::simd::SupportedLaneCount"),
[source](https://doc.rust-lang.org/src/core/up/up/portable-simd/crates/core_simd/src/iter.rs.html#56)### impl<const LANES: usize> Sum<Simd<i32, LANES>> for Simd<i32, LANES>where [LaneCount](../simd/struct.lanecount "struct std::simd::LaneCount")<LANES>: [SupportedLaneCount](../simd/trait.supportedlanecount "trait std::simd::SupportedLaneCount"),
[source](https://doc.rust-lang.org/src/core/up/up/portable-simd/crates/core_simd/src/iter.rs.html#57)### impl<const LANES: usize> Sum<Simd<i64, LANES>> for Simd<i64, LANES>where [LaneCount](../simd/struct.lanecount "struct std::simd::LaneCount")<LANES>: [SupportedLaneCount](../simd/trait.supportedlanecount "trait std::simd::SupportedLaneCount"),
[source](https://doc.rust-lang.org/src/core/up/up/portable-simd/crates/core_simd/src/iter.rs.html#58)### impl<const LANES: usize> Sum<Simd<isize, LANES>> for Simd<isize, LANES>where [LaneCount](../simd/struct.lanecount "struct std::simd::LaneCount")<LANES>: [SupportedLaneCount](../simd/trait.supportedlanecount "trait std::simd::SupportedLaneCount"),
[source](https://doc.rust-lang.org/src/core/up/up/portable-simd/crates/core_simd/src/iter.rs.html#49)### impl<const LANES: usize> Sum<Simd<u8, LANES>> for Simd<u8, LANES>where [LaneCount](../simd/struct.lanecount "struct std::simd::LaneCount")<LANES>: [SupportedLaneCount](../simd/trait.supportedlanecount "trait std::simd::SupportedLaneCount"),
[source](https://doc.rust-lang.org/src/core/up/up/portable-simd/crates/core_simd/src/iter.rs.html#50)### impl<const LANES: usize> Sum<Simd<u16, LANES>> for Simd<u16, LANES>where [LaneCount](../simd/struct.lanecount "struct std::simd::LaneCount")<LANES>: [SupportedLaneCount](../simd/trait.supportedlanecount "trait std::simd::SupportedLaneCount"),
[source](https://doc.rust-lang.org/src/core/up/up/portable-simd/crates/core_simd/src/iter.rs.html#51)### impl<const LANES: usize> Sum<Simd<u32, LANES>> for Simd<u32, LANES>where [LaneCount](../simd/struct.lanecount "struct std::simd::LaneCount")<LANES>: [SupportedLaneCount](../simd/trait.supportedlanecount "trait std::simd::SupportedLaneCount"),
[source](https://doc.rust-lang.org/src/core/up/up/portable-simd/crates/core_simd/src/iter.rs.html#52)### impl<const LANES: usize> Sum<Simd<u64, LANES>> for Simd<u64, LANES>where [LaneCount](../simd/struct.lanecount "struct std::simd::LaneCount")<LANES>: [SupportedLaneCount](../simd/trait.supportedlanecount "trait std::simd::SupportedLaneCount"),
[source](https://doc.rust-lang.org/src/core/up/up/portable-simd/crates/core_simd/src/iter.rs.html#53)### impl<const LANES: usize> Sum<Simd<usize, LANES>> for Simd<usize, LANES>where [LaneCount](../simd/struct.lanecount "struct std::simd::LaneCount")<LANES>: [SupportedLaneCount](../simd/trait.supportedlanecount "trait std::simd::SupportedLaneCount"),
rust Function std::iter::from_generator Function std::iter::from\_generator
===================================
```
pub fn from_generator<G>( generator: G) -> impl Iterator<Item = <G as Generator<()>>::Yield>where G: Generator<(), Return = ()> + Unpin,
```
🔬This is a nightly-only experimental API. (`iter_from_generator` [#43122](https://github.com/rust-lang/rust/issues/43122))
Creates a new iterator where each iteration calls the provided generator.
Similar to [`iter::from_fn`](fn.from_fn).
Examples
--------
```
#![feature(generators)]
#![feature(iter_from_generator)]
let it = std::iter::from_generator(|| {
yield 1;
yield 2;
yield 3;
});
let v: Vec<_> = it.collect();
assert_eq!(v, [1, 2, 3]);
```
rust Struct std::iter::Filter Struct std::iter::Filter
========================
```
pub struct Filter<I, P> { /* private fields */ }
```
An iterator that filters the elements of `iter` with `predicate`.
This `struct` is created by the [`filter`](trait.iterator#method.filter) method on [`Iterator`](trait.iterator). See its documentation for more.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/iter/adapters/filter.rs.html#14)### impl<I, P> Clone for Filter<I, P>where I: [Clone](../clone/trait.clone "trait std::clone::Clone"), P: [Clone](../clone/trait.clone "trait std::clone::Clone"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/filter.rs.html#14)#### fn clone(&self) -> Filter<I, P>
Notable traits for [Filter](struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)#### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/core/iter/adapters/filter.rs.html#27)1.9.0 · ### impl<I, P> Debug for Filter<I, P>where I: [Debug](../fmt/trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/filter.rs.html#28)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/iter/adapters/filter.rs.html#106)### impl<I, P> DoubleEndedIterator for Filter<I, P>where I: [DoubleEndedIterator](trait.doubleendediterator "trait std::iter::DoubleEndedIterator"), P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/iter/adapters/filter.rs.html#111)#### fn next\_back(&mut self) -> Option<<I as Iterator>::Item>
Removes and returns an element from the end of the iterator. [Read more](trait.doubleendediterator#tymethod.next_back)
[source](https://doc.rust-lang.org/src/core/iter/adapters/filter.rs.html#116-120)#### fn try\_rfold<Acc, Fold, R>(&mut self, init: Acc, fold: Fold) -> Rwhere Fold: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[Filter](struct.filter "struct std::iter::Filter")<I, P> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Acc>, [Filter](struct.filter "struct std::iter::Filter")<I, P>: [Sized](../marker/trait.sized "trait std::marker::Sized"),
This is the reverse version of [`Iterator::try_fold()`](trait.iterator#method.try_fold "Iterator::try_fold()"): it takes elements starting from the back of the iterator. [Read more](trait.doubleendediterator#method.try_rfold)
[source](https://doc.rust-lang.org/src/core/iter/adapters/filter.rs.html#126-128)#### fn rfold<Acc, Fold>(self, init: Acc, fold: Fold) -> Accwhere Fold: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[Filter](struct.filter "struct std::iter::Filter")<I, P> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Acc,
An iterator method that reduces the iterator’s elements to a single, final value, starting from the back. [Read more](trait.doubleendediterator#method.rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#134)#### fn advance\_back\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator from the back by `n` elements. [Read more](trait.doubleendediterator#method.advance_back_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#184)1.37.0 · #### fn nth\_back(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element from the end of the iterator. [Read more](trait.doubleendediterator#method.nth_back)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#347-350)1.27.0 · #### fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator from the back that satisfies a predicate. [Read more](trait.doubleendediterator#method.rfind)
[source](https://doc.rust-lang.org/src/core/iter/adapters/filter.rs.html#48)### impl<I, P> Iterator for Filter<I, P>where I: [Iterator](trait.iterator "trait std::iter::Iterator"), P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
#### type Item = <I as Iterator>::Item
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/iter/adapters/filter.rs.html#55)#### fn next(&mut self) -> Option<<I as Iterator>::Item>
Advances the iterator and returns the next value. [Read more](trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/iter/adapters/filter.rs.html#60)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/iter/adapters/filter.rs.html#77)#### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/iter/adapters/filter.rs.html#87-91)#### fn try\_fold<Acc, Fold, R>(&mut self, init: Acc, fold: Fold) -> Rwhere Fold: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[Filter](struct.filter "struct std::iter::Filter")<I, P> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Acc>, [Filter](struct.filter "struct std::iter::Filter")<I, P>: [Sized](../marker/trait.sized "trait std::marker::Sized"),
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/adapters/filter.rs.html#97-99)#### fn fold<Acc, Fold>(self, init: Acc, fold: Fold) -> Accwhere Fold: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[Filter](struct.filter "struct std::iter::Filter")<I, P> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Acc,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#282-284)#### fn last(self) -> Option<Self::Item>
Consumes the iterator, returning the last element. [Read more](trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#328)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#376)#### fn nth(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element of the iterator. [Read more](trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)#### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)#### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)#### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)#### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)#### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)#### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)#### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](struct.peekable#method.peek) and [`peek_mut`](struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)#### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](trait.iterator#method.skip)s elements based on a predicate. [Read more](trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)#### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)#### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)#### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)#### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)#### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)#### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)#### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)#### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)#### fn collect<B>(self) -> Bwhere B: [FromIterator](trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](trait.extend "trait std::iter::Extend")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)#### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)#### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)#### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)#### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)#### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)#### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)#### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](trait.sum "trait std::iter::Sum")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](trait.product "trait std::iter::Product")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another. [Read more](trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are equal to those of another. [Read more](trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are unequal to those of another. [Read more](trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](trait.iterator#method.is_sorted_by_key)
[source](https://doc.rust-lang.org/src/core/iter/adapters/filter.rs.html#135)1.26.0 · ### impl<I, P> FusedIterator for Filter<I, P>where I: [FusedIterator](trait.fusediterator "trait std::iter::FusedIterator"), P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Auto Trait Implementations
--------------------------
### impl<I, P> RefUnwindSafe for Filter<I, P>where I: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"), P: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<I, P> Send for Filter<I, P>where I: [Send](../marker/trait.send "trait std::marker::Send"), P: [Send](../marker/trait.send "trait std::marker::Send"),
### impl<I, P> Sync for Filter<I, P>where I: [Sync](../marker/trait.sync "trait std::marker::Sync"), P: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<I, P> Unpin for Filter<I, P>where I: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"), P: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"),
### impl<I, P> UnwindSafe for Filter<I, P>where I: [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"), P: [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"),
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Struct std::iter::Cycle Struct std::iter::Cycle
=======================
```
pub struct Cycle<I> { /* private fields */ }
```
An iterator that repeats endlessly.
This `struct` is created by the [`cycle`](trait.iterator#method.cycle) method on [`Iterator`](trait.iterator). See its documentation for more.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/iter/adapters/cycle.rs.html#10)### impl<I> Clone for Cycle<I>where I: [Clone](../clone/trait.clone "trait std::clone::Clone"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/cycle.rs.html#10)#### fn clone(&self) -> Cycle<I>
Notable traits for [Cycle](struct.cycle "struct std::iter::Cycle")<I>
```
impl<I> Iterator for Cycle<I>where
I: Clone + Iterator,
type Item = <I as Iterator>::Item;
```
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)#### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/core/iter/adapters/cycle.rs.html#10)### impl<I> Debug for Cycle<I>where I: [Debug](../fmt/trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/cycle.rs.html#10)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/iter/adapters/cycle.rs.html#25)### impl<I> Iterator for Cycle<I>where I: [Clone](../clone/trait.clone "trait std::clone::Clone") + [Iterator](trait.iterator "trait std::iter::Iterator"),
#### type Item = <I as Iterator>::Item
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/iter/adapters/cycle.rs.html#32)#### fn next(&mut self) -> Option<<I as Iterator>::Item>
Advances the iterator and returns the next value. [Read more](trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/iter/adapters/cycle.rs.html#43)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/iter/adapters/cycle.rs.html#53-56)#### fn try\_fold<Acc, F, R>(&mut self, acc: Acc, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[Cycle](struct.cycle "struct std::iter::Cycle")<I> as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Acc>,
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/adapters/cycle.rs.html#84)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#252-254)#### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#282-284)#### fn last(self) -> Option<Self::Item>
Consumes the iterator, returning the last element. [Read more](trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#376)#### fn nth(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element of the iterator. [Read more](trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)#### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)#### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)#### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)#### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)#### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)#### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)#### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](struct.peekable#method.peek) and [`peek_mut`](struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)#### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](trait.iterator#method.skip)s elements based on a predicate. [Read more](trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)#### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)#### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)#### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)#### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)#### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)#### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)#### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)#### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)#### fn collect<B>(self) -> Bwhere B: [FromIterator](trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](trait.extend "trait std::iter::Extend")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)#### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2407-2410)#### fn fold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)#### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)#### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)#### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)#### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)#### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)#### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3312-3314)#### fn cycle(self) -> Cycle<Self>where Self: [Clone](../clone/trait.clone "trait std::clone::Clone"),
Notable traits for [Cycle](struct.cycle "struct std::iter::Cycle")<I>
```
impl<I> Iterator for Cycle<I>where
I: Clone + Iterator,
type Item = <I as Iterator>::Item;
```
Repeats an iterator endlessly. [Read more](trait.iterator#method.cycle)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](trait.sum "trait std::iter::Sum")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](trait.product "trait std::iter::Product")<Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another. [Read more](trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are equal to those of another. [Read more](trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are unequal to those of another. [Read more](trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](trait.iterator#method.is_sorted_by_key)
[source](https://doc.rust-lang.org/src/core/iter/adapters/cycle.rs.html#108)1.26.0 · ### impl<I> FusedIterator for Cycle<I>where I: [Clone](../clone/trait.clone "trait std::clone::Clone") + [Iterator](trait.iterator "trait std::iter::Iterator"),
Auto Trait Implementations
--------------------------
### impl<I> RefUnwindSafe for Cycle<I>where I: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<I> Send for Cycle<I>where I: [Send](../marker/trait.send "trait std::marker::Send"),
### impl<I> Sync for Cycle<I>where I: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<I> Unpin for Cycle<I>where I: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"),
### impl<I> UnwindSafe for Cycle<I>where I: [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"),
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Trait std::iter::DoubleEndedIterator Trait std::iter::DoubleEndedIterator
====================================
```
pub trait DoubleEndedIterator: Iterator {
fn next_back(&mut self) -> Option<Self::Item>;
fn advance_back_by(&mut self, n: usize) -> Result<(), usize> { ... }
fn nth_back(&mut self, n: usize) -> Option<Self::Item> { ... }
fn try_rfold<B, F, R>(&mut self, init: B, f: F) -> R where F: FnMut(B, Self::Item) -> R, R: Try<Output = B>,
{ ... }
fn rfold<B, F>(self, init: B, f: F) -> B where F: FnMut(B, Self::Item) -> B,
{ ... }
fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item> where P: FnMut(&Self::Item) -> bool,
{ ... }
}
```
An iterator able to yield elements from both ends.
Something that implements `DoubleEndedIterator` has one extra capability over something that implements [`Iterator`](trait.iterator "Iterator"): the ability to also take `Item`s from the back, as well as the front.
It is important to note that both back and forth work on the same range, and do not cross: iteration is over when they meet in the middle.
In a similar fashion to the [`Iterator`](trait.iterator "Iterator") protocol, once a `DoubleEndedIterator` returns [`None`](../option/enum.option#variant.None "None") from a [`next_back()`](trait.doubleendediterator#tymethod.next_back), calling it again may or may not ever return [`Some`](../option/enum.option#variant.Some "Some") again. [`next()`](trait.iterator#tymethod.next) and [`next_back()`](trait.doubleendediterator#tymethod.next_back) are interchangeable for this purpose.
Examples
--------
Basic usage:
```
let numbers = vec![1, 2, 3, 4, 5, 6];
let mut iter = numbers.iter();
assert_eq!(Some(&1), iter.next());
assert_eq!(Some(&6), iter.next_back());
assert_eq!(Some(&5), iter.next_back());
assert_eq!(Some(&2), iter.next());
assert_eq!(Some(&3), iter.next());
assert_eq!(Some(&4), iter.next());
assert_eq!(None, iter.next());
assert_eq!(None, iter.next_back());
```
Required Methods
----------------
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#93)#### fn next\_back(&mut self) -> Option<Self::Item>
Removes and returns an element from the end of the iterator.
Returns `None` when there are no more elements.
The [trait-level](trait.doubleendediterator) docs contain more details.
##### Examples
Basic usage:
```
let numbers = vec![1, 2, 3, 4, 5, 6];
let mut iter = numbers.iter();
assert_eq!(Some(&1), iter.next());
assert_eq!(Some(&6), iter.next_back());
assert_eq!(Some(&5), iter.next_back());
assert_eq!(Some(&2), iter.next());
assert_eq!(Some(&3), iter.next());
assert_eq!(Some(&4), iter.next());
assert_eq!(None, iter.next());
assert_eq!(None, iter.next_back());
```
##### Remarks
The elements yielded by `DoubleEndedIterator`’s methods may differ from the ones yielded by [`Iterator`](trait.iterator "Iterator")’s methods:
```
let vec = vec![(1, 'a'), (1, 'b'), (1, 'c'), (2, 'a'), (2, 'b')];
let uniq_by_fst_comp = || {
let mut seen = std::collections::HashSet::new();
vec.iter().copied().filter(move |x| seen.insert(x.0))
};
assert_eq!(uniq_by_fst_comp().last(), Some((2, 'a')));
assert_eq!(uniq_by_fst_comp().next_back(), Some((2, 'b')));
assert_eq!(
uniq_by_fst_comp().fold(vec![], |mut v, x| {v.push(x); v}),
vec![(1, 'a'), (2, 'a')]
);
assert_eq!(
uniq_by_fst_comp().rfold(vec![], |mut v, x| {v.push(x); v}),
vec![(2, 'b'), (1, 'c')]
);
```
Provided Methods
----------------
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#134)#### fn advance\_back\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator from the back by `n` elements.
`advance_back_by` is the reverse version of [`advance_by`](trait.iterator#method.advance_by). This method will eagerly skip `n` elements starting from the back by calling [`next_back`](trait.doubleendediterator#tymethod.next_back) up to `n` times until [`None`](../option/enum.option#variant.None "None") is encountered.
`advance_back_by(n)` will return [`Ok(())`](../result/enum.result#variant.Ok) if the iterator successfully advances by `n` elements, or [`Err(k)`](../result/enum.result#variant.Err) if [`None`](../option/enum.option#variant.None "None") is encountered, where `k` is the number of elements the iterator is advanced by before running out of elements (i.e. the length of the iterator). Note that `k` is always less than `n`.
Calling `advance_back_by(0)` can do meaningful work, for example [`Flatten`](struct.flatten) can advance its outer iterator until it finds an inner iterator that is not empty, which then often allows it to return a more accurate `size_hint()` than in its initial state.
##### Examples
Basic usage:
```
#![feature(iter_advance_by)]
let a = [3, 4, 5, 6];
let mut iter = a.iter();
assert_eq!(iter.advance_back_by(2), Ok(()));
assert_eq!(iter.next_back(), Some(&4));
assert_eq!(iter.advance_back_by(0), Ok(()));
assert_eq!(iter.advance_back_by(100), Err(1)); // only `&3` was skipped
```
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#184)1.37.0 · #### fn nth\_back(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element from the end of the iterator.
This is essentially the reversed version of [`Iterator::nth()`](trait.iterator#method.nth "Iterator::nth()"). Although like most indexing operations, the count starts from zero, so `nth_back(0)` returns the first value from the end, `nth_back(1)` the second, and so on.
Note that all elements between the end and the returned element will be consumed, including the returned element. This also means that calling `nth_back(0)` multiple times on the same iterator will return different elements.
`nth_back()` will return [`None`](../option/enum.option#variant.None "None") if `n` is greater than or equal to the length of the iterator.
##### Examples
Basic usage:
```
let a = [1, 2, 3];
assert_eq!(a.iter().nth_back(2), Some(&1));
```
Calling `nth_back()` multiple times doesn’t rewind the iterator:
```
let a = [1, 2, 3];
let mut iter = a.iter();
assert_eq!(iter.nth_back(1), Some(&2));
assert_eq!(iter.nth_back(1), None);
```
Returning `None` if there are less than `n + 1` elements:
```
let a = [1, 2, 3];
assert_eq!(a.iter().nth_back(10), None);
```
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#221-225)1.27.0 · #### fn try\_rfold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
This is the reverse version of [`Iterator::try_fold()`](trait.iterator#method.try_fold "Iterator::try_fold()"): it takes elements starting from the back of the iterator.
##### Examples
Basic usage:
```
let a = ["1", "2", "3"];
let sum = a.iter()
.map(|&s| s.parse::<i32>())
.try_rfold(0, |acc, x| x.and_then(|y| Ok(acc + y)));
assert_eq!(sum, Ok(6));
```
Short-circuiting:
```
let a = ["1", "rust", "3"];
let mut it = a.iter();
let sum = it
.by_ref()
.map(|&s| s.parse::<i32>())
.try_rfold(0, |acc, x| x.and_then(|y| Ok(acc + y)));
assert!(sum.is_err());
// Because it short-circuited, the remaining elements are still
// available through the iterator.
assert_eq!(it.next_back(), Some(&"1"));
```
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#292-295)1.27.0 · #### fn rfold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
An iterator method that reduces the iterator’s elements to a single, final value, starting from the back.
This is the reverse version of [`Iterator::fold()`](trait.iterator#method.fold "Iterator::fold()"): it takes elements starting from the back of the iterator.
`rfold()` takes two arguments: an initial value, and a closure with two arguments: an ‘accumulator’, and an element. The closure returns the value that the accumulator should have for the next iteration.
The initial value is the value the accumulator will have on the first call.
After applying this closure to every element of the iterator, `rfold()` returns the accumulator.
This operation is sometimes called ‘reduce’ or ‘inject’.
Folding is useful whenever you have a collection of something, and want to produce a single value from it.
Note: `rfold()` combines elements in a *right-associative* fashion. For associative operators like `+`, the order the elements are combined in is not important, but for non-associative operators like `-` the order will affect the final result. For a *left-associative* version of `rfold()`, see [`Iterator::fold()`](trait.iterator#method.fold "Iterator::fold()").
##### Examples
Basic usage:
```
let a = [1, 2, 3];
// the sum of all of the elements of a
let sum = a.iter()
.rfold(0, |acc, &x| acc + x);
assert_eq!(sum, 6);
```
This example demonstrates the right-associative nature of `rfold()`: it builds a string, starting with an initial value and continuing with each element from the back until the front:
```
let numbers = [1, 2, 3, 4, 5];
let zero = "0".to_string();
let result = numbers.iter().rfold(zero, |acc, &x| {
format!("({x} + {acc})")
});
assert_eq!(result, "(1 + (2 + (3 + (4 + (5 + 0)))))");
```
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#347-350)1.27.0 · #### fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator from the back that satisfies a predicate.
`rfind()` takes a closure that returns `true` or `false`. It applies this closure to each element of the iterator, starting at the end, and if any of them return `true`, then `rfind()` returns [`Some(element)`](../option/enum.option#variant.Some). If they all return `false`, it returns [`None`](../option/enum.option#variant.None "None").
`rfind()` is short-circuiting; in other words, it will stop processing as soon as the closure returns `true`.
Because `rfind()` takes a reference, and many iterators iterate over references, this leads to a possibly confusing situation where the argument is a double reference. You can see this effect in the examples below, with `&&x`.
##### Examples
Basic usage:
```
let a = [1, 2, 3];
assert_eq!(a.iter().rfind(|&&x| x == 2), Some(&2));
assert_eq!(a.iter().rfind(|&&x| x == 5), None);
```
Stopping at the first `true`:
```
let a = [1, 2, 3];
let mut iter = a.iter();
assert_eq!(iter.rfind(|&&x| x == 2), Some(&2));
// we can still use `iter`, as there are more elements.
assert_eq!(iter.next_back(), Some(&1));
```
Implementors
------------
[source](https://doc.rust-lang.org/src/core/ascii.rs.html#126)### impl DoubleEndedIterator for EscapeDefault
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#427)1.59.0 · ### impl DoubleEndedIterator for ToLowercase
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#461)1.59.0 · ### impl DoubleEndedIterator for ToUppercase
[source](https://doc.rust-lang.org/src/std/env.rs.html#823-827)1.12.0 · ### impl DoubleEndedIterator for Args
[source](https://doc.rust-lang.org/src/std/env.rs.html#864-868)1.12.0 · ### impl DoubleEndedIterator for ArgsOs
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#309)### impl DoubleEndedIterator for Bytes<'\_>
[source](https://doc.rust-lang.org/src/alloc/string.rs.html#2947)1.6.0 · ### impl DoubleEndedIterator for std::string::Drain<'\_>
[source](https://doc.rust-lang.org/src/std/path.rs.html#941-985)### impl<'a> DoubleEndedIterator for Components<'a>
[source](https://doc.rust-lang.org/src/std/path.rs.html#877-882)### impl<'a> DoubleEndedIterator for std::path::Iter<'a>
[source](https://doc.rust-lang.org/src/core/slice/ascii.rs.html#212)1.60.0 · ### impl<'a> DoubleEndedIterator for EscapeAscii<'a>
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#169)### impl<'a> DoubleEndedIterator for CharIndices<'a>
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#79)### impl<'a> DoubleEndedIterator for Chars<'a>
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#1117)### impl<'a> DoubleEndedIterator for Lines<'a>
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#1155)### impl<'a> DoubleEndedIterator for LinesAny<'a>
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#1282)1.34.0 · ### impl<'a> DoubleEndedIterator for SplitAsciiWhitespace<'a>
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#1226)1.1.0 · ### impl<'a> DoubleEndedIterator for SplitWhitespace<'a>
[source](https://doc.rust-lang.org/src/core/option.rs.html#2102)### impl<'a, A> DoubleEndedIterator for std::option::Iter<'a, A>
[source](https://doc.rust-lang.org/src/core/option.rs.html#2152)### impl<'a, A> DoubleEndedIterator for std::option::IterMut<'a, A>
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#364)### impl<'a, I> DoubleEndedIterator for &'a mut Iwhere I: [DoubleEndedIterator](trait.doubleendediterator "trait std::iter::DoubleEndedIterator") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/cloned.rs.html#74)1.1.0 · ### impl<'a, I, T> DoubleEndedIterator for Cloned<I>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), I: [DoubleEndedIterator](trait.doubleendediterator "trait std::iter::DoubleEndedIterator")<Item = [&'a](../primitive.reference) T>,
[source](https://doc.rust-lang.org/src/core/iter/adapters/copied.rs.html#95)1.36.0 · ### impl<'a, I, T> DoubleEndedIterator for Copied<I>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), I: [DoubleEndedIterator](trait.doubleendediterator "trait std::iter::DoubleEndedIterator")<Item = [&'a](../primitive.reference) T>,
[source](https://doc.rust-lang.org/src/alloc/collections/btree/map.rs.html#1518)### impl<'a, K, V> DoubleEndedIterator for std::collections::btree\_map::Iter<'a, K, V>where K: 'a, V: 'a,
[source](https://doc.rust-lang.org/src/alloc/collections/btree/map.rs.html#1584)### impl<'a, K, V> DoubleEndedIterator for std::collections::btree\_map::IterMut<'a, K, V>
[source](https://doc.rust-lang.org/src/alloc/collections/btree/map.rs.html#1751)### impl<'a, K, V> DoubleEndedIterator for Keys<'a, K, V>
[source](https://doc.rust-lang.org/src/alloc/collections/btree/map.rs.html#2062)1.17.0 · ### impl<'a, K, V> DoubleEndedIterator for std::collections::btree\_map::Range<'a, K, V>
[source](https://doc.rust-lang.org/src/alloc/collections/btree/map.rs.html#2100)1.17.0 · ### impl<'a, K, V> DoubleEndedIterator for RangeMut<'a, K, V>
[source](https://doc.rust-lang.org/src/alloc/collections/btree/map.rs.html#1792)### impl<'a, K, V> DoubleEndedIterator for Values<'a, K, V>
[source](https://doc.rust-lang.org/src/alloc/collections/btree/map.rs.html#1969)1.10.0 · ### impl<'a, K, V> DoubleEndedIterator for ValuesMut<'a, K, V>
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#1010-1026)1.5.0 · ### impl<'a, P> DoubleEndedIterator for MatchIndices<'a, P>where P: [Pattern](../str/pattern/trait.pattern "trait std::str::pattern::Pattern")<'a>, <P as [Pattern](../str/pattern/trait.pattern "trait std::str::pattern::Pattern")<'a>>::[Searcher](../str/pattern/trait.pattern#associatedtype.Searcher "type std::str::pattern::Pattern::Searcher"): [DoubleEndedSearcher](../str/pattern/trait.doubleendedsearcher "trait std::str::pattern::DoubleEndedSearcher")<'a>,
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#1067-1083)1.2.0 · ### impl<'a, P> DoubleEndedIterator for Matches<'a, P>where P: [Pattern](../str/pattern/trait.pattern "trait std::str::pattern::Pattern")<'a>, <P as [Pattern](../str/pattern/trait.pattern "trait std::str::pattern::Pattern")<'a>>::[Searcher](../str/pattern/trait.pattern#associatedtype.Searcher "type std::str::pattern::Pattern::Searcher"): [DoubleEndedSearcher](../str/pattern/trait.doubleendedsearcher "trait std::str::pattern::DoubleEndedSearcher")<'a>,
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#1010-1026)1.5.0 · ### impl<'a, P> DoubleEndedIterator for RMatchIndices<'a, P>where P: [Pattern](../str/pattern/trait.pattern "trait std::str::pattern::Pattern")<'a>, <P as [Pattern](../str/pattern/trait.pattern "trait std::str::pattern::Pattern")<'a>>::[Searcher](../str/pattern/trait.pattern#associatedtype.Searcher "type std::str::pattern::Pattern::Searcher"): [DoubleEndedSearcher](../str/pattern/trait.doubleendedsearcher "trait std::str::pattern::DoubleEndedSearcher")<'a>,
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#1067-1083)1.2.0 · ### impl<'a, P> DoubleEndedIterator for RMatches<'a, P>where P: [Pattern](../str/pattern/trait.pattern "trait std::str::pattern::Pattern")<'a>, <P as [Pattern](../str/pattern/trait.pattern "trait std::str::pattern::Pattern")<'a>>::[Searcher](../str/pattern/trait.pattern#associatedtype.Searcher "type std::str::pattern::Pattern::Searcher"): [DoubleEndedSearcher](../str/pattern/trait.doubleendedsearcher "trait std::str::pattern::DoubleEndedSearcher")<'a>,
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#730-746)### impl<'a, P> DoubleEndedIterator for std::str::RSplit<'a, P>where P: [Pattern](../str/pattern/trait.pattern "trait std::str::pattern::Pattern")<'a>, <P as [Pattern](../str/pattern/trait.pattern "trait std::str::pattern::Pattern")<'a>>::[Searcher](../str/pattern/trait.pattern#associatedtype.Searcher "type std::str::pattern::Pattern::Searcher"): [DoubleEndedSearcher](../str/pattern/trait.doubleendedsearcher "trait std::str::pattern::DoubleEndedSearcher")<'a>,
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#790-806)### impl<'a, P> DoubleEndedIterator for RSplitTerminator<'a, P>where P: [Pattern](../str/pattern/trait.pattern "trait std::str::pattern::Pattern")<'a>, <P as [Pattern](../str/pattern/trait.pattern "trait std::str::pattern::Pattern")<'a>>::[Searcher](../str/pattern/trait.pattern#associatedtype.Searcher "type std::str::pattern::Pattern::Searcher"): [DoubleEndedSearcher](../str/pattern/trait.doubleendedsearcher "trait std::str::pattern::DoubleEndedSearcher")<'a>,
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#730-746)### impl<'a, P> DoubleEndedIterator for std::str::Split<'a, P>where P: [Pattern](../str/pattern/trait.pattern "trait std::str::pattern::Pattern")<'a>, <P as [Pattern](../str/pattern/trait.pattern "trait std::str::pattern::Pattern")<'a>>::[Searcher](../str/pattern/trait.pattern#associatedtype.Searcher "type std::str::pattern::Pattern::Searcher"): [DoubleEndedSearcher](../str/pattern/trait.doubleendedsearcher "trait std::str::pattern::DoubleEndedSearcher")<'a>,
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#1348-1349)1.51.0 · ### impl<'a, P> DoubleEndedIterator for std::str::SplitInclusive<'a, P>where P: [Pattern](../str/pattern/trait.pattern "trait std::str::pattern::Pattern")<'a>, <P as [Pattern](../str/pattern/trait.pattern "trait std::str::pattern::Pattern")<'a>>::[Searcher](../str/pattern/trait.pattern#associatedtype.Searcher "type std::str::pattern::Pattern::Searcher"): [ReverseSearcher](../str/pattern/trait.reversesearcher "trait std::str::pattern::ReverseSearcher")<'a>,
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#790-806)### impl<'a, P> DoubleEndedIterator for SplitTerminator<'a, P>where P: [Pattern](../str/pattern/trait.pattern "trait std::str::pattern::Pattern")<'a>, <P as [Pattern](../str/pattern/trait.pattern "trait std::str::pattern::Pattern")<'a>>::[Searcher](../str/pattern/trait.pattern#associatedtype.Searcher "type std::str::pattern::Pattern::Searcher"): [DoubleEndedSearcher](../str/pattern/trait.doubleendedsearcher "trait std::str::pattern::DoubleEndedSearcher")<'a>,
[source](https://doc.rust-lang.org/src/alloc/collections/binary_heap.rs.html#1344)### impl<'a, T> DoubleEndedIterator for std::collections::binary\_heap::Iter<'a, T>
[source](https://doc.rust-lang.org/src/alloc/collections/btree/set.rs.html#1516)### impl<'a, T> DoubleEndedIterator for std::collections::btree\_set::Iter<'a, T>
[source](https://doc.rust-lang.org/src/alloc/collections/btree/set.rs.html#1588)1.17.0 · ### impl<'a, T> DoubleEndedIterator for std::collections::btree\_set::Range<'a, T>
[source](https://doc.rust-lang.org/src/alloc/collections/linked_list.rs.html#1055)### impl<'a, T> DoubleEndedIterator for std::collections::linked\_list::Iter<'a, T>
[source](https://doc.rust-lang.org/src/alloc/collections/linked_list.rs.html#1109)### impl<'a, T> DoubleEndedIterator for std::collections::linked\_list::IterMut<'a, T>
[source](https://doc.rust-lang.org/src/alloc/collections/vec_deque/iter.rs.html#142)### impl<'a, T> DoubleEndedIterator for std::collections::vec\_deque::Iter<'a, T>
[source](https://doc.rust-lang.org/src/alloc/collections/vec_deque/iter_mut.rs.html#114)### impl<'a, T> DoubleEndedIterator for std::collections::vec\_deque::IterMut<'a, T>
[source](https://doc.rust-lang.org/src/core/result.rs.html#1908)### impl<'a, T> DoubleEndedIterator for std::result::Iter<'a, T>
[source](https://doc.rust-lang.org/src/core/result.rs.html#1957)### impl<'a, T> DoubleEndedIterator for std::result::IterMut<'a, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1544)### impl<'a, T> DoubleEndedIterator for Chunks<'a, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1905)1.31.0 · ### impl<'a, T> DoubleEndedIterator for ChunksExact<'a, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2066)1.31.0 · ### impl<'a, T> DoubleEndedIterator for ChunksExactMut<'a, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1732)### impl<'a, T> DoubleEndedIterator for ChunksMut<'a, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#135-145)### impl<'a, T> DoubleEndedIterator for std::slice::Iter<'a, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#366)### impl<'a, T> DoubleEndedIterator for std::slice::IterMut<'a, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2612)1.31.0 · ### impl<'a, T> DoubleEndedIterator for RChunks<'a, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2964)1.31.0 · ### impl<'a, T> DoubleEndedIterator for RChunksExact<'a, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#3129)1.31.0 · ### impl<'a, T> DoubleEndedIterator for RChunksExactMut<'a, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2793)1.31.0 · ### impl<'a, T> DoubleEndedIterator for RChunksMut<'a, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1382)### impl<'a, T> DoubleEndedIterator for Windows<'a, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#3270)### impl<'a, T, P> DoubleEndedIterator for GroupBy<'a, T, P>where T: 'a, P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T, [&](../primitive.reference)T) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#3358)### impl<'a, T, P> DoubleEndedIterator for GroupByMut<'a, T, P>where T: 'a, P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T, [&](../primitive.reference)T) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#969)1.27.0 · ### impl<'a, T, P> DoubleEndedIterator for std::slice::RSplit<'a, T, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1066)1.27.0 · ### impl<'a, T, P> DoubleEndedIterator for RSplitMut<'a, T, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#482)### impl<'a, T, P> DoubleEndedIterator for std::slice::Split<'a, T, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#616)1.51.0 · ### impl<'a, T, P> DoubleEndedIterator for std::slice::SplitInclusive<'a, T, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#860)1.51.0 · ### impl<'a, T, P> DoubleEndedIterator for SplitInclusiveMut<'a, T, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#741)### impl<'a, T, P> DoubleEndedIterator for SplitMut<'a, T, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2338)### impl<'a, T, const N: usize> DoubleEndedIterator for std::slice::ArrayChunks<'a, T, N>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2456)### impl<'a, T, const N: usize> DoubleEndedIterator for ArrayChunksMut<'a, T, N>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2215)### impl<'a, T, const N: usize> DoubleEndedIterator for ArrayWindows<'a, T, N>
[source](https://doc.rust-lang.org/src/core/iter/range.rs.html#816)### impl<A> DoubleEndedIterator for std::ops::Range<A>where A: [Step](trait.step "trait std::iter::Step"),
[source](https://doc.rust-lang.org/src/core/iter/range.rs.html#1189)1.26.0 · ### impl<A> DoubleEndedIterator for RangeInclusive<A>where A: [Step](trait.step "trait std::iter::Step"),
[source](https://doc.rust-lang.org/src/core/option.rs.html#2193)### impl<A> DoubleEndedIterator for std::option::IntoIter<A>
[source](https://doc.rust-lang.org/src/core/iter/sources/repeat.rs.html#105)### impl<A> DoubleEndedIterator for Repeat<A>where A: [Clone](../clone/trait.clone "trait std::clone::Clone"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/chain.rs.html#178)### impl<A, B> DoubleEndedIterator for Chain<A, B>where A: [DoubleEndedIterator](trait.doubleendediterator "trait std::iter::DoubleEndedIterator"), B: [DoubleEndedIterator](trait.doubleendediterator "trait std::iter::DoubleEndedIterator")<Item = <A as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
[source](https://doc.rust-lang.org/src/core/iter/adapters/zip.rs.html#109)### impl<A, B> DoubleEndedIterator for Zip<A, B>where A: [DoubleEndedIterator](trait.doubleendediterator "trait std::iter::DoubleEndedIterator") + [ExactSizeIterator](trait.exactsizeiterator "trait std::iter::ExactSizeIterator"), B: [DoubleEndedIterator](trait.doubleendediterator "trait std::iter::DoubleEndedIterator") + [ExactSizeIterator](trait.exactsizeiterator "trait std::iter::ExactSizeIterator"),
[source](https://doc.rust-lang.org/src/core/iter/sources/once_with.rs.html#92)1.43.0 · ### impl<A, F> DoubleEndedIterator for OnceWith<F>where F: [FnOnce](../ops/trait.fnonce "trait std::ops::FnOnce")() -> A,
[source](https://doc.rust-lang.org/src/core/iter/adapters/filter_map.rs.html#90)### impl<B, I, F> DoubleEndedIterator for FilterMap<I, F>where I: [DoubleEndedIterator](trait.doubleendediterator "trait std::iter::DoubleEndedIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
[source](https://doc.rust-lang.org/src/core/iter/adapters/map.rs.html#139)### impl<B, I, F> DoubleEndedIterator for Map<I, F>where I: [DoubleEndedIterator](trait.doubleendediterator "trait std::iter::DoubleEndedIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
[source](https://doc.rust-lang.org/src/core/iter/adapters/by_ref_sized.rs.html#58)### impl<I> DoubleEndedIterator for ByRefSized<'\_, I>where I: [DoubleEndedIterator](trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/enumerate.rs.html#144)### impl<I> DoubleEndedIterator for Enumerate<I>where I: [ExactSizeIterator](trait.exactsizeiterator "trait std::iter::ExactSizeIterator") + [DoubleEndedIterator](trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/fuse.rs.html#120)### impl<I> DoubleEndedIterator for Fuse<I>where I: [DoubleEndedIterator](trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/peekable.rs.html#119)1.38.0 · ### impl<I> DoubleEndedIterator for Peekable<I>where I: [DoubleEndedIterator](trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/rev.rs.html#76)### impl<I> DoubleEndedIterator for Rev<I>where I: [DoubleEndedIterator](trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/skip.rs.html#166)1.9.0 · ### impl<I> DoubleEndedIterator for Skip<I>where I: [DoubleEndedIterator](trait.doubleendediterator "trait std::iter::DoubleEndedIterator") + [ExactSizeIterator](trait.exactsizeiterator "trait std::iter::ExactSizeIterator"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/step_by.rs.html#168)1.38.0 · ### impl<I> DoubleEndedIterator for StepBy<I>where I: [DoubleEndedIterator](trait.doubleendediterator "trait std::iter::DoubleEndedIterator") + [ExactSizeIterator](trait.exactsizeiterator "trait std::iter::ExactSizeIterator"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/take.rs.html#150)1.38.0 · ### impl<I> DoubleEndedIterator for Take<I>where I: [DoubleEndedIterator](trait.doubleendediterator "trait std::iter::DoubleEndedIterator") + [ExactSizeIterator](trait.exactsizeiterator "trait std::iter::ExactSizeIterator"),
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#1914)### impl<I, A> DoubleEndedIterator for Box<I, A>where I: [DoubleEndedIterator](trait.doubleendediterator "trait std::iter::DoubleEndedIterator") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"), A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator"),
[source](https://doc.rust-lang.org/src/alloc/vec/splice.rs.html#44)1.21.0 · ### impl<I, A> DoubleEndedIterator for Splice<'\_, I, A>where I: [Iterator](trait.iterator "trait std::iter::Iterator"), A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/inspect.rs.html#105)### impl<I, F> DoubleEndedIterator for Inspect<I, F>where I: [DoubleEndedIterator](trait.doubleendediterator "trait std::iter::DoubleEndedIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
[source](https://doc.rust-lang.org/src/core/iter/adapters/filter.rs.html#106)### impl<I, P> DoubleEndedIterator for Filter<I, P>where I: [DoubleEndedIterator](trait.doubleendediterator "trait std::iter::DoubleEndedIterator"), P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/iter/adapters/flatten.rs.html#255)1.29.0 · ### impl<I, U> DoubleEndedIterator for Flatten<I>where I: [DoubleEndedIterator](trait.doubleendediterator "trait std::iter::DoubleEndedIterator"), U: [DoubleEndedIterator](trait.doubleendediterator "trait std::iter::DoubleEndedIterator"), <I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), <<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item") as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[IntoIter](trait.intoiterator#associatedtype.IntoIter "type std::iter::IntoIterator::IntoIter") == U, <<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item") as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[Item](trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item") == <U as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/flatten.rs.html#94)### impl<I, U, F> DoubleEndedIterator for FlatMap<I, U, F>where I: [DoubleEndedIterator](trait.doubleendediterator "trait std::iter::DoubleEndedIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(<I as [Iterator](trait.iterator "trait std::iter::Iterator")>::[Item](trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U, U: [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator"), <U as [IntoIterator](trait.intoiterator "trait std::iter::IntoIterator")>::[IntoIter](trait.intoiterator#associatedtype.IntoIter "type std::iter::IntoIterator::IntoIter"): [DoubleEndedIterator](trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/array_chunks.rs.html#95)### impl<I, const N: usize> DoubleEndedIterator for std::iter::ArrayChunks<I, N>where I: [DoubleEndedIterator](trait.doubleendediterator "trait std::iter::DoubleEndedIterator") + [ExactSizeIterator](trait.exactsizeiterator "trait std::iter::ExactSizeIterator"),
[source](https://doc.rust-lang.org/src/alloc/collections/btree/map.rs.html#1708)### impl<K, V, A> DoubleEndedIterator for std::collections::btree\_map::IntoIter<K, V, A>where A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator") + [Clone](../clone/trait.clone "trait std::clone::Clone"),
[source](https://doc.rust-lang.org/src/alloc/collections/btree/map.rs.html#2011)1.54.0 · ### impl<K, V, A> DoubleEndedIterator for IntoKeys<K, V, A>where A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator") + [Clone](../clone/trait.clone "trait std::clone::Clone"),
[source](https://doc.rust-lang.org/src/alloc/collections/btree/map.rs.html#2045)1.54.0 · ### impl<K, V, A> DoubleEndedIterator for IntoValues<K, V, A>where A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator") + [Clone](../clone/trait.clone "trait std::clone::Clone"),
[source](https://doc.rust-lang.org/src/alloc/collections/binary_heap.rs.html#1499)1.6.0 · ### impl<T> DoubleEndedIterator for std::collections::binary\_heap::Drain<'\_, T>
[source](https://doc.rust-lang.org/src/alloc/collections/binary_heap.rs.html#1397)### impl<T> DoubleEndedIterator for std::collections::binary\_heap::IntoIter<T>
[source](https://doc.rust-lang.org/src/alloc/collections/linked_list.rs.html#1798)### impl<T> DoubleEndedIterator for std::collections::linked\_list::IntoIter<T>
[source](https://doc.rust-lang.org/src/core/result.rs.html#2003)### impl<T> DoubleEndedIterator for std::result::IntoIter<T>
[source](https://doc.rust-lang.org/src/core/iter/sources/empty.rs.html#58)1.2.0 · ### impl<T> DoubleEndedIterator for Empty<T>
[source](https://doc.rust-lang.org/src/core/iter/sources/once.rs.html#82)1.2.0 · ### impl<T> DoubleEndedIterator for Once<T>
[source](https://doc.rust-lang.org/src/alloc/collections/btree/set.rs.html#1544)### impl<T, A> DoubleEndedIterator for std::collections::btree\_set::IntoIter<T, A>where A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator") + [Clone](../clone/trait.clone "trait std::clone::Clone"),
[source](https://doc.rust-lang.org/src/alloc/collections/vec_deque/drain.rs.html#150)1.6.0 · ### impl<T, A> DoubleEndedIterator for std::collections::vec\_deque::Drain<'\_, T, A>where A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator"),
[source](https://doc.rust-lang.org/src/alloc/collections/vec_deque/into_iter.rs.html#54)### impl<T, A> DoubleEndedIterator for std::collections::vec\_deque::IntoIter<T, A>where A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator"),
[source](https://doc.rust-lang.org/src/alloc/vec/drain.rs.html#168)1.6.0 · ### impl<T, A> DoubleEndedIterator for std::vec::Drain<'\_, T, A>where A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator"),
[source](https://doc.rust-lang.org/src/alloc/vec/into_iter.rs.html#262)### impl<T, A> DoubleEndedIterator for std::vec::IntoIter<T, A>where A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator"),
[source](https://doc.rust-lang.org/src/core/array/iter.rs.html#308)1.40.0 · ### impl<T, const N: usize> DoubleEndedIterator for std::array::IntoIter<T, N>
| programming_docs |
rust Constant std::char::REPLACEMENT_CHARACTER Constant std::char::REPLACEMENT\_CHARACTER
==========================================
```
pub const REPLACEMENT_CHARACTER: char = char::REPLACEMENT_CHARACTER; // '�'
```
`U+FFFD REPLACEMENT CHARACTER` (�) is used in Unicode to represent a decoding error. Use [`char::REPLACEMENT_CHARACTER`](../primitive.char#associatedconstant.REPLACEMENT_CHARACTER "char::REPLACEMENT_CHARACTER") instead.
rust Struct std::char::TryFromCharError Struct std::char::TryFromCharError
==================================
```
pub struct TryFromCharError(_);
```
The error type returned when a checked char conversion fails.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#580)### impl Clone for TryFromCharError
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#580)#### fn clone(&self) -> TryFromCharError
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)1.0.0 · #### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#580)### impl Debug for TryFromCharError
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#580)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#584)### impl Display for TryFromCharError
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#585)#### fn fmt(&self, fmt: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.display#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#592)### impl Error for TryFromCharError
[source](https://doc.rust-lang.org/src/core/error.rs.html#83)1.30.0 · #### fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. [Read more](../error/trait.error#method.source)
[source](https://doc.rust-lang.org/src/core/error.rs.html#109)1.0.0 · #### fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to\_string()
[Read more](../error/trait.error#method.description)
[source](https://doc.rust-lang.org/src/core/error.rs.html#119)1.0.0 · #### fn cause(&self) -> Option<&dyn Error>
👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
[source](https://doc.rust-lang.org/src/core/error.rs.html#193)#### fn provide(&'a self, demand: &mut Demand<'a>)
🔬This is a nightly-only experimental API. (`error_generic_member_access` [#99301](https://github.com/rust-lang/rust/issues/99301))
Provides type based access to context intended for error reports. [Read more](../error/trait.error#method.provide)
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#580)### impl PartialEq<TryFromCharError> for TryFromCharError
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#580)#### fn eq(&self, other: &TryFromCharError) -> bool
This method tests for `self` and `other` values to be equal, and is used by `==`. [Read more](../cmp/trait.partialeq#tymethod.eq)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#236)1.0.0 · #### fn ne(&self, other: &Rhs) -> bool
This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. [Read more](../cmp/trait.partialeq#method.ne)
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#580)### impl Copy for TryFromCharError
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#580)### impl Eq for TryFromCharError
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#580)### impl StructuralEq for TryFromCharError
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#580)### impl StructuralPartialEq for TryFromCharError
Auto Trait Implementations
--------------------------
### impl RefUnwindSafe for TryFromCharError
### impl Send for TryFromCharError
### impl Sync for TryFromCharError
### impl Unpin for TryFromCharError
### impl UnwindSafe for TryFromCharError
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/error.rs.html#197)### impl<E> Provider for Ewhere E: [Error](../error/trait.error "trait std::error::Error") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/error.rs.html#201)#### fn provide(&'a self, demand: &mut Demand<'a>)
🔬This is a nightly-only experimental API. (`provide_any` [#96024](https://github.com/rust-lang/rust/issues/96024))
Data providers should implement this method to provide *all* values they are able to provide by using `demand`. [Read more](../any/trait.provider#tymethod.provide)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/alloc/string.rs.html#2500)### impl<T> ToString for Twhere T: [Display](../fmt/trait.display "trait std::fmt::Display") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/alloc/string.rs.html#2506)#### default fn to\_string(&self) -> String
Converts the given value to a `String`. [Read more](../string/trait.tostring#tymethod.to_string)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
rust Struct std::char::EscapeDebug Struct std::char::EscapeDebug
=============================
```
pub struct EscapeDebug(_);
```
An iterator that yields the literal escape code of a `char`.
This `struct` is created by the [`escape_debug`](../primitive.char#method.escape_debug) method on [`char`](../primitive.char "char"). See its documentation for more.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#378)### impl Clone for EscapeDebug
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#378)#### fn clone(&self) -> EscapeDebug
Notable traits for [EscapeDebug](struct.escapedebug "struct std::char::EscapeDebug")
```
impl Iterator for EscapeDebug
type Item = char;
```
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)1.0.0 · #### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#378)### impl Debug for EscapeDebug
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#378)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#399)### impl Display for EscapeDebug
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#400)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.display#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#393)### impl ExactSizeIterator for EscapeDebug
[source](https://doc.rust-lang.org/src/core/iter/traits/exact_size.rs.html#106)1.0.0 · #### fn len(&self) -> usize
Returns the exact remaining length of the iterator. [Read more](../iter/trait.exactsizeiterator#method.len)
[source](https://doc.rust-lang.org/src/core/iter/traits/exact_size.rs.html#138)#### fn is\_empty(&self) -> bool
🔬This is a nightly-only experimental API. (`exact_size_is_empty` [#35428](https://github.com/rust-lang/rust/issues/35428))
Returns `true` if the iterator is empty. [Read more](../iter/trait.exactsizeiterator#method.is_empty)
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#382)### impl Iterator for EscapeDebug
#### type Item = char
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#384)#### fn next(&mut self) -> Option<char>
Advances the iterator and returns the next value. [Read more](../iter/trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#387)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](../iter/trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](../iter/trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#252-254)1.0.0 · #### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](../iter/trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#282-284)1.0.0 · #### fn last(self) -> Option<Self::Item>
Consumes the iterator, returning the last element. [Read more](../iter/trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#328)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](../iter/trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#376)1.0.0 · #### fn nth(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element of the iterator. [Read more](../iter/trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](../iter/struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](../iter/trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)1.0.0 · #### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](../iter/struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](../iter/trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)1.0.0 · #### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](../iter/struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](../iter/trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](../iter/struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](../iter/trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)1.0.0 · #### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](../iter/struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](../iter/trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](../iter/trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)1.0.0 · #### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](../iter/struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](../iter/trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)1.0.0 · #### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](../iter/struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](../iter/trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)1.0.0 · #### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](../iter/struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](../iter/trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)1.0.0 · #### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](../iter/struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](../iter/struct.peekable#method.peek) and [`peek_mut`](../iter/struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](../iter/trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)1.0.0 · #### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](../iter/struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](../iter/trait.iterator#method.skip)s elements based on a predicate. [Read more](../iter/trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)1.0.0 · #### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](../iter/struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](../iter/trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](../iter/struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](../iter/trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)1.0.0 · #### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](../iter/struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](../iter/trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)1.0.0 · #### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](../iter/struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](../iter/trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)1.0.0 · #### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](../iter/struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](../iter/trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](../iter/trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)1.0.0 · #### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](../iter/struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](../iter/trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)1.0.0 · #### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](../iter/struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](../iter/trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)1.0.0 · #### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](../iter/struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](../iter/trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)1.0.0 · #### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](../iter/trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)1.0.0 · #### fn collect<B>(self) -> Bwhere B: [FromIterator](../iter/trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](../iter/trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](../iter/trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)1.0.0 · #### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](../iter/trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](../iter/trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2230-2234)1.27.0 · #### fn try\_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](../iter/trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](../iter/trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2407-2410)1.0.0 · #### fn fold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](../iter/trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](../iter/trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](../iter/trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)1.0.0 · #### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)1.0.0 · #### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)1.0.0 · #### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](../iter/trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](../iter/trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](../iter/trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)1.0.0 · #### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](../iter/trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](../iter/trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](../iter/trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)1.0.0 · #### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](../iter/trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](../iter/struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](../iter/trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)1.0.0 · #### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](../iter/struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](../iter/trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3312-3314)1.0.0 · #### fn cycle(self) -> Cycle<Self>where Self: [Clone](../clone/trait.clone "trait std::clone::Clone"),
Notable traits for [Cycle](../iter/struct.cycle "struct std::iter::Cycle")<I>
```
impl<I> Iterator for Cycle<I>where
I: Clone + Iterator,
type Item = <I as Iterator>::Item;
```
Repeats an iterator endlessly. [Read more](../iter/trait.iterator#method.cycle)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](../iter/struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](../iter/trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](../iter/trait.sum "trait std::iter::Sum")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](../iter/trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](../iter/trait.product "trait std::iter::Product")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](../iter/trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another. [Read more](../iter/trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another. [Read more](../iter/trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](../iter/trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are unequal to those of another. [Read more](../iter/trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](../iter/trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](../iter/trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](../iter/trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](../iter/trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](../iter/trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](../iter/trait.iterator#method.is_sorted_by_key)
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#396)1.26.0 · ### impl FusedIterator for EscapeDebug
Auto Trait Implementations
--------------------------
### impl RefUnwindSafe for EscapeDebug
### impl Send for EscapeDebug
### impl Sync for EscapeDebug
### impl Unpin for EscapeDebug
### impl UnwindSafe for EscapeDebug
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](../iter/trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](../iter/trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/alloc/string.rs.html#2500)### impl<T> ToString for Twhere T: [Display](../fmt/trait.display "trait std::fmt::Display") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/alloc/string.rs.html#2506)#### default fn to\_string(&self) -> String
Converts the given value to a `String`. [Read more](../string/trait.tostring#tymethod.to_string)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Module std::char Module std::char
================
Utilities for the `char` primitive type.
*[See also the `char` primitive type](../primitive.char).*
The `char` type represents a single character. More specifically, since ‘character’ isn’t a well-defined concept in Unicode, `char` is a ‘[Unicode scalar value](https://www.unicode.org/glossary/#unicode_scalar_value)’, which is similar to, but not the same as, a ‘[Unicode code point](https://www.unicode.org/glossary/#code_point)’.
This module exists for technical reasons, the primary documentation for `char` is directly on [the `char` primitive type](../primitive.char "char") itself.
This module is the home of the iterator implementations for the iterators implemented on `char`, as well as some useful constants and conversion functions that convert various types to `char`.
Structs
-------
[CharTryFromError](struct.chartryfromerror "std::char::CharTryFromError struct")
The error type returned when a conversion from [`u32`](../primitive.u32 "u32") to [`char`](../primitive.char "char") fails.
[DecodeUtf16](struct.decodeutf16 "std::char::DecodeUtf16 struct")
An iterator that decodes UTF-16 encoded code points from an iterator of `u16`s.
[DecodeUtf16Error](struct.decodeutf16error "std::char::DecodeUtf16Error struct")
An error that can be returned when decoding UTF-16 code points.
[EscapeDebug](struct.escapedebug "std::char::EscapeDebug struct")
An iterator that yields the literal escape code of a `char`.
[EscapeDefault](struct.escapedefault "std::char::EscapeDefault struct")
An iterator that yields the literal escape code of a `char`.
[EscapeUnicode](struct.escapeunicode "std::char::EscapeUnicode struct")
Returns an iterator that yields the hexadecimal Unicode escape of a character, as `char`s.
[ParseCharError](struct.parsecharerror "std::char::ParseCharError struct")
An error which can be returned when parsing a char.
[ToLowercase](struct.tolowercase "std::char::ToLowercase struct")
Returns an iterator that yields the lowercase equivalent of a `char`.
[ToUppercase](struct.touppercase "std::char::ToUppercase struct")
Returns an iterator that yields the uppercase equivalent of a `char`.
[TryFromCharError](struct.tryfromcharerror "std::char::TryFromCharError struct")
The error type returned when a checked char conversion fails.
Constants
---------
[MAX](constant.max "std::char::MAX constant")
The highest valid code point a `char` can have, `'\u{10FFFF}'`. Use [`char::MAX`](../primitive.char#associatedconstant.MAX "char::MAX") instead.
[REPLACEMENT\_CHARACTER](constant.replacement_character "std::char::REPLACEMENT_CHARACTER constant")
`U+FFFD REPLACEMENT CHARACTER` (�) is used in Unicode to represent a decoding error. Use [`char::REPLACEMENT_CHARACTER`](../primitive.char#associatedconstant.REPLACEMENT_CHARACTER "char::REPLACEMENT_CHARACTER") instead.
[UNICODE\_VERSION](constant.unicode_version "std::char::UNICODE_VERSION constant")
The version of [Unicode](https://www.unicode.org/) that the Unicode parts of `char` and `str` methods are based on. Use [`char::UNICODE_VERSION`](../primitive.char#associatedconstant.UNICODE_VERSION "char::UNICODE_VERSION") instead.
Functions
---------
[decode\_utf16](fn.decode_utf16 "std::char::decode_utf16 fn")
Creates an iterator over the UTF-16 encoded code points in `iter`, returning unpaired surrogates as `Err`s. Use [`char::decode_utf16`](../primitive.char#method.decode_utf16 "char::decode_utf16") instead.
[from\_digit](fn.from_digit "std::char::from_digit fn")
Converts a digit in the given radix to a `char`. Use [`char::from_digit`](../primitive.char#method.from_digit "char::from_digit") instead.
[from\_u32](fn.from_u32 "std::char::from_u32 fn")
Converts a `u32` to a `char`. Use [`char::from_u32`](../primitive.char#method.from_u32 "char::from_u32") instead.
[from\_u32\_unchecked](fn.from_u32_unchecked "std::char::from_u32_unchecked fn")[⚠](# "unsafe function")
Converts a `u32` to a `char`, ignoring validity. Use [`char::from_u32_unchecked`](../primitive.char#method.from_u32_unchecked "char::from_u32_unchecked"). instead.
rust Function std::char::from_digit Function std::char::from\_digit
===============================
```
pub fn from_digit(num: u32, radix: u32) -> Option<char>
```
Converts a digit in the given radix to a `char`. Use [`char::from_digit`](../primitive.char#method.from_digit "char::from_digit") instead.
rust Constant std::char::UNICODE_VERSION Constant std::char::UNICODE\_VERSION
====================================
```
pub const UNICODE_VERSION: (u8, u8, u8);
```
The version of [Unicode](https://www.unicode.org/) that the Unicode parts of `char` and `str` methods are based on. Use [`char::UNICODE_VERSION`](../primitive.char#associatedconstant.UNICODE_VERSION "char::UNICODE_VERSION") instead.
rust Struct std::char::EscapeUnicode Struct std::char::EscapeUnicode
===============================
```
pub struct EscapeUnicode { /* private fields */ }
```
Returns an iterator that yields the hexadecimal Unicode escape of a character, as `char`s.
This `struct` is created by the [`escape_unicode`](../primitive.char#method.escape_unicode) method on [`char`](../primitive.char "char"). See its documentation for more.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#148)### impl Clone for EscapeUnicode
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#148)#### fn clone(&self) -> EscapeUnicode
Notable traits for [EscapeUnicode](struct.escapeunicode "struct std::char::EscapeUnicode")
```
impl Iterator for EscapeUnicode
type Item = char;
```
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)#### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#148)### impl Debug for EscapeUnicode
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#148)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#254)1.16.0 · ### impl Display for EscapeUnicode
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#255)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.display#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#234)1.11.0 · ### impl ExactSizeIterator for EscapeUnicode
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#236)#### fn len(&self) -> usize
Returns the exact remaining length of the iterator. [Read more](../iter/trait.exactsizeiterator#method.len)
[source](https://doc.rust-lang.org/src/core/iter/traits/exact_size.rs.html#138)#### fn is\_empty(&self) -> bool
🔬This is a nightly-only experimental API. (`exact_size_is_empty` [#35428](https://github.com/rust-lang/rust/issues/35428))
Returns `true` if the iterator is empty. [Read more](../iter/trait.exactsizeiterator#method.is_empty)
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#174)### impl Iterator for EscapeUnicode
#### type Item = char
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#177)#### fn next(&mut self) -> Option<char>
Advances the iterator and returns the next value. [Read more](../iter/trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#210)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](../iter/trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#216)#### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](../iter/trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#220)#### fn last(self) -> Option<char>
Consumes the iterator, returning the last element. [Read more](../iter/trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](../iter/trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#328)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](../iter/trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#376)#### fn nth(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element of the iterator. [Read more](../iter/trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](../iter/struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](../iter/trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)#### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](../iter/struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](../iter/trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)#### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](../iter/struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](../iter/trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](../iter/struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](../iter/trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)#### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](../iter/struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](../iter/trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](../iter/trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)#### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](../iter/struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](../iter/trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)#### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](../iter/struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](../iter/trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)#### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](../iter/struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](../iter/trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)#### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](../iter/struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](../iter/struct.peekable#method.peek) and [`peek_mut`](../iter/struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](../iter/trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)#### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](../iter/struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](../iter/trait.iterator#method.skip)s elements based on a predicate. [Read more](../iter/trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)#### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](../iter/struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](../iter/trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](../iter/struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](../iter/trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)#### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](../iter/struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](../iter/trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)#### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](../iter/struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](../iter/trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)#### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](../iter/struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](../iter/trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](../iter/trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)#### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](../iter/struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](../iter/trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)#### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](../iter/struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](../iter/trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)#### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](../iter/struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](../iter/trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)#### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](../iter/trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)#### fn collect<B>(self) -> Bwhere B: [FromIterator](../iter/trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](../iter/trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](../iter/trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)#### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](../iter/trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](../iter/trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2230-2234)1.27.0 · #### fn try\_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](../iter/trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](../iter/trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2407-2410)#### fn fold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](../iter/trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](../iter/trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](../iter/trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)#### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)#### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)#### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](../iter/trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](../iter/trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](../iter/trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)#### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](../iter/trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](../iter/trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](../iter/trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)#### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](../iter/trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](../iter/struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](../iter/trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)#### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](../iter/struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](../iter/trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3312-3314)#### fn cycle(self) -> Cycle<Self>where Self: [Clone](../clone/trait.clone "trait std::clone::Clone"),
Notable traits for [Cycle](../iter/struct.cycle "struct std::iter::Cycle")<I>
```
impl<I> Iterator for Cycle<I>where
I: Clone + Iterator,
type Item = <I as Iterator>::Item;
```
Repeats an iterator endlessly. [Read more](../iter/trait.iterator#method.cycle)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](../iter/struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](../iter/trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](../iter/trait.sum "trait std::iter::Sum")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](../iter/trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](../iter/trait.product "trait std::iter::Product")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](../iter/trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another. [Read more](../iter/trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another. [Read more](../iter/trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](../iter/trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are unequal to those of another. [Read more](../iter/trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](../iter/trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](../iter/trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](../iter/trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](../iter/trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](../iter/trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](../iter/trait.iterator#method.is_sorted_by_key)
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#251)1.26.0 · ### impl FusedIterator for EscapeUnicode
Auto Trait Implementations
--------------------------
### impl RefUnwindSafe for EscapeUnicode
### impl Send for EscapeUnicode
### impl Sync for EscapeUnicode
### impl Unpin for EscapeUnicode
### impl UnwindSafe for EscapeUnicode
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](../iter/trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](../iter/trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/alloc/string.rs.html#2500)### impl<T> ToString for Twhere T: [Display](../fmt/trait.display "trait std::fmt::Display") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/alloc/string.rs.html#2506)#### default fn to\_string(&self) -> String
Converts the given value to a `String`. [Read more](../string/trait.tostring#tymethod.to_string)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Constant std::char::MAX Constant std::char::MAX
=======================
```
pub const MAX: char = char::MAX; // '\u{10ffff}'
```
The highest valid code point a `char` can have, `'\u{10FFFF}'`. Use [`char::MAX`](../primitive.char#associatedconstant.MAX "char::MAX") instead.
rust Struct std::char::CharTryFromError Struct std::char::CharTryFromError
==================================
```
pub struct CharTryFromError(_);
```
The error type returned when a conversion from [`u32`](../primitive.u32 "u32") to [`char`](../primitive.char "char") fails.
This `struct` is created by the [`char::try_from<u32>`](../primitive.char#impl-TryFrom%3Cu32%3E-for-char) method. See its documentation for more.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/char/convert.rs.html#235)### impl Clone for CharTryFromError
[source](https://doc.rust-lang.org/src/core/char/convert.rs.html#235)#### fn clone(&self) -> CharTryFromError
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)1.0.0 · #### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/core/char/convert.rs.html#235)### impl Debug for CharTryFromError
[source](https://doc.rust-lang.org/src/core/char/convert.rs.html#235)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/char/convert.rs.html#239)### impl Display for CharTryFromError
[source](https://doc.rust-lang.org/src/core/char/convert.rs.html#240)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.display#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/error.rs.html#481)### impl Error for CharTryFromError
[source](https://doc.rust-lang.org/src/core/error.rs.html#483)#### fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to\_string()
[Read more](../error/trait.error#method.description)
[source](https://doc.rust-lang.org/src/core/error.rs.html#83)1.30.0 · #### fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. [Read more](../error/trait.error#method.source)
[source](https://doc.rust-lang.org/src/core/error.rs.html#119)1.0.0 · #### fn cause(&self) -> Option<&dyn Error>
👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
[source](https://doc.rust-lang.org/src/core/error.rs.html#193)#### fn provide(&'a self, demand: &mut Demand<'a>)
🔬This is a nightly-only experimental API. (`error_generic_member_access` [#99301](https://github.com/rust-lang/rust/issues/99301))
Provides type based access to context intended for error reports. [Read more](../error/trait.error#method.provide)
[source](https://doc.rust-lang.org/src/core/char/convert.rs.html#235)### impl PartialEq<CharTryFromError> for CharTryFromError
[source](https://doc.rust-lang.org/src/core/char/convert.rs.html#235)#### fn eq(&self, other: &CharTryFromError) -> bool
This method tests for `self` and `other` values to be equal, and is used by `==`. [Read more](../cmp/trait.partialeq#tymethod.eq)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#236)1.0.0 · #### fn ne(&self, other: &Rhs) -> bool
This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. [Read more](../cmp/trait.partialeq#method.ne)
[source](https://doc.rust-lang.org/src/core/char/convert.rs.html#235)### impl Copy for CharTryFromError
[source](https://doc.rust-lang.org/src/core/char/convert.rs.html#235)### impl Eq for CharTryFromError
[source](https://doc.rust-lang.org/src/core/char/convert.rs.html#235)### impl StructuralEq for CharTryFromError
[source](https://doc.rust-lang.org/src/core/char/convert.rs.html#235)### impl StructuralPartialEq for CharTryFromError
Auto Trait Implementations
--------------------------
### impl RefUnwindSafe for CharTryFromError
### impl Send for CharTryFromError
### impl Sync for CharTryFromError
### impl Unpin for CharTryFromError
### impl UnwindSafe for CharTryFromError
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/error.rs.html#197)### impl<E> Provider for Ewhere E: [Error](../error/trait.error "trait std::error::Error") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/error.rs.html#201)#### fn provide(&'a self, demand: &mut Demand<'a>)
🔬This is a nightly-only experimental API. (`provide_any` [#96024](https://github.com/rust-lang/rust/issues/96024))
Data providers should implement this method to provide *all* values they are able to provide by using `demand`. [Read more](../any/trait.provider#tymethod.provide)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/alloc/string.rs.html#2500)### impl<T> ToString for Twhere T: [Display](../fmt/trait.display "trait std::fmt::Display") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/alloc/string.rs.html#2506)#### default fn to\_string(&self) -> String
Converts the given value to a `String`. [Read more](../string/trait.tostring#tymethod.to_string)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
rust Function std::char::decode_utf16 Function std::char::decode\_utf16
=================================
```
pub fn decode_utf16<I>(iter: I) -> DecodeUtf16<<I as IntoIterator>::IntoIter>ⓘNotable traits for DecodeUtf16<I>impl<I> Iterator for DecodeUtf16<I>where I: Iterator<Item = u16>, type Item = Result<char, DecodeUtf16Error>;where I: IntoIterator<Item = u16>,
```
Creates an iterator over the UTF-16 encoded code points in `iter`, returning unpaired surrogates as `Err`s. Use [`char::decode_utf16`](../primitive.char#method.decode_utf16 "char::decode_utf16") instead.
rust Struct std::char::DecodeUtf16 Struct std::char::DecodeUtf16
=============================
```
pub struct DecodeUtf16<I>where I: Iterator<Item = u16>,{ /* private fields */ }
```
An iterator that decodes UTF-16 encoded code points from an iterator of `u16`s.
This `struct` is created by the [`decode_utf16`](../primitive.char#method.decode_utf16) method on [`char`](../primitive.char "char"). See its documentation for more.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/char/decode.rs.html#16)### impl<I> Clone for DecodeUtf16<I>where I: [Clone](../clone/trait.clone "trait std::clone::Clone") + [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [u16](../primitive.u16)>,
[source](https://doc.rust-lang.org/src/core/char/decode.rs.html#16)#### fn clone(&self) -> DecodeUtf16<I>
Notable traits for [DecodeUtf16](struct.decodeutf16 "struct std::char::DecodeUtf16")<I>
```
impl<I> Iterator for DecodeUtf16<I>where
I: Iterator<Item = u16>,
type Item = Result<char, DecodeUtf16Error>;
```
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)1.0.0 · #### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/core/char/decode.rs.html#16)### impl<I> Debug for DecodeUtf16<I>where I: [Debug](../fmt/trait.debug "trait std::fmt::Debug") + [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [u16](../primitive.u16)>,
[source](https://doc.rust-lang.org/src/core/char/decode.rs.html#16)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/char/decode.rs.html#42)### impl<I> Iterator for DecodeUtf16<I>where I: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [u16](../primitive.u16)>,
#### type Item = Result<char, DecodeUtf16Error>
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/char/decode.rs.html#45)#### fn next(&mut self) -> Option<Result<char, DecodeUtf16Error>>
Advances the iterator and returns the next value. [Read more](../iter/trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/char/decode.rs.html#78)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](../iter/trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](../iter/trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#252-254)1.0.0 · #### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](../iter/trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#282-284)1.0.0 · #### fn last(self) -> Option<Self::Item>
Consumes the iterator, returning the last element. [Read more](../iter/trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#328)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](../iter/trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#376)1.0.0 · #### fn nth(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element of the iterator. [Read more](../iter/trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](../iter/struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](../iter/trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)1.0.0 · #### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](../iter/struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](../iter/trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)1.0.0 · #### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](../iter/struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](../iter/trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](../iter/struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](../iter/trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)1.0.0 · #### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](../iter/struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](../iter/trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](../iter/trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)1.0.0 · #### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](../iter/struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](../iter/trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)1.0.0 · #### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](../iter/struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](../iter/trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)1.0.0 · #### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](../iter/struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](../iter/trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)1.0.0 · #### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](../iter/struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](../iter/struct.peekable#method.peek) and [`peek_mut`](../iter/struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](../iter/trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)1.0.0 · #### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](../iter/struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](../iter/trait.iterator#method.skip)s elements based on a predicate. [Read more](../iter/trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)1.0.0 · #### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](../iter/struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](../iter/trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](../iter/struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](../iter/trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)1.0.0 · #### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](../iter/struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](../iter/trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)1.0.0 · #### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](../iter/struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](../iter/trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)1.0.0 · #### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](../iter/struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](../iter/trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](../iter/trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)1.0.0 · #### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](../iter/struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](../iter/trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)1.0.0 · #### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](../iter/struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](../iter/trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)1.0.0 · #### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](../iter/struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](../iter/trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)1.0.0 · #### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](../iter/trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)1.0.0 · #### fn collect<B>(self) -> Bwhere B: [FromIterator](../iter/trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](../iter/trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](../iter/trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)1.0.0 · #### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](../iter/trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](../iter/trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2230-2234)1.27.0 · #### fn try\_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](../iter/trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](../iter/trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2407-2410)1.0.0 · #### fn fold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](../iter/trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](../iter/trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](../iter/trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)1.0.0 · #### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)1.0.0 · #### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)1.0.0 · #### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](../iter/trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](../iter/trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](../iter/trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)1.0.0 · #### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](../iter/trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](../iter/trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](../iter/trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)1.0.0 · #### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](../iter/trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](../iter/struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](../iter/trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)1.0.0 · #### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](../iter/struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](../iter/trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](../iter/struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](../iter/trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](../iter/trait.sum "trait std::iter::Sum")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](../iter/trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](../iter/trait.product "trait std::iter::Product")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](../iter/trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another. [Read more](../iter/trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another. [Read more](../iter/trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](../iter/trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are unequal to those of another. [Read more](../iter/trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](../iter/trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](../iter/trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](../iter/trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](../iter/trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](../iter/trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](../iter/trait.iterator#method.is_sorted_by_key)
Auto Trait Implementations
--------------------------
### impl<I> RefUnwindSafe for DecodeUtf16<I>where I: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<I> Send for DecodeUtf16<I>where I: [Send](../marker/trait.send "trait std::marker::Send"),
### impl<I> Sync for DecodeUtf16<I>where I: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<I> Unpin for DecodeUtf16<I>where I: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"),
### impl<I> UnwindSafe for DecodeUtf16<I>where I: [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"),
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](../iter/trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](../iter/trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Struct std::char::DecodeUtf16Error Struct std::char::DecodeUtf16Error
==================================
```
pub struct DecodeUtf16Error { /* private fields */ }
```
An error that can be returned when decoding UTF-16 code points.
This `struct` is created when using the [`DecodeUtf16`](struct.decodeutf16 "DecodeUtf16") type.
Implementations
---------------
[source](https://doc.rust-lang.org/src/core/char/decode.rs.html#111)### impl DecodeUtf16Error
[source](https://doc.rust-lang.org/src/core/char/decode.rs.html#115)#### pub fn unpaired\_surrogate(&self) -> u16
Returns the unpaired surrogate which caused this error.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/char/decode.rs.html#29)### impl Clone for DecodeUtf16Error
[source](https://doc.rust-lang.org/src/core/char/decode.rs.html#29)#### fn clone(&self) -> DecodeUtf16Error
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)1.0.0 · #### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/core/char/decode.rs.html#29)### impl Debug for DecodeUtf16Error
[source](https://doc.rust-lang.org/src/core/char/decode.rs.html#29)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/char/decode.rs.html#121)### impl Display for DecodeUtf16Error
[source](https://doc.rust-lang.org/src/core/char/decode.rs.html#122)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.display#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/char/decode.rs.html#129)### impl Error for DecodeUtf16Error
[source](https://doc.rust-lang.org/src/core/char/decode.rs.html#131)#### fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to\_string()
[Read more](../error/trait.error#method.description)
[source](https://doc.rust-lang.org/src/core/error.rs.html#83)1.30.0 · #### fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. [Read more](../error/trait.error#method.source)
[source](https://doc.rust-lang.org/src/core/error.rs.html#119)1.0.0 · #### fn cause(&self) -> Option<&dyn Error>
👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
[source](https://doc.rust-lang.org/src/core/error.rs.html#193)#### fn provide(&'a self, demand: &mut Demand<'a>)
🔬This is a nightly-only experimental API. (`error_generic_member_access` [#99301](https://github.com/rust-lang/rust/issues/99301))
Provides type based access to context intended for error reports. [Read more](../error/trait.error#method.provide)
[source](https://doc.rust-lang.org/src/core/char/decode.rs.html#29)### impl PartialEq<DecodeUtf16Error> for DecodeUtf16Error
[source](https://doc.rust-lang.org/src/core/char/decode.rs.html#29)#### fn eq(&self, other: &DecodeUtf16Error) -> bool
This method tests for `self` and `other` values to be equal, and is used by `==`. [Read more](../cmp/trait.partialeq#tymethod.eq)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#236)1.0.0 · #### fn ne(&self, other: &Rhs) -> bool
This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. [Read more](../cmp/trait.partialeq#method.ne)
[source](https://doc.rust-lang.org/src/core/char/decode.rs.html#29)### impl Eq for DecodeUtf16Error
[source](https://doc.rust-lang.org/src/core/char/decode.rs.html#29)### impl StructuralEq for DecodeUtf16Error
[source](https://doc.rust-lang.org/src/core/char/decode.rs.html#29)### impl StructuralPartialEq for DecodeUtf16Error
Auto Trait Implementations
--------------------------
### impl RefUnwindSafe for DecodeUtf16Error
### impl Send for DecodeUtf16Error
### impl Sync for DecodeUtf16Error
### impl Unpin for DecodeUtf16Error
### impl UnwindSafe for DecodeUtf16Error
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/error.rs.html#197)### impl<E> Provider for Ewhere E: [Error](../error/trait.error "trait std::error::Error") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/error.rs.html#201)#### fn provide(&'a self, demand: &mut Demand<'a>)
🔬This is a nightly-only experimental API. (`provide_any` [#96024](https://github.com/rust-lang/rust/issues/96024))
Data providers should implement this method to provide *all* values they are able to provide by using `demand`. [Read more](../any/trait.provider#tymethod.provide)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/alloc/string.rs.html#2500)### impl<T> ToString for Twhere T: [Display](../fmt/trait.display "trait std::fmt::Display") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/alloc/string.rs.html#2506)#### default fn to\_string(&self) -> String
Converts the given value to a `String`. [Read more](../string/trait.tostring#tymethod.to_string)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
rust Struct std::char::ToLowercase Struct std::char::ToLowercase
=============================
```
pub struct ToLowercase(_);
```
Returns an iterator that yields the lowercase equivalent of a `char`.
This `struct` is created by the [`to_lowercase`](../primitive.char#method.to_lowercase) method on [`char`](../primitive.char "char"). See its documentation for more.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#412)### impl Clone for ToLowercase
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#412)#### fn clone(&self) -> ToLowercase
Notable traits for [ToLowercase](struct.tolowercase "struct std::char::ToLowercase")
```
impl Iterator for ToLowercase
type Item = char;
```
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)#### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#412)### impl Debug for ToLowercase
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#412)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#565)1.16.0 · ### impl Display for ToLowercase
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#566)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.display#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#427)1.59.0 · ### impl DoubleEndedIterator for ToLowercase
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#428)#### fn next\_back(&mut self) -> Option<char>
Removes and returns an element from the end of the iterator. [Read more](../iter/trait.doubleendediterator#tymethod.next_back)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#134)#### fn advance\_back\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator from the back by `n` elements. [Read more](../iter/trait.doubleendediterator#method.advance_back_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#184)1.37.0 · #### fn nth\_back(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element from the end of the iterator. [Read more](../iter/trait.doubleendediterator#method.nth_back)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#221-225)1.27.0 · #### fn try\_rfold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
This is the reverse version of [`Iterator::try_fold()`](../iter/trait.iterator#method.try_fold "Iterator::try_fold()"): it takes elements starting from the back of the iterator. [Read more](../iter/trait.doubleendediterator#method.try_rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#292-295)1.27.0 · #### fn rfold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
An iterator method that reduces the iterator’s elements to a single, final value, starting from the back. [Read more](../iter/trait.doubleendediterator#method.rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#347-350)1.27.0 · #### fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator from the back that satisfies a predicate. [Read more](../iter/trait.doubleendediterator#method.rfind)
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#437)1.35.0 · ### impl ExactSizeIterator for ToLowercase
[source](https://doc.rust-lang.org/src/core/iter/traits/exact_size.rs.html#106)#### fn len(&self) -> usize
Returns the exact remaining length of the iterator. [Read more](../iter/trait.exactsizeiterator#method.len)
[source](https://doc.rust-lang.org/src/core/iter/traits/exact_size.rs.html#138)#### fn is\_empty(&self) -> bool
🔬This is a nightly-only experimental API. (`exact_size_is_empty` [#35428](https://github.com/rust-lang/rust/issues/35428))
Returns `true` if the iterator is empty. [Read more](../iter/trait.exactsizeiterator#method.is_empty)
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#416)### impl Iterator for ToLowercase
#### type Item = char
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#418)#### fn next(&mut self) -> Option<char>
Advances the iterator and returns the next value. [Read more](../iter/trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#421)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](../iter/trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](../iter/trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#252-254)#### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](../iter/trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#282-284)#### fn last(self) -> Option<Self::Item>
Consumes the iterator, returning the last element. [Read more](../iter/trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#328)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](../iter/trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#376)#### fn nth(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element of the iterator. [Read more](../iter/trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](../iter/struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](../iter/trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)#### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](../iter/struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](../iter/trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)#### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](../iter/struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](../iter/trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](../iter/struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](../iter/trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)#### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](../iter/struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](../iter/trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](../iter/trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)#### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](../iter/struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](../iter/trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)#### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](../iter/struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](../iter/trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)#### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](../iter/struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](../iter/trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)#### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](../iter/struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](../iter/struct.peekable#method.peek) and [`peek_mut`](../iter/struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](../iter/trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)#### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](../iter/struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](../iter/trait.iterator#method.skip)s elements based on a predicate. [Read more](../iter/trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)#### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](../iter/struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](../iter/trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](../iter/struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](../iter/trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)#### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](../iter/struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](../iter/trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)#### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](../iter/struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](../iter/trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)#### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](../iter/struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](../iter/trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](../iter/trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)#### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](../iter/struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](../iter/trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)#### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](../iter/struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](../iter/trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)#### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](../iter/struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](../iter/trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)#### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](../iter/trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)#### fn collect<B>(self) -> Bwhere B: [FromIterator](../iter/trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](../iter/trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](../iter/trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)#### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](../iter/trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2079-2082)#### fn partition\_in\_place<'a, T, P>(self, predicate: P) -> usizewhere T: 'a, Self: [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator")<Item = [&'a mut](../primitive.reference) T>, P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_partition_in_place` [#62543](https://github.com/rust-lang/rust/issues/62543))
Reorders the elements of this iterator *in-place* according to the given predicate, such that all those that return `true` precede all those that return `false`. Returns the number of `true` elements found. [Read more](../iter/trait.iterator#method.partition_in_place)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](../iter/trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2230-2234)1.27.0 · #### fn try\_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](../iter/trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](../iter/trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2407-2410)#### fn fold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](../iter/trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](../iter/trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](../iter/trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)#### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)#### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)#### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](../iter/trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](../iter/trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](../iter/trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)#### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](../iter/trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2920-2923)#### fn rposition<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool), Self: [ExactSizeIterator](../iter/trait.exactsizeiterator "trait std::iter::ExactSizeIterator") + [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
Searches for an element in an iterator from the right, returning its index. [Read more](../iter/trait.iterator#method.rposition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](../iter/trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](../iter/trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3161-3163)#### fn rev(self) -> Rev<Self>where Self: [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
Notable traits for [Rev](../iter/struct.rev "struct std::iter::Rev")<I>
```
impl<I> Iterator for Rev<I>where
I: DoubleEndedIterator,
type Item = <I as Iterator>::Item;
```
Reverses an iterator’s direction. [Read more](../iter/trait.iterator#method.rev)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)#### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](../iter/trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](../iter/struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](../iter/trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)#### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](../iter/struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](../iter/trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3312-3314)#### fn cycle(self) -> Cycle<Self>where Self: [Clone](../clone/trait.clone "trait std::clone::Clone"),
Notable traits for [Cycle](../iter/struct.cycle "struct std::iter::Cycle")<I>
```
impl<I> Iterator for Cycle<I>where
I: Clone + Iterator,
type Item = <I as Iterator>::Item;
```
Repeats an iterator endlessly. [Read more](../iter/trait.iterator#method.cycle)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](../iter/struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](../iter/trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](../iter/trait.sum "trait std::iter::Sum")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](../iter/trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](../iter/trait.product "trait std::iter::Product")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](../iter/trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another. [Read more](../iter/trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another. [Read more](../iter/trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](../iter/trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are unequal to those of another. [Read more](../iter/trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](../iter/trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](../iter/trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](../iter/trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](../iter/trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](../iter/trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](../iter/trait.iterator#method.is_sorted_by_key)
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#434)1.26.0 · ### impl FusedIterator for ToLowercase
Auto Trait Implementations
--------------------------
### impl RefUnwindSafe for ToLowercase
### impl Send for ToLowercase
### impl Sync for ToLowercase
### impl Unpin for ToLowercase
### impl UnwindSafe for ToLowercase
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](../iter/trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](../iter/trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/alloc/string.rs.html#2500)### impl<T> ToString for Twhere T: [Display](../fmt/trait.display "trait std::fmt::Display") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/alloc/string.rs.html#2506)#### default fn to\_string(&self) -> String
Converts the given value to a `String`. [Read more](../string/trait.tostring#tymethod.to_string)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Function std::char::from_u32 Function std::char::from\_u32
=============================
```
pub fn from_u32(i: u32) -> Option<char>
```
Converts a `u32` to a `char`. Use [`char::from_u32`](../primitive.char#method.from_u32 "char::from_u32") instead.
rust Function std::char::from_u32_unchecked Function std::char::from\_u32\_unchecked
========================================
```
pub unsafe fn from_u32_unchecked(i: u32) -> char
```
Converts a `u32` to a `char`, ignoring validity. Use [`char::from_u32_unchecked`](../primitive.char#method.from_u32_unchecked "char::from_u32_unchecked"). instead.
rust Struct std::char::ParseCharError Struct std::char::ParseCharError
================================
```
pub struct ParseCharError { /* private fields */ }
```
An error which can be returned when parsing a char.
This `struct` is created when using the [`char::from_str`](../primitive.char#method.from_str "char::from_str") method.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/char/convert.rs.html#149)### impl Clone for ParseCharError
[source](https://doc.rust-lang.org/src/core/char/convert.rs.html#149)#### fn clone(&self) -> ParseCharError
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)1.0.0 · #### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/core/char/convert.rs.html#149)### impl Debug for ParseCharError
[source](https://doc.rust-lang.org/src/core/char/convert.rs.html#149)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/char/convert.rs.html#176)### impl Display for ParseCharError
[source](https://doc.rust-lang.org/src/core/char/convert.rs.html#177)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.display#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/error.rs.html#489)### impl Error for ParseCharError
[source](https://doc.rust-lang.org/src/core/error.rs.html#491)#### fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to\_string()
[Read more](../error/trait.error#method.description)
[source](https://doc.rust-lang.org/src/core/error.rs.html#83)1.30.0 · #### fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. [Read more](../error/trait.error#method.source)
[source](https://doc.rust-lang.org/src/core/error.rs.html#119)1.0.0 · #### fn cause(&self) -> Option<&dyn Error>
👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
[source](https://doc.rust-lang.org/src/core/error.rs.html#193)#### fn provide(&'a self, demand: &mut Demand<'a>)
🔬This is a nightly-only experimental API. (`error_generic_member_access` [#99301](https://github.com/rust-lang/rust/issues/99301))
Provides type based access to context intended for error reports. [Read more](../error/trait.error#method.provide)
[source](https://doc.rust-lang.org/src/core/char/convert.rs.html#149)### impl PartialEq<ParseCharError> for ParseCharError
[source](https://doc.rust-lang.org/src/core/char/convert.rs.html#149)#### fn eq(&self, other: &ParseCharError) -> bool
This method tests for `self` and `other` values to be equal, and is used by `==`. [Read more](../cmp/trait.partialeq#tymethod.eq)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#236)1.0.0 · #### fn ne(&self, other: &Rhs) -> bool
This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. [Read more](../cmp/trait.partialeq#method.ne)
[source](https://doc.rust-lang.org/src/core/char/convert.rs.html#149)### impl Eq for ParseCharError
[source](https://doc.rust-lang.org/src/core/char/convert.rs.html#149)### impl StructuralEq for ParseCharError
[source](https://doc.rust-lang.org/src/core/char/convert.rs.html#149)### impl StructuralPartialEq for ParseCharError
Auto Trait Implementations
--------------------------
### impl RefUnwindSafe for ParseCharError
### impl Send for ParseCharError
### impl Sync for ParseCharError
### impl Unpin for ParseCharError
### impl UnwindSafe for ParseCharError
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/error.rs.html#197)### impl<E> Provider for Ewhere E: [Error](../error/trait.error "trait std::error::Error") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/error.rs.html#201)#### fn provide(&'a self, demand: &mut Demand<'a>)
🔬This is a nightly-only experimental API. (`provide_any` [#96024](https://github.com/rust-lang/rust/issues/96024))
Data providers should implement this method to provide *all* values they are able to provide by using `demand`. [Read more](../any/trait.provider#tymethod.provide)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/alloc/string.rs.html#2500)### impl<T> ToString for Twhere T: [Display](../fmt/trait.display "trait std::fmt::Display") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/alloc/string.rs.html#2506)#### default fn to\_string(&self) -> String
Converts the given value to a `String`. [Read more](../string/trait.tostring#tymethod.to_string)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
rust Struct std::char::ToUppercase Struct std::char::ToUppercase
=============================
```
pub struct ToUppercase(_);
```
Returns an iterator that yields the uppercase equivalent of a `char`.
This `struct` is created by the [`to_uppercase`](../primitive.char#method.to_uppercase) method on [`char`](../primitive.char "char"). See its documentation for more.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#446)### impl Clone for ToUppercase
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#446)#### fn clone(&self) -> ToUppercase
Notable traits for [ToUppercase](struct.touppercase "struct std::char::ToUppercase")
```
impl Iterator for ToUppercase
type Item = char;
```
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)#### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#446)### impl Debug for ToUppercase
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#446)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#572)1.16.0 · ### impl Display for ToUppercase
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#573)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.display#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#461)1.59.0 · ### impl DoubleEndedIterator for ToUppercase
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#462)#### fn next\_back(&mut self) -> Option<char>
Removes and returns an element from the end of the iterator. [Read more](../iter/trait.doubleendediterator#tymethod.next_back)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#134)#### fn advance\_back\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator from the back by `n` elements. [Read more](../iter/trait.doubleendediterator#method.advance_back_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#184)1.37.0 · #### fn nth\_back(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element from the end of the iterator. [Read more](../iter/trait.doubleendediterator#method.nth_back)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#221-225)1.27.0 · #### fn try\_rfold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
This is the reverse version of [`Iterator::try_fold()`](../iter/trait.iterator#method.try_fold "Iterator::try_fold()"): it takes elements starting from the back of the iterator. [Read more](../iter/trait.doubleendediterator#method.try_rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#292-295)1.27.0 · #### fn rfold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
An iterator method that reduces the iterator’s elements to a single, final value, starting from the back. [Read more](../iter/trait.doubleendediterator#method.rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#347-350)1.27.0 · #### fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator from the back that satisfies a predicate. [Read more](../iter/trait.doubleendediterator#method.rfind)
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#471)1.35.0 · ### impl ExactSizeIterator for ToUppercase
[source](https://doc.rust-lang.org/src/core/iter/traits/exact_size.rs.html#106)#### fn len(&self) -> usize
Returns the exact remaining length of the iterator. [Read more](../iter/trait.exactsizeiterator#method.len)
[source](https://doc.rust-lang.org/src/core/iter/traits/exact_size.rs.html#138)#### fn is\_empty(&self) -> bool
🔬This is a nightly-only experimental API. (`exact_size_is_empty` [#35428](https://github.com/rust-lang/rust/issues/35428))
Returns `true` if the iterator is empty. [Read more](../iter/trait.exactsizeiterator#method.is_empty)
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#450)### impl Iterator for ToUppercase
#### type Item = char
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#452)#### fn next(&mut self) -> Option<char>
Advances the iterator and returns the next value. [Read more](../iter/trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#455)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](../iter/trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](../iter/trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#252-254)#### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](../iter/trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#282-284)#### fn last(self) -> Option<Self::Item>
Consumes the iterator, returning the last element. [Read more](../iter/trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#328)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](../iter/trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#376)#### fn nth(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element of the iterator. [Read more](../iter/trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](../iter/struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](../iter/trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)#### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](../iter/struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](../iter/trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)#### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](../iter/struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](../iter/trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](../iter/struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](../iter/trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)#### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](../iter/struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](../iter/trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](../iter/trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)#### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](../iter/struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](../iter/trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)#### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](../iter/struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](../iter/trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)#### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](../iter/struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](../iter/trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)#### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](../iter/struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](../iter/struct.peekable#method.peek) and [`peek_mut`](../iter/struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](../iter/trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)#### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](../iter/struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](../iter/trait.iterator#method.skip)s elements based on a predicate. [Read more](../iter/trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)#### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](../iter/struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](../iter/trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](../iter/struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](../iter/trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)#### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](../iter/struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](../iter/trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)#### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](../iter/struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](../iter/trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)#### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](../iter/struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](../iter/trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](../iter/trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)#### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](../iter/struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](../iter/trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)#### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](../iter/struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](../iter/trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)#### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](../iter/struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](../iter/trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)#### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](../iter/trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)#### fn collect<B>(self) -> Bwhere B: [FromIterator](../iter/trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](../iter/trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](../iter/trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)#### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](../iter/trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2079-2082)#### fn partition\_in\_place<'a, T, P>(self, predicate: P) -> usizewhere T: 'a, Self: [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator")<Item = [&'a mut](../primitive.reference) T>, P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_partition_in_place` [#62543](https://github.com/rust-lang/rust/issues/62543))
Reorders the elements of this iterator *in-place* according to the given predicate, such that all those that return `true` precede all those that return `false`. Returns the number of `true` elements found. [Read more](../iter/trait.iterator#method.partition_in_place)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](../iter/trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2230-2234)1.27.0 · #### fn try\_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](../iter/trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](../iter/trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2407-2410)#### fn fold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](../iter/trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](../iter/trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](../iter/trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)#### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)#### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)#### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](../iter/trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](../iter/trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](../iter/trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)#### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](../iter/trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2920-2923)#### fn rposition<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool), Self: [ExactSizeIterator](../iter/trait.exactsizeiterator "trait std::iter::ExactSizeIterator") + [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
Searches for an element in an iterator from the right, returning its index. [Read more](../iter/trait.iterator#method.rposition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](../iter/trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](../iter/trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3161-3163)#### fn rev(self) -> Rev<Self>where Self: [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
Notable traits for [Rev](../iter/struct.rev "struct std::iter::Rev")<I>
```
impl<I> Iterator for Rev<I>where
I: DoubleEndedIterator,
type Item = <I as Iterator>::Item;
```
Reverses an iterator’s direction. [Read more](../iter/trait.iterator#method.rev)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)#### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](../iter/trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](../iter/struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](../iter/trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)#### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](../iter/struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](../iter/trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3312-3314)#### fn cycle(self) -> Cycle<Self>where Self: [Clone](../clone/trait.clone "trait std::clone::Clone"),
Notable traits for [Cycle](../iter/struct.cycle "struct std::iter::Cycle")<I>
```
impl<I> Iterator for Cycle<I>where
I: Clone + Iterator,
type Item = <I as Iterator>::Item;
```
Repeats an iterator endlessly. [Read more](../iter/trait.iterator#method.cycle)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](../iter/struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](../iter/trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](../iter/trait.sum "trait std::iter::Sum")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](../iter/trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](../iter/trait.product "trait std::iter::Product")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](../iter/trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another. [Read more](../iter/trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another. [Read more](../iter/trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](../iter/trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are unequal to those of another. [Read more](../iter/trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](../iter/trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](../iter/trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](../iter/trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](../iter/trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](../iter/trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](../iter/trait.iterator#method.is_sorted_by_key)
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#468)1.26.0 · ### impl FusedIterator for ToUppercase
Auto Trait Implementations
--------------------------
### impl RefUnwindSafe for ToUppercase
### impl Send for ToUppercase
### impl Sync for ToUppercase
### impl Unpin for ToUppercase
### impl UnwindSafe for ToUppercase
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](../iter/trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](../iter/trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/alloc/string.rs.html#2500)### impl<T> ToString for Twhere T: [Display](../fmt/trait.display "trait std::fmt::Display") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/alloc/string.rs.html#2506)#### default fn to\_string(&self) -> String
Converts the given value to a `String`. [Read more](../string/trait.tostring#tymethod.to_string)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Struct std::char::EscapeDefault Struct std::char::EscapeDefault
===============================
```
pub struct EscapeDefault { /* private fields */ }
```
An iterator that yields the literal escape code of a `char`.
This `struct` is created by the [`escape_default`](../primitive.char#method.escape_default) method on [`char`](../primitive.char "char"). See its documentation for more.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#269)### impl Clone for EscapeDefault
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#269)#### fn clone(&self) -> EscapeDefault
Notable traits for [EscapeDefault](struct.escapedefault "struct std::char::EscapeDefault")
```
impl Iterator for EscapeDefault
type Item = char;
```
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)#### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#269)### impl Debug for EscapeDefault
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#269)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#362)1.16.0 · ### impl Display for EscapeDefault
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#363)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.display#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#347)1.11.0 · ### impl ExactSizeIterator for EscapeDefault
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#348)#### fn len(&self) -> usize
Returns the exact remaining length of the iterator. [Read more](../iter/trait.exactsizeiterator#method.len)
[source](https://doc.rust-lang.org/src/core/iter/traits/exact_size.rs.html#138)#### fn is\_empty(&self) -> bool
🔬This is a nightly-only experimental API. (`exact_size_is_empty` [#35428](https://github.com/rust-lang/rust/issues/35428))
Returns `true` if the iterator is empty. [Read more](../iter/trait.exactsizeiterator#method.is_empty)
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#284)### impl Iterator for EscapeDefault
#### type Item = char
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#287)#### fn next(&mut self) -> Option<char>
Advances the iterator and returns the next value. [Read more](../iter/trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#303)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](../iter/trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#309)#### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](../iter/trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#313)#### fn nth(&mut self, n: usize) -> Option<char>
Returns the `n`th element of the iterator. [Read more](../iter/trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#337)#### fn last(self) -> Option<char>
Consumes the iterator, returning the last element. [Read more](../iter/trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](../iter/trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#328)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](../iter/trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](../iter/struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](../iter/trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)#### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](../iter/struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](../iter/trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)#### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](../iter/struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](../iter/trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](../iter/struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](../iter/trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)#### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](../iter/struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](../iter/trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](../iter/trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)#### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](../iter/struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](../iter/trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)#### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](../iter/struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](../iter/trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)#### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](../iter/struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](../iter/trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)#### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](../iter/struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](../iter/struct.peekable#method.peek) and [`peek_mut`](../iter/struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](../iter/trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)#### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](../iter/struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](../iter/trait.iterator#method.skip)s elements based on a predicate. [Read more](../iter/trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)#### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](../iter/struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](../iter/trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](../iter/struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](../iter/trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)#### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](../iter/struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](../iter/trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)#### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](../iter/struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](../iter/trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)#### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](../iter/struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](../iter/trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](../iter/trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)#### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](../iter/struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](../iter/trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)#### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](../iter/struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](../iter/trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)#### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](../iter/struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](../iter/trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)#### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](../iter/trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)#### fn collect<B>(self) -> Bwhere B: [FromIterator](../iter/trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](../iter/trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](../iter/trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)#### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](../iter/trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](../iter/trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2230-2234)1.27.0 · #### fn try\_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](../iter/trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](../iter/trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2407-2410)#### fn fold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](../iter/trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](../iter/trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](../iter/trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)#### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)#### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)#### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](../iter/trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](../iter/trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](../iter/trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)#### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](../iter/trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](../iter/trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](../iter/trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)#### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](../iter/trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](../iter/struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](../iter/trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)#### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](../iter/struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](../iter/trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3312-3314)#### fn cycle(self) -> Cycle<Self>where Self: [Clone](../clone/trait.clone "trait std::clone::Clone"),
Notable traits for [Cycle](../iter/struct.cycle "struct std::iter::Cycle")<I>
```
impl<I> Iterator for Cycle<I>where
I: Clone + Iterator,
type Item = <I as Iterator>::Item;
```
Repeats an iterator endlessly. [Read more](../iter/trait.iterator#method.cycle)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](../iter/struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](../iter/trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](../iter/trait.sum "trait std::iter::Sum")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](../iter/trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](../iter/trait.product "trait std::iter::Product")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](../iter/trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another. [Read more](../iter/trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another. [Read more](../iter/trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](../iter/trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are unequal to those of another. [Read more](../iter/trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](../iter/trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](../iter/trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](../iter/trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](../iter/trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](../iter/trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](../iter/trait.iterator#method.is_sorted_by_key)
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#359)1.26.0 · ### impl FusedIterator for EscapeDefault
Auto Trait Implementations
--------------------------
### impl RefUnwindSafe for EscapeDefault
### impl Send for EscapeDefault
### impl Sync for EscapeDefault
### impl Unpin for EscapeDefault
### impl UnwindSafe for EscapeDefault
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](../iter/trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](../iter/trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/alloc/string.rs.html#2500)### impl<T> ToString for Twhere T: [Display](../fmt/trait.display "trait std::fmt::Display") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/alloc/string.rs.html#2506)#### default fn to\_string(&self) -> String
Converts the given value to a `String`. [Read more](../string/trait.tostring#tymethod.to_string)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Trait std::alloc::Allocator Trait std::alloc::Allocator
===========================
```
pub unsafe trait Allocator {
fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>;
unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: Layout);
fn allocate_zeroed( &self, layout: Layout ) -> Result<NonNull<[u8]>, AllocError> { ... }
unsafe fn grow( &self, ptr: NonNull<u8>, old_layout: Layout, new_layout: Layout ) -> Result<NonNull<[u8]>, AllocError> { ... }
unsafe fn grow_zeroed( &self, ptr: NonNull<u8>, old_layout: Layout, new_layout: Layout ) -> Result<NonNull<[u8]>, AllocError> { ... }
unsafe fn shrink( &self, ptr: NonNull<u8>, old_layout: Layout, new_layout: Layout ) -> Result<NonNull<[u8]>, AllocError> { ... }
fn by_ref(&self) -> &Self { ... }
}
```
🔬This is a nightly-only experimental API. (`allocator_api` [#32838](https://github.com/rust-lang/rust/issues/32838))
An implementation of `Allocator` can allocate, grow, shrink, and deallocate arbitrary blocks of data described via [`Layout`](struct.layout "Layout").
`Allocator` is designed to be implemented on ZSTs, references, or smart pointers because having an allocator like `MyAlloc([u8; N])` cannot be moved, without updating the pointers to the allocated memory.
Unlike [`GlobalAlloc`](trait.globalalloc "GlobalAlloc"), zero-sized allocations are allowed in `Allocator`. If an underlying allocator does not support this (like jemalloc) or return a null pointer (such as `libc::malloc`), this must be caught by the implementation.
#### Currently allocated memory
Some of the methods require that a memory block be *currently allocated* via an allocator. This means that:
* the starting address for that memory block was previously returned by [`allocate`](trait.allocator#tymethod.allocate), [`grow`](trait.allocator#method.grow), or [`shrink`](trait.allocator#method.shrink), and
* the memory block has not been subsequently deallocated, where blocks are either deallocated directly by being passed to [`deallocate`](trait.allocator#tymethod.deallocate) or were changed by being passed to [`grow`](trait.allocator#method.grow) or [`shrink`](trait.allocator#method.shrink) that returns `Ok`. If `grow` or `shrink` have returned `Err`, the passed pointer remains valid.
#### Memory fitting
Some of the methods require that a layout *fit* a memory block. What it means for a layout to “fit” a memory block means (or equivalently, for a memory block to “fit” a layout) is that the following conditions must hold:
* The block must be allocated with the same alignment as [`layout.align()`](struct.layout#method.align), and
* The provided [`layout.size()`](struct.layout#method.size) must fall in the range `min ..= max`, where:
+ `min` is the size of the layout most recently used to allocate the block, and
+ `max` is the latest actual size returned from [`allocate`](trait.allocator#tymethod.allocate), [`grow`](trait.allocator#method.grow), or [`shrink`](trait.allocator#method.shrink).
Safety
------
* Memory blocks returned from an allocator must point to valid memory and retain their validity until the instance and all of its clones are dropped,
* cloning or moving the allocator must not invalidate memory blocks returned from this allocator. A cloned allocator must behave like the same allocator, and
* any pointer to a memory block which is [*currently allocated*](#currently-allocated-memory) may be passed to any other method of the allocator.
Required Methods
----------------
[source](https://doc.rust-lang.org/src/core/alloc/mod.rs.html#131)#### fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
🔬This is a nightly-only experimental API. (`allocator_api` [#32838](https://github.com/rust-lang/rust/issues/32838))
Attempts to allocate a block of memory.
On success, returns a [`NonNull<[u8]>`](../ptr/struct.nonnull "NonNull") meeting the size and alignment guarantees of `layout`.
The returned block may have a larger size than specified by `layout.size()`, and may or may not have its contents initialized.
##### Errors
Returning `Err` indicates that either memory is exhausted or `layout` does not meet allocator’s size or alignment constraints.
Implementations are encouraged to return `Err` on memory exhaustion rather than panicking or aborting, but this is not a strict requirement. (Specifically: it is *legal* to implement this trait atop an underlying native allocation library that aborts on memory exhaustion.)
Clients wishing to abort computation in response to an allocation error are encouraged to call the [`handle_alloc_error`](https://doc.rust-lang.org/alloc/alloc/fn.handle_alloc_error.html) function, rather than directly invoking `panic!` or similar.
[source](https://doc.rust-lang.org/src/core/alloc/mod.rs.html#164)#### unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: Layout)
🔬This is a nightly-only experimental API. (`allocator_api` [#32838](https://github.com/rust-lang/rust/issues/32838))
Deallocates the memory referenced by `ptr`.
##### Safety
* `ptr` must denote a block of memory [*currently allocated*](#currently-allocated-memory) via this allocator, and
* `layout` must [*fit*](#memory-fitting) that block of memory.
Provided Methods
----------------
[source](https://doc.rust-lang.org/src/core/alloc/mod.rs.html#148)#### fn allocate\_zeroed(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
🔬This is a nightly-only experimental API. (`allocator_api` [#32838](https://github.com/rust-lang/rust/issues/32838))
Behaves like `allocate`, but also ensures that the returned memory is zero-initialized.
##### Errors
Returning `Err` indicates that either memory is exhausted or `layout` does not meet allocator’s size or alignment constraints.
Implementations are encouraged to return `Err` on memory exhaustion rather than panicking or aborting, but this is not a strict requirement. (Specifically: it is *legal* to implement this trait atop an underlying native allocation library that aborts on memory exhaustion.)
Clients wishing to abort computation in response to an allocation error are encouraged to call the [`handle_alloc_error`](https://doc.rust-lang.org/alloc/alloc/fn.handle_alloc_error.html) function, rather than directly invoking `panic!` or similar.
[source](https://doc.rust-lang.org/src/core/alloc/mod.rs.html#203-208)#### unsafe fn grow( &self, ptr: NonNull<u8>, old\_layout: Layout, new\_layout: Layout) -> Result<NonNull<[u8]>, AllocError>
🔬This is a nightly-only experimental API. (`allocator_api` [#32838](https://github.com/rust-lang/rust/issues/32838))
Attempts to extend the memory block.
Returns a new [`NonNull<[u8]>`](../ptr/struct.nonnull "NonNull") containing a pointer and the actual size of the allocated memory. The pointer is suitable for holding data described by `new_layout`. To accomplish this, the allocator may extend the allocation referenced by `ptr` to fit the new layout.
If this returns `Ok`, then ownership of the memory block referenced by `ptr` has been transferred to this allocator. The memory may or may not have been freed, and should be considered unusable.
If this method returns `Err`, then ownership of the memory block has not been transferred to this allocator, and the contents of the memory block are unaltered.
##### Safety
* `ptr` must denote a block of memory [*currently allocated*](#currently-allocated-memory) via this allocator.
* `old_layout` must [*fit*](#memory-fitting) that block of memory (The `new_layout` argument need not fit it.).
* `new_layout.size()` must be greater than or equal to `old_layout.size()`.
Note that `new_layout.align()` need not be the same as `old_layout.align()`.
##### Errors
Returns `Err` if the new layout does not meet the allocator’s size and alignment constraints of the allocator, or if growing otherwise fails.
Implementations are encouraged to return `Err` on memory exhaustion rather than panicking or aborting, but this is not a strict requirement. (Specifically: it is *legal* to implement this trait atop an underlying native allocation library that aborts on memory exhaustion.)
Clients wishing to abort computation in response to an allocation error are encouraged to call the [`handle_alloc_error`](https://doc.rust-lang.org/alloc/alloc/fn.handle_alloc_error.html) function, rather than directly invoking `panic!` or similar.
[source](https://doc.rust-lang.org/src/core/alloc/mod.rs.html#266-271)#### unsafe fn grow\_zeroed( &self, ptr: NonNull<u8>, old\_layout: Layout, new\_layout: Layout) -> Result<NonNull<[u8]>, AllocError>
🔬This is a nightly-only experimental API. (`allocator_api` [#32838](https://github.com/rust-lang/rust/issues/32838))
Behaves like `grow`, but also ensures that the new contents are set to zero before being returned.
The memory block will contain the following contents after a successful call to `grow_zeroed`:
* Bytes `0..old_layout.size()` are preserved from the original allocation.
* Bytes `old_layout.size()..old_size` will either be preserved or zeroed, depending on the allocator implementation. `old_size` refers to the size of the memory block prior to the `grow_zeroed` call, which may be larger than the size that was originally requested when it was allocated.
* Bytes `old_size..new_size` are zeroed. `new_size` refers to the size of the memory block returned by the `grow_zeroed` call.
##### Safety
* `ptr` must denote a block of memory [*currently allocated*](#currently-allocated-memory) via this allocator.
* `old_layout` must [*fit*](#memory-fitting) that block of memory (The `new_layout` argument need not fit it.).
* `new_layout.size()` must be greater than or equal to `old_layout.size()`.
Note that `new_layout.align()` need not be the same as `old_layout.align()`.
##### Errors
Returns `Err` if the new layout does not meet the allocator’s size and alignment constraints of the allocator, or if growing otherwise fails.
Implementations are encouraged to return `Err` on memory exhaustion rather than panicking or aborting, but this is not a strict requirement. (Specifically: it is *legal* to implement this trait atop an underlying native allocation library that aborts on memory exhaustion.)
Clients wishing to abort computation in response to an allocation error are encouraged to call the [`handle_alloc_error`](https://doc.rust-lang.org/alloc/alloc/fn.handle_alloc_error.html) function, rather than directly invoking `panic!` or similar.
[source](https://doc.rust-lang.org/src/core/alloc/mod.rs.html#329-334)#### unsafe fn shrink( &self, ptr: NonNull<u8>, old\_layout: Layout, new\_layout: Layout) -> Result<NonNull<[u8]>, AllocError>
🔬This is a nightly-only experimental API. (`allocator_api` [#32838](https://github.com/rust-lang/rust/issues/32838))
Attempts to shrink the memory block.
Returns a new [`NonNull<[u8]>`](../ptr/struct.nonnull "NonNull") containing a pointer and the actual size of the allocated memory. The pointer is suitable for holding data described by `new_layout`. To accomplish this, the allocator may shrink the allocation referenced by `ptr` to fit the new layout.
If this returns `Ok`, then ownership of the memory block referenced by `ptr` has been transferred to this allocator. The memory may or may not have been freed, and should be considered unusable.
If this method returns `Err`, then ownership of the memory block has not been transferred to this allocator, and the contents of the memory block are unaltered.
##### Safety
* `ptr` must denote a block of memory [*currently allocated*](#currently-allocated-memory) via this allocator.
* `old_layout` must [*fit*](#memory-fitting) that block of memory (The `new_layout` argument need not fit it.).
* `new_layout.size()` must be smaller than or equal to `old_layout.size()`.
Note that `new_layout.align()` need not be the same as `old_layout.align()`.
##### Errors
Returns `Err` if the new layout does not meet the allocator’s size and alignment constraints of the allocator, or if shrinking otherwise fails.
Implementations are encouraged to return `Err` on memory exhaustion rather than panicking or aborting, but this is not a strict requirement. (Specifically: it is *legal* to implement this trait atop an underlying native allocation library that aborts on memory exhaustion.)
Clients wishing to abort computation in response to an allocation error are encouraged to call the [`handle_alloc_error`](https://doc.rust-lang.org/alloc/alloc/fn.handle_alloc_error.html) function, rather than directly invoking `panic!` or similar.
[source](https://doc.rust-lang.org/src/core/alloc/mod.rs.html#359-361)#### fn by\_ref(&self) -> &Self
🔬This is a nightly-only experimental API. (`allocator_api` [#32838](https://github.com/rust-lang/rust/issues/32838))
Creates a “by reference” adapter for this instance of `Allocator`.
The returned adapter also implements `Allocator` and will simply borrow this.
Implementors
------------
[source](https://doc.rust-lang.org/src/alloc/alloc.rs.html#234)### impl Allocator for Global
[source](https://doc.rust-lang.org/src/std/alloc.rs.html#203-287)### impl Allocator for System
[source](https://doc.rust-lang.org/src/core/alloc/mod.rs.html#368)### impl<A> Allocator for &Awhere A: [Allocator](trait.allocator "trait std::alloc::Allocator") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
rust Struct std::alloc::System Struct std::alloc::System
=========================
```
pub struct System;
```
The default memory allocator provided by the operating system.
This is based on `malloc` on Unix platforms and `HeapAlloc` on Windows, plus related functions. However, it is not valid to mix use of the backing system allocator with `System`, as this implementation may include extra work, such as to serve alignment requests greater than the alignment provided directly by the backing system allocator.
This type implements the `GlobalAlloc` trait and Rust programs by default work as if they had this definition:
```
use std::alloc::System;
#[global_allocator]
static A: System = System;
fn main() {
let a = Box::new(4); // Allocates from the system allocator.
println!("{a}");
}
```
You can also define your own wrapper around `System` if you’d like, such as keeping track of the number of all bytes allocated:
```
use std::alloc::{System, GlobalAlloc, Layout};
use std::sync::atomic::{AtomicUsize, Ordering::SeqCst};
struct Counter;
static ALLOCATED: AtomicUsize = AtomicUsize::new(0);
unsafe impl GlobalAlloc for Counter {
unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
let ret = System.alloc(layout);
if !ret.is_null() {
ALLOCATED.fetch_add(layout.size(), SeqCst);
}
ret
}
unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) {
System.dealloc(ptr, layout);
ALLOCATED.fetch_sub(layout.size(), SeqCst);
}
}
#[global_allocator]
static A: Counter = Counter;
fn main() {
println!("allocated bytes before main: {}", ALLOCATED.load(SeqCst));
}
```
It can also be used directly to allocate memory independently of whatever global allocator has been selected for a Rust program. For example if a Rust program opts in to using jemalloc as the global allocator, `System` will still allocate memory using `malloc` and `HeapAlloc`.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/std/alloc.rs.html#203-287)### impl Allocator for System
[source](https://doc.rust-lang.org/src/std/alloc.rs.html#205-207)#### fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
🔬This is a nightly-only experimental API. (`allocator_api` [#32838](https://github.com/rust-lang/rust/issues/32838))
Attempts to allocate a block of memory. [Read more](trait.allocator#tymethod.allocate)
[source](https://doc.rust-lang.org/src/std/alloc.rs.html#210-212)#### fn allocate\_zeroed(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
🔬This is a nightly-only experimental API. (`allocator_api` [#32838](https://github.com/rust-lang/rust/issues/32838))
Behaves like `allocate`, but also ensures that the returned memory is zero-initialized. [Read more](trait.allocator#method.allocate_zeroed)
[source](https://doc.rust-lang.org/src/std/alloc.rs.html#215-221)#### unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: Layout)
🔬This is a nightly-only experimental API. (`allocator_api` [#32838](https://github.com/rust-lang/rust/issues/32838))
Deallocates the memory referenced by `ptr`. [Read more](trait.allocator#tymethod.deallocate)
[source](https://doc.rust-lang.org/src/std/alloc.rs.html#224-232)#### unsafe fn grow( &self, ptr: NonNull<u8>, old\_layout: Layout, new\_layout: Layout) -> Result<NonNull<[u8]>, AllocError>
🔬This is a nightly-only experimental API. (`allocator_api` [#32838](https://github.com/rust-lang/rust/issues/32838))
Attempts to extend the memory block. [Read more](trait.allocator#method.grow)
[source](https://doc.rust-lang.org/src/std/alloc.rs.html#235-243)#### unsafe fn grow\_zeroed( &self, ptr: NonNull<u8>, old\_layout: Layout, new\_layout: Layout) -> Result<NonNull<[u8]>, AllocError>
🔬This is a nightly-only experimental API. (`allocator_api` [#32838](https://github.com/rust-lang/rust/issues/32838))
Behaves like `grow`, but also ensures that the new contents are set to zero before being returned. [Read more](trait.allocator#method.grow_zeroed)
[source](https://doc.rust-lang.org/src/std/alloc.rs.html#246-286)#### unsafe fn shrink( &self, ptr: NonNull<u8>, old\_layout: Layout, new\_layout: Layout) -> Result<NonNull<[u8]>, AllocError>
🔬This is a nightly-only experimental API. (`allocator_api` [#32838](https://github.com/rust-lang/rust/issues/32838))
Attempts to shrink the memory block. [Read more](trait.allocator#method.shrink)
[source](https://doc.rust-lang.org/src/core/alloc/mod.rs.html#359-361)#### fn by\_ref(&self) -> &Self
🔬This is a nightly-only experimental API. (`allocator_api` [#32838](https://github.com/rust-lang/rust/issues/32838))
Creates a “by reference” adapter for this instance of `Allocator`. [Read more](trait.allocator#method.by_ref)
[source](https://doc.rust-lang.org/src/std/alloc.rs.html#130)### impl Clone for System
[source](https://doc.rust-lang.org/src/std/alloc.rs.html#130)#### fn clone(&self) -> System
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)1.0.0 · #### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/std/alloc.rs.html#130)### impl Debug for System
[source](https://doc.rust-lang.org/src/std/alloc.rs.html#130)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/std/alloc.rs.html#130)### impl Default for System
[source](https://doc.rust-lang.org/src/std/alloc.rs.html#130)#### fn default() -> System
Returns the “default value” for a type. [Read more](../default/trait.default#tymethod.default)
[source](https://doc.rust-lang.org/src/std/sys/unix/alloc.rs.html#6-53)### impl GlobalAlloc for System
[source](https://doc.rust-lang.org/src/std/sys/unix/alloc.rs.html#8-24)#### unsafe fn alloc(&self, layout: Layout) -> \*mut u8
Allocate memory as described by the given `layout`. [Read more](trait.globalalloc#tymethod.alloc)
[source](https://doc.rust-lang.org/src/std/sys/unix/alloc.rs.html#27-38)#### unsafe fn alloc\_zeroed(&self, layout: Layout) -> \*mut u8
Behaves like `alloc`, but also ensures that the contents are set to zero before being returned. [Read more](trait.globalalloc#method.alloc_zeroed)
[source](https://doc.rust-lang.org/src/std/sys/unix/alloc.rs.html#41-43)#### unsafe fn dealloc(&self, ptr: \*mut u8, \_layout: Layout)
Deallocate the block of memory at the given `ptr` pointer with the given `layout`. [Read more](trait.globalalloc#tymethod.dealloc)
[source](https://doc.rust-lang.org/src/std/sys/unix/alloc.rs.html#46-52)#### unsafe fn realloc(&self, ptr: \*mut u8, layout: Layout, new\_size: usize) -> \*mut u8
Shrink or grow a block of memory to the given `new_size`. The block is described by the given `ptr` pointer and `layout`. [Read more](trait.globalalloc#method.realloc)
[source](https://doc.rust-lang.org/src/std/alloc.rs.html#130)### impl Copy for System
Auto Trait Implementations
--------------------------
### impl RefUnwindSafe for System
### impl Send for System
### impl Sync for System
### impl Unpin for System
### impl UnwindSafe for System
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Module std::alloc Module std::alloc
=================
Memory allocation APIs.
In a given program, the standard library has one “global” memory allocator that is used for example by `Box<T>` and `Vec<T>`.
Currently the default global allocator is unspecified. Libraries, however, like `cdylib`s and `staticlib`s are guaranteed to use the [`System`](struct.system "System") by default.
The `#[global_allocator]` attribute
-----------------------------------
This attribute allows configuring the choice of global allocator. You can use this to implement a completely custom global allocator to route all default allocation requests to a custom object.
```
use std::alloc::{GlobalAlloc, System, Layout};
struct MyAllocator;
unsafe impl GlobalAlloc for MyAllocator {
unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
System.alloc(layout)
}
unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) {
System.dealloc(ptr, layout)
}
}
#[global_allocator]
static GLOBAL: MyAllocator = MyAllocator;
fn main() {
// This `Vec` will allocate memory through `GLOBAL` above
let mut v = Vec::new();
v.push(1);
}
```
The attribute is used on a `static` item whose type implements the [`GlobalAlloc`](trait.globalalloc "GlobalAlloc") trait. This type can be provided by an external library:
ⓘ
```
use jemallocator::Jemalloc;
#[global_allocator]
static GLOBAL: Jemalloc = Jemalloc;
fn main() {}
```
The `#[global_allocator]` can only be used once in a crate or its recursive dependencies.
Structs
-------
[AllocError](struct.allocerror "std::alloc::AllocError struct")Experimental
The `AllocError` error indicates an allocation failure that may be due to resource exhaustion or to something wrong when combining the given input arguments with this allocator.
[Global](struct.global "std::alloc::Global struct")Experimental
The global memory allocator.
[Layout](struct.layout "std::alloc::Layout struct")
Layout of a block of memory.
[LayoutError](struct.layouterror "std::alloc::LayoutError struct")
The parameters given to `Layout::from_size_align` or some other `Layout` constructor do not satisfy its documented constraints.
[System](struct.system "std::alloc::System struct")
The default memory allocator provided by the operating system.
Traits
------
[Allocator](trait.allocator "std::alloc::Allocator trait")Experimental
An implementation of `Allocator` can allocate, grow, shrink, and deallocate arbitrary blocks of data described via [`Layout`](struct.layout "Layout").
[GlobalAlloc](trait.globalalloc "std::alloc::GlobalAlloc trait")
A memory allocator that can be registered as the standard library’s default through the `#[global_allocator]` attribute.
Functions
---------
[set\_alloc\_error\_hook](fn.set_alloc_error_hook "std::alloc::set_alloc_error_hook fn")Experimental
Registers a custom allocation error hook, replacing any that was previously registered.
[take\_alloc\_error\_hook](fn.take_alloc_error_hook "std::alloc::take_alloc_error_hook fn")Experimental
Unregisters the current allocation error hook, returning it.
[alloc](fn.alloc "std::alloc::alloc fn")[⚠](# "unsafe function")
Allocate memory with the global allocator.
[alloc\_zeroed](fn.alloc_zeroed "std::alloc::alloc_zeroed fn")[⚠](# "unsafe function")
Allocate zero-initialized memory with the global allocator.
[dealloc](fn.dealloc "std::alloc::dealloc fn")[⚠](# "unsafe function")
Deallocate memory with the global allocator.
[handle\_alloc\_error](fn.handle_alloc_error "std::alloc::handle_alloc_error fn")
Abort on memory allocation error or failure.
[realloc](fn.realloc "std::alloc::realloc fn")[⚠](# "unsafe function")
Reallocate memory with the global allocator.
Type Definitions
----------------
[LayoutErr](type.layouterr "std::alloc::LayoutErr type")Deprecated
rust Function std::alloc::handle_alloc_error Function std::alloc::handle\_alloc\_error
=========================================
```
pub fn handle_alloc_error(layout: Layout) -> !
```
Abort on memory allocation error or failure.
Callers of memory allocation APIs wishing to abort computation in response to an allocation error are encouraged to call this function, rather than directly invoking `panic!` or similar.
The default behavior of this function is to print a message to standard error and abort the process. It can be replaced with [`set_alloc_error_hook`](fn.set_alloc_error_hook) and [`take_alloc_error_hook`](fn.take_alloc_error_hook).
rust Trait std::alloc::GlobalAlloc Trait std::alloc::GlobalAlloc
=============================
```
pub unsafe trait GlobalAlloc {
unsafe fn alloc(&self, layout: Layout) -> *mut u8;
unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout);
unsafe fn alloc_zeroed(&self, layout: Layout) -> *mut u8 { ... }
unsafe fn realloc( &self, ptr: *mut u8, layout: Layout, new_size: usize ) -> *mut u8 { ... }
}
```
A memory allocator that can be registered as the standard library’s default through the `#[global_allocator]` attribute.
Some of the methods require that a memory block be *currently allocated* via an allocator. This means that:
* the starting address for that memory block was previously returned by a previous call to an allocation method such as `alloc`, and
* the memory block has not been subsequently deallocated, where blocks are deallocated either by being passed to a deallocation method such as `dealloc` or by being passed to a reallocation method that returns a non-null pointer.
Example
-------
```
use std::alloc::{GlobalAlloc, Layout};
use std::cell::UnsafeCell;
use std::ptr::null_mut;
use std::sync::atomic::{
AtomicUsize,
Ordering::{Acquire, SeqCst},
};
const ARENA_SIZE: usize = 128 * 1024;
const MAX_SUPPORTED_ALIGN: usize = 4096;
#[repr(C, align(4096))] // 4096 == MAX_SUPPORTED_ALIGN
struct SimpleAllocator {
arena: UnsafeCell<[u8; ARENA_SIZE]>,
remaining: AtomicUsize, // we allocate from the top, counting down
}
#[global_allocator]
static ALLOCATOR: SimpleAllocator = SimpleAllocator {
arena: UnsafeCell::new([0x55; ARENA_SIZE]),
remaining: AtomicUsize::new(ARENA_SIZE),
};
unsafe impl Sync for SimpleAllocator {}
unsafe impl GlobalAlloc for SimpleAllocator {
unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
let size = layout.size();
let align = layout.align();
// `Layout` contract forbids making a `Layout` with align=0, or align not power of 2.
// So we can safely use a mask to ensure alignment without worrying about UB.
let align_mask_to_round_down = !(align - 1);
if align > MAX_SUPPORTED_ALIGN {
return null_mut();
}
let mut allocated = 0;
if self
.remaining
.fetch_update(SeqCst, SeqCst, |mut remaining| {
if size > remaining {
return None;
}
remaining -= size;
remaining &= align_mask_to_round_down;
allocated = remaining;
Some(remaining)
})
.is_err()
{
return null_mut();
};
self.arena.get().cast::<u8>().add(allocated)
}
unsafe fn dealloc(&self, _ptr: *mut u8, _layout: Layout) {}
}
fn main() {
let _s = format!("allocating a string!");
let currently = ALLOCATOR.remaining.load(Acquire);
println!("allocated so far: {}", ARENA_SIZE - currently);
}
```
Safety
------
The `GlobalAlloc` trait is an `unsafe` trait for a number of reasons, and implementors must ensure that they adhere to these contracts:
* It’s undefined behavior if global allocators unwind. This restriction may be lifted in the future, but currently a panic from any of these functions may lead to memory unsafety.
* `Layout` queries and calculations in general must be correct. Callers of this trait are allowed to rely on the contracts defined on each method, and implementors must ensure such contracts remain true.
* You must not rely on allocations actually happening, even if there are explicit heap allocations in the source. The optimizer may detect unused allocations that it can either eliminate entirely or move to the stack and thus never invoke the allocator. The optimizer may further assume that allocation is infallible, so code that used to fail due to allocator failures may now suddenly work because the optimizer worked around the need for an allocation. More concretely, the following code example is unsound, irrespective of whether your custom allocator allows counting how many allocations have happened.
ⓘ
```
drop(Box::new(42));
let number_of_heap_allocs = /* call private allocator API */;
unsafe { std::intrinsics::assume(number_of_heap_allocs > 0); }
```
Note that the optimizations mentioned above are not the only optimization that can be applied. You may generally not rely on heap allocations happening if they can be removed without changing program behavior. Whether allocations happen or not is not part of the program behavior, even if it could be detected via an allocator that tracks allocations by printing or otherwise having side effects.
Required Methods
----------------
[source](https://doc.rust-lang.org/src/core/alloc/global.rs.html#157)#### unsafe fn alloc(&self, layout: Layout) -> \*mut u8
Allocate memory as described by the given `layout`.
Returns a pointer to newly-allocated memory, or null to indicate allocation failure.
##### Safety
This function is unsafe because undefined behavior can result if the caller does not ensure that `layout` has non-zero size.
(Extension subtraits might provide more specific bounds on behavior, e.g., guarantee a sentinel address or a null pointer in response to a zero-size allocation request.)
The allocated block of memory may or may not be initialized.
##### Errors
Returning a null pointer indicates that either memory is exhausted or `layout` does not meet this allocator’s size or alignment constraints.
Implementations are encouraged to return null on memory exhaustion rather than aborting, but this is not a strict requirement. (Specifically: it is *legal* to implement this trait atop an underlying native allocation library that aborts on memory exhaustion.)
Clients wishing to abort computation in response to an allocation error are encouraged to call the [`handle_alloc_error`](https://doc.rust-lang.org/alloc/alloc/fn.handle_alloc_error.html) function, rather than directly invoking `panic!` or similar.
[source](https://doc.rust-lang.org/src/core/alloc/global.rs.html#172)#### unsafe fn dealloc(&self, ptr: \*mut u8, layout: Layout)
Deallocate the block of memory at the given `ptr` pointer with the given `layout`.
##### Safety
This function is unsafe because undefined behavior can result if the caller does not ensure all of the following:
* `ptr` must denote a block of memory currently allocated via this allocator,
* `layout` must be the same layout that was used to allocate that block of memory.
Provided Methods
----------------
[source](https://doc.rust-lang.org/src/core/alloc/global.rs.html#194)#### unsafe fn alloc\_zeroed(&self, layout: Layout) -> \*mut u8
Behaves like `alloc`, but also ensures that the contents are set to zero before being returned.
##### Safety
This function is unsafe for the same reasons that `alloc` is. However the allocated block of memory is guaranteed to be initialized.
##### Errors
Returning a null pointer indicates that either memory is exhausted or `layout` does not meet allocator’s size or alignment constraints, just as in `alloc`.
Clients wishing to abort computation in response to an allocation error are encouraged to call the [`handle_alloc_error`](https://doc.rust-lang.org/alloc/alloc/fn.handle_alloc_error.html) function, rather than directly invoking `panic!` or similar.
[source](https://doc.rust-lang.org/src/core/alloc/global.rs.html#259)#### unsafe fn realloc(&self, ptr: \*mut u8, layout: Layout, new\_size: usize) -> \*mut u8
Shrink or grow a block of memory to the given `new_size`. The block is described by the given `ptr` pointer and `layout`.
If this returns a non-null pointer, then ownership of the memory block referenced by `ptr` has been transferred to this allocator. The memory may or may not have been deallocated, and should be considered unusable. The new memory block is allocated with `layout`, but with the `size` updated to `new_size`. This new layout should be used when deallocating the new memory block with `dealloc`. The range `0..min(layout.size(), new_size)` of the new memory block is guaranteed to have the same values as the original block.
If this method returns null, then ownership of the memory block has not been transferred to this allocator, and the contents of the memory block are unaltered.
##### Safety
This function is unsafe because undefined behavior can result if the caller does not ensure all of the following:
* `ptr` must be currently allocated via this allocator,
* `layout` must be the same layout that was used to allocate that block of memory,
* `new_size` must be greater than zero.
* `new_size`, when rounded up to the nearest multiple of `layout.align()`, must not overflow (i.e., the rounded value must be less than `usize::MAX`).
(Extension subtraits might provide more specific bounds on behavior, e.g., guarantee a sentinel address or a null pointer in response to a zero-size allocation request.)
##### Errors
Returns null if the new layout does not meet the size and alignment constraints of the allocator, or if reallocation otherwise fails.
Implementations are encouraged to return null on memory exhaustion rather than panicking or aborting, but this is not a strict requirement. (Specifically: it is *legal* to implement this trait atop an underlying native allocation library that aborts on memory exhaustion.)
Clients wishing to abort computation in response to a reallocation error are encouraged to call the [`handle_alloc_error`](https://doc.rust-lang.org/alloc/alloc/fn.handle_alloc_error.html) function, rather than directly invoking `panic!` or similar.
Implementors
------------
[source](https://doc.rust-lang.org/src/std/sys/unix/alloc.rs.html#6-53)### impl GlobalAlloc for System
rust Function std::alloc::alloc_zeroed Function std::alloc::alloc\_zeroed
==================================
```
pub unsafe fn alloc_zeroed(layout: Layout) -> *mut u8
```
Allocate zero-initialized memory with the global allocator.
This function forwards calls to the [`GlobalAlloc::alloc_zeroed`](trait.globalalloc#method.alloc_zeroed "GlobalAlloc::alloc_zeroed") method of the allocator registered with the `#[global_allocator]` attribute if there is one, or the `std` crate’s default.
This function is expected to be deprecated in favor of the `alloc_zeroed` method of the [`Global`](struct.global "Global") type when it and the [`Allocator`](trait.allocator "Allocator") trait become stable.
Safety
------
See [`GlobalAlloc::alloc_zeroed`](trait.globalalloc#method.alloc_zeroed "GlobalAlloc::alloc_zeroed").
Examples
--------
```
use std::alloc::{alloc_zeroed, dealloc, Layout};
unsafe {
let layout = Layout::new::<u16>();
let ptr = alloc_zeroed(layout);
assert_eq!(*(ptr as *mut u16), 0);
dealloc(ptr, layout);
}
```
rust Struct std::alloc::Layout Struct std::alloc::Layout
=========================
```
pub struct Layout { /* private fields */ }
```
Layout of a block of memory.
An instance of `Layout` describes a particular layout of memory. You build a `Layout` up as an input to give to an allocator.
All layouts have an associated size and a power-of-two alignment.
(Note that layouts are *not* required to have non-zero size, even though `GlobalAlloc` requires that all memory requests be non-zero in size. A caller must either ensure that conditions like this are met, use specific allocators with looser requirements, or use the more lenient `Allocator` interface.)
Implementations
---------------
[source](https://doc.rust-lang.org/src/core/alloc/layout.rs.html#53)### impl Layout
[source](https://doc.rust-lang.org/src/core/alloc/layout.rs.html#68)const: 1.50.0 · #### pub const fn from\_size\_align( size: usize, align: usize) -> Result<Layout, LayoutError>
Constructs a `Layout` from a given `size` and `align`, or returns `LayoutError` if any of the following conditions are not met:
* `align` must not be zero,
* `align` must be a power of two,
* `size`, when rounded up to the nearest multiple of `align`, must not overflow isize (i.e., the rounded value must be less than or equal to `isize::MAX`).
[source](https://doc.rust-lang.org/src/core/alloc/layout.rs.html#117)const: 1.36.0 · #### pub const unsafe fn from\_size\_align\_unchecked( size: usize, align: usize) -> Layout
Creates a layout, bypassing all checks.
##### Safety
This function is unsafe as it does not verify the preconditions from [`Layout::from_size_align`](struct.layout#method.from_size_align "Layout::from_size_align").
[source](https://doc.rust-lang.org/src/core/alloc/layout.rs.html#127)const: 1.50.0 · #### pub const fn size(&self) -> usize
The minimum size in bytes for a memory block of this layout.
[source](https://doc.rust-lang.org/src/core/alloc/layout.rs.html#137)const: 1.50.0 · #### pub const fn align(&self) -> usize
The minimum byte alignment for a memory block of this layout.
[source](https://doc.rust-lang.org/src/core/alloc/layout.rs.html#146)const: 1.42.0 · #### pub const fn new<T>() -> Layout
Constructs a `Layout` suitable for holding a value of type `T`.
[source](https://doc.rust-lang.org/src/core/alloc/layout.rs.html#160)#### pub fn for\_value<T>(t: &T) -> Layoutwhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
Produces layout describing a record that could be used to allocate backing structure for `T` (which could be a trait or other unsized type like a slice).
[source](https://doc.rust-lang.org/src/core/alloc/layout.rs.html#193)#### pub unsafe fn for\_value\_raw<T>(t: \*const T) -> Layoutwhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
🔬This is a nightly-only experimental API. (`layout_for_ptr` [#69835](https://github.com/rust-lang/rust/issues/69835))
Produces layout describing a record that could be used to allocate backing structure for `T` (which could be a trait or other unsized type like a slice).
##### Safety
This function is only safe to call if the following conditions hold:
* If `T` is `Sized`, this function is always safe to call.
* If the unsized tail of `T` is:
+ a [slice](../primitive.slice "slice"), then the length of the slice tail must be an initialized integer, and the size of the *entire value* (dynamic tail length + statically sized prefix) must fit in `isize`.
+ a [trait object](../../book/ch17-02-trait-objects), then the vtable part of the pointer must point to a valid vtable for the type `T` acquired by an unsizing coercion, and the size of the *entire value* (dynamic tail length + statically sized prefix) must fit in `isize`.
+ an (unstable) [extern type](https://doc.rust-lang.org/unstable-book/language-features/extern-types.html), then this function is always safe to call, but may panic or otherwise return the wrong value, as the extern type’s layout is not known. This is the same behavior as [`Layout::for_value`](struct.layout#method.for_value "Layout::for_value") on a reference to an extern type tail.
+ otherwise, it is conservatively not allowed to call this function.
[source](https://doc.rust-lang.org/src/core/alloc/layout.rs.html#210)const: [unstable](https://github.com/rust-lang/rust/issues/55724 "Tracking issue for alloc_layout_extra") · #### pub fn dangling(&self) -> NonNull<u8>
🔬This is a nightly-only experimental API. (`alloc_layout_extra` [#55724](https://github.com/rust-lang/rust/issues/55724))
Creates a `NonNull` that is dangling, but well-aligned for this Layout.
Note that the pointer value may potentially represent a valid pointer, which means this must not be used as a “not yet initialized” sentinel value. Types that lazily allocate must track initialization by some other means.
[source](https://doc.rust-lang.org/src/core/alloc/layout.rs.html#231)1.44.0 · #### pub fn align\_to(&self, align: usize) -> Result<Layout, LayoutError>
Creates a layout describing the record that can hold a value of the same layout as `self`, but that also is aligned to alignment `align` (measured in bytes).
If `self` already meets the prescribed alignment, then returns `self`.
Note that this method does not add any padding to the overall size, regardless of whether the returned layout has a different alignment. In other words, if `K` has size 16, `K.align_to(32)` will *still* have size 16.
Returns an error if the combination of `self.size()` and the given `align` violates the conditions listed in [`Layout::from_size_align`](struct.layout#method.from_size_align "Layout::from_size_align").
[source](https://doc.rust-lang.org/src/core/alloc/layout.rs.html#256)const: [unstable](https://github.com/rust-lang/rust/issues/67521 "Tracking issue for const_alloc_layout") · #### pub fn padding\_needed\_for(&self, align: usize) -> usize
🔬This is a nightly-only experimental API. (`alloc_layout_extra` [#55724](https://github.com/rust-lang/rust/issues/55724))
Returns the amount of padding we must insert after `self` to ensure that the following address will satisfy `align` (measured in bytes).
e.g., if `self.size()` is 9, then `self.padding_needed_for(4)` returns 3, because that is the minimum number of bytes of padding required to get a 4-aligned address (assuming that the corresponding memory block starts at a 4-aligned address).
The return value of this function has no meaning if `align` is not a power-of-two.
Note that the utility of the returned value requires `align` to be less than or equal to the alignment of the starting address for the whole allocated block of memory. One way to satisfy this constraint is to ensure `align <= self.align()`.
[source](https://doc.rust-lang.org/src/core/alloc/layout.rs.html#291)1.44.0 · #### pub fn pad\_to\_align(&self) -> Layout
Creates a layout by rounding the size of this layout up to a multiple of the layout’s alignment.
This is equivalent to adding the result of `padding_needed_for` to the layout’s current size.
[source](https://doc.rust-lang.org/src/core/alloc/layout.rs.html#313)#### pub fn repeat(&self, n: usize) -> Result<(Layout, usize), LayoutError>
🔬This is a nightly-only experimental API. (`alloc_layout_extra` [#55724](https://github.com/rust-lang/rust/issues/55724))
Creates a layout describing the record for `n` instances of `self`, with a suitable amount of padding between each to ensure that each instance is given its requested size and alignment. On success, returns `(k, offs)` where `k` is the layout of the array and `offs` is the distance between the start of each element in the array.
On arithmetic overflow, returns `LayoutError`.
[source](https://doc.rust-lang.org/src/core/alloc/layout.rs.html#372)1.44.0 · #### pub fn extend(&self, next: Layout) -> Result<(Layout, usize), LayoutError>
Creates a layout describing the record for `self` followed by `next`, including any necessary padding to ensure that `next` will be properly aligned, but *no trailing padding*.
In order to match C representation layout `repr(C)`, you should call `pad_to_align` after extending the layout with all fields. (There is no way to match the default Rust representation layout `repr(Rust)`, as it is unspecified.)
Note that the alignment of the resulting layout will be the maximum of those of `self` and `next`, in order to ensure alignment of both parts.
Returns `Ok((k, offset))`, where `k` is layout of the concatenated record and `offset` is the relative location, in bytes, of the start of the `next` embedded within the concatenated record (assuming that the record itself starts at offset 0).
On arithmetic overflow, returns `LayoutError`.
##### Examples
To calculate the layout of a `#[repr(C)]` structure and the offsets of the fields from its fields’ layouts:
```
pub fn repr_c(fields: &[Layout]) -> Result<(Layout, Vec<usize>), LayoutError> {
let mut offsets = Vec::new();
let mut layout = Layout::from_size_align(0, 1)?;
for &field in fields {
let (new_layout, offset) = layout.extend(field)?;
layout = new_layout;
offsets.push(offset);
}
// Remember to finalize with `pad_to_align`!
Ok((layout.pad_to_align(), offsets))
}
```
[source](https://doc.rust-lang.org/src/core/alloc/layout.rs.html#398)#### pub fn repeat\_packed(&self, n: usize) -> Result<Layout, LayoutError>
🔬This is a nightly-only experimental API. (`alloc_layout_extra` [#55724](https://github.com/rust-lang/rust/issues/55724))
Creates a layout describing the record for `n` instances of `self`, with no padding between each instance.
Note that, unlike `repeat`, `repeat_packed` does not guarantee that the repeated instances of `self` will be properly aligned, even if a given instance of `self` is properly aligned. In other words, if the layout returned by `repeat_packed` is used to allocate an array, it is not guaranteed that all elements in the array will be properly aligned.
On arithmetic overflow, returns `LayoutError`.
[source](https://doc.rust-lang.org/src/core/alloc/layout.rs.html#412)#### pub fn extend\_packed(&self, next: Layout) -> Result<Layout, LayoutError>
🔬This is a nightly-only experimental API. (`alloc_layout_extra` [#55724](https://github.com/rust-lang/rust/issues/55724))
Creates a layout describing the record for `self` followed by `next` with no additional padding between the two. Since no padding is inserted, the alignment of `next` is irrelevant, and is not incorporated *at all* into the resulting layout.
On arithmetic overflow, returns `LayoutError`.
[source](https://doc.rust-lang.org/src/core/alloc/layout.rs.html#424)1.44.0 · #### pub fn array<T>(n: usize) -> Result<Layout, LayoutError>
Creates a layout describing the record for a `[T; n]`.
On arithmetic overflow or when the total size would exceed `isize::MAX`, returns `LayoutError`.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/alloc/layout.rs.html#37)### impl Clone for Layout
[source](https://doc.rust-lang.org/src/core/alloc/layout.rs.html#37)#### fn clone(&self) -> Layout
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)1.0.0 · #### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/core/alloc/layout.rs.html#37)### impl Debug for Layout
[source](https://doc.rust-lang.org/src/core/alloc/layout.rs.html#37)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/alloc/layout.rs.html#37)### impl Hash for Layout
[source](https://doc.rust-lang.org/src/core/alloc/layout.rs.html#37)#### fn hash<\_\_H>(&self, state: &mut \_\_H)where \_\_H: [Hasher](../hash/trait.hasher "trait std::hash::Hasher"),
Feeds this value into the given [`Hasher`](../hash/trait.hasher "Hasher"). [Read more](../hash/trait.hash#tymethod.hash)
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#237-239)1.3.0 · #### fn hash\_slice<H>(data: &[Self], state: &mut H)where H: [Hasher](../hash/trait.hasher "trait std::hash::Hasher"),
Feeds a slice of this type into the given [`Hasher`](../hash/trait.hasher "Hasher"). [Read more](../hash/trait.hash#method.hash_slice)
[source](https://doc.rust-lang.org/src/core/alloc/layout.rs.html#37)### impl PartialEq<Layout> for Layout
[source](https://doc.rust-lang.org/src/core/alloc/layout.rs.html#37)#### fn eq(&self, other: &Layout) -> bool
This method tests for `self` and `other` values to be equal, and is used by `==`. [Read more](../cmp/trait.partialeq#tymethod.eq)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#236)1.0.0 · #### fn ne(&self, other: &Rhs) -> bool
This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. [Read more](../cmp/trait.partialeq#method.ne)
[source](https://doc.rust-lang.org/src/core/alloc/layout.rs.html#37)### impl Copy for Layout
[source](https://doc.rust-lang.org/src/core/alloc/layout.rs.html#37)### impl Eq for Layout
[source](https://doc.rust-lang.org/src/core/alloc/layout.rs.html#37)### impl StructuralEq for Layout
[source](https://doc.rust-lang.org/src/core/alloc/layout.rs.html#37)### impl StructuralPartialEq for Layout
Auto Trait Implementations
--------------------------
### impl RefUnwindSafe for Layout
### impl Send for Layout
### impl Sync for Layout
### impl Unpin for Layout
### impl UnwindSafe for Layout
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Function std::alloc::dealloc Function std::alloc::dealloc
============================
```
pub unsafe fn dealloc(ptr: *mut u8, layout: Layout)
```
Deallocate memory with the global allocator.
This function forwards calls to the [`GlobalAlloc::dealloc`](trait.globalalloc#tymethod.dealloc "GlobalAlloc::dealloc") method of the allocator registered with the `#[global_allocator]` attribute if there is one, or the `std` crate’s default.
This function is expected to be deprecated in favor of the `dealloc` method of the [`Global`](struct.global "Global") type when it and the [`Allocator`](trait.allocator "Allocator") trait become stable.
Safety
------
See [`GlobalAlloc::dealloc`](trait.globalalloc#tymethod.dealloc "GlobalAlloc::dealloc").
rust Struct std::alloc::Global Struct std::alloc::Global
=========================
```
pub struct Global;
```
🔬This is a nightly-only experimental API. (`allocator_api` [#32838](https://github.com/rust-lang/rust/issues/32838))
The global memory allocator.
This type implements the [`Allocator`](trait.allocator "Allocator") trait by forwarding calls to the allocator registered with the `#[global_allocator]` attribute if there is one, or the `std` crate’s default.
Note: while this type is unstable, the functionality it provides can be accessed through the [free functions in `alloc`](https://doc.rust-lang.org/alloc/alloc/index.html#functions).
Implementations
---------------
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#204)### impl<T> Box<T, Global>
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#218)1.0.0 · #### pub fn new(x: T) -> Box<T, Global>
Notable traits for [Box](../boxed/struct.box "struct std::boxed::Box")<I, A>
```
impl<I, A> Iterator for Box<I, A>where
I: Iterator + ?Sized,
A: Allocator,
type Item = <I as Iterator>::Item;
impl<F, A> Future for Box<F, A>where
F: Future + Unpin + ?Sized,
A: Allocator + 'static,
type Output = <F as Future>::Output;
impl<R: Read + ?Sized> Read for Box<R>
impl<W: Write + ?Sized> Write for Box<W>
```
Allocates memory on the heap and then places `x` into it.
This doesn’t actually allocate if `T` is zero-sized.
##### Examples
```
let five = Box::new(5);
```
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#245)#### pub fn new\_uninit() -> Box<MaybeUninit<T>, Global>
Notable traits for [Box](../boxed/struct.box "struct std::boxed::Box")<I, A>
```
impl<I, A> Iterator for Box<I, A>where
I: Iterator + ?Sized,
A: Allocator,
type Item = <I as Iterator>::Item;
impl<F, A> Future for Box<F, A>where
F: Future + Unpin + ?Sized,
A: Allocator + 'static,
type Output = <F as Future>::Output;
impl<R: Read + ?Sized> Read for Box<R>
impl<W: Write + ?Sized> Write for Box<W>
```
🔬This is a nightly-only experimental API. (`new_uninit` [#63291](https://github.com/rust-lang/rust/issues/63291))
Constructs a new box with uninitialized contents.
##### Examples
```
#![feature(new_uninit)]
let mut five = Box::<u32>::new_uninit();
let five = unsafe {
// Deferred initialization:
five.as_mut_ptr().write(5);
five.assume_init()
};
assert_eq!(*five, 5)
```
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#271)#### pub fn new\_zeroed() -> Box<MaybeUninit<T>, Global>
Notable traits for [Box](../boxed/struct.box "struct std::boxed::Box")<I, A>
```
impl<I, A> Iterator for Box<I, A>where
I: Iterator + ?Sized,
A: Allocator,
type Item = <I as Iterator>::Item;
impl<F, A> Future for Box<F, A>where
F: Future + Unpin + ?Sized,
A: Allocator + 'static,
type Output = <F as Future>::Output;
impl<R: Read + ?Sized> Read for Box<R>
impl<W: Write + ?Sized> Write for Box<W>
```
🔬This is a nightly-only experimental API. (`new_uninit` [#63291](https://github.com/rust-lang/rust/issues/63291))
Constructs a new `Box` with uninitialized contents, with the memory being filled with `0` bytes.
See [`MaybeUninit::zeroed`](../mem/union.maybeuninit#method.zeroed) for examples of correct and incorrect usage of this method.
##### Examples
```
#![feature(new_uninit)]
let zero = Box::<u32>::new_zeroed();
let zero = unsafe { zero.assume_init() };
assert_eq!(*zero, 0)
```
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#286)1.33.0 · #### pub fn pin(x: T) -> Pin<Box<T, Global>>
Notable traits for [Pin](../pin/struct.pin "struct std::pin::Pin")<P>
```
impl<P> Future for Pin<P>where
P: DerefMut,
<P as Deref>::Target: Future,
type Output = <<P as Deref>::Target as Future>::Output;
```
Constructs a new `Pin<Box<T>>`. If `T` does not implement [`Unpin`](../marker/trait.unpin "Unpin"), then `x` will be pinned in memory and unable to be moved.
Constructing and pinning of the `Box` can also be done in two steps: `Box::pin(x)` does the same as `[Box::into\_pin](../boxed/struct.box#method.into_pin "Box::into_pin")([Box::new](../boxed/struct.box#method.new "Box::new")(x))`. Consider using [`into_pin`](../boxed/struct.box#method.into_pin) if you already have a `Box<T>`, or if you want to construct a (pinned) `Box` in a different way than with [`Box::new`](../boxed/struct.box#method.new "Box::new").
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#307)#### pub fn try\_new(x: T) -> Result<Box<T, Global>, AllocError>
🔬This is a nightly-only experimental API. (`allocator_api` [#32838](https://github.com/rust-lang/rust/issues/32838))
Allocates memory on the heap then places `x` into it, returning an error if the allocation fails
This doesn’t actually allocate if `T` is zero-sized.
##### Examples
```
#![feature(allocator_api)]
let five = Box::try_new(5)?;
```
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#334)#### pub fn try\_new\_uninit() -> Result<Box<MaybeUninit<T>, Global>, AllocError>
🔬This is a nightly-only experimental API. (`allocator_api` [#32838](https://github.com/rust-lang/rust/issues/32838))
Constructs a new box with uninitialized contents on the heap, returning an error if the allocation fails
##### Examples
```
#![feature(allocator_api, new_uninit)]
let mut five = Box::<u32>::try_new_uninit()?;
let five = unsafe {
// Deferred initialization:
five.as_mut_ptr().write(5);
five.assume_init()
};
assert_eq!(*five, 5);
```
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#360)#### pub fn try\_new\_zeroed() -> Result<Box<MaybeUninit<T>, Global>, AllocError>
🔬This is a nightly-only experimental API. (`allocator_api` [#32838](https://github.com/rust-lang/rust/issues/32838))
Constructs a new `Box` with uninitialized contents, with the memory being filled with `0` bytes on the heap
See [`MaybeUninit::zeroed`](../mem/union.maybeuninit#method.zeroed) for examples of correct and incorrect usage of this method.
##### Examples
```
#![feature(allocator_api, new_uninit)]
let zero = Box::<u32>::try_new_zeroed()?;
let zero = unsafe { zero.assume_init() };
assert_eq!(*zero, 0);
```
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#620)### impl<T> Box<[T], Global>
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#644)#### pub fn new\_uninit\_slice(len: usize) -> Box<[MaybeUninit<T>], Global>
Notable traits for [Box](../boxed/struct.box "struct std::boxed::Box")<I, A>
```
impl<I, A> Iterator for Box<I, A>where
I: Iterator + ?Sized,
A: Allocator,
type Item = <I as Iterator>::Item;
impl<F, A> Future for Box<F, A>where
F: Future + Unpin + ?Sized,
A: Allocator + 'static,
type Output = <F as Future>::Output;
impl<R: Read + ?Sized> Read for Box<R>
impl<W: Write + ?Sized> Write for Box<W>
```
🔬This is a nightly-only experimental API. (`new_uninit` [#63291](https://github.com/rust-lang/rust/issues/63291))
Constructs a new boxed slice with uninitialized contents.
##### Examples
```
#![feature(new_uninit)]
let mut values = Box::<[u32]>::new_uninit_slice(3);
let values = unsafe {
// Deferred initialization:
values[0].as_mut_ptr().write(1);
values[1].as_mut_ptr().write(2);
values[2].as_mut_ptr().write(3);
values.assume_init()
};
assert_eq!(*values, [1, 2, 3])
```
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#669)#### pub fn new\_zeroed\_slice(len: usize) -> Box<[MaybeUninit<T>], Global>
Notable traits for [Box](../boxed/struct.box "struct std::boxed::Box")<I, A>
```
impl<I, A> Iterator for Box<I, A>where
I: Iterator + ?Sized,
A: Allocator,
type Item = <I as Iterator>::Item;
impl<F, A> Future for Box<F, A>where
F: Future + Unpin + ?Sized,
A: Allocator + 'static,
type Output = <F as Future>::Output;
impl<R: Read + ?Sized> Read for Box<R>
impl<W: Write + ?Sized> Write for Box<W>
```
🔬This is a nightly-only experimental API. (`new_uninit` [#63291](https://github.com/rust-lang/rust/issues/63291))
Constructs a new boxed slice with uninitialized contents, with the memory being filled with `0` bytes.
See [`MaybeUninit::zeroed`](../mem/union.maybeuninit#method.zeroed) for examples of correct and incorrect usage of this method.
##### Examples
```
#![feature(new_uninit)]
let values = Box::<[u32]>::new_zeroed_slice(3);
let values = unsafe { values.assume_init() };
assert_eq!(*values, [0, 0, 0])
```
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#695)#### pub fn try\_new\_uninit\_slice( len: usize) -> Result<Box<[MaybeUninit<T>], Global>, AllocError>
🔬This is a nightly-only experimental API. (`allocator_api` [#32838](https://github.com/rust-lang/rust/issues/32838))
Constructs a new boxed slice with uninitialized contents. Returns an error if the allocation fails
##### Examples
```
#![feature(allocator_api, new_uninit)]
let mut values = Box::<[u32]>::try_new_uninit_slice(3)?;
let values = unsafe {
// Deferred initialization:
values[0].as_mut_ptr().write(1);
values[1].as_mut_ptr().write(2);
values[2].as_mut_ptr().write(3);
values.assume_init()
};
assert_eq!(*values, [1, 2, 3]);
```
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#727)#### pub fn try\_new\_zeroed\_slice( len: usize) -> Result<Box<[MaybeUninit<T>], Global>, AllocError>
🔬This is a nightly-only experimental API. (`allocator_api` [#32838](https://github.com/rust-lang/rust/issues/32838))
Constructs a new boxed slice with uninitialized contents, with the memory being filled with `0` bytes. Returns an error if the allocation fails
See [`MaybeUninit::zeroed`](../mem/union.maybeuninit#method.zeroed) for examples of correct and incorrect usage of this method.
##### Examples
```
#![feature(allocator_api, new_uninit)]
let values = Box::<[u32]>::try_new_zeroed_slice(3)?;
let values = unsafe { values.assume_init() };
assert_eq!(*values, [0, 0, 0]);
```
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#913)### impl<T> Box<T, Global>where T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#958)1.4.0 · #### pub unsafe fn from\_raw(raw: \*mut T) -> Box<T, Global>
Notable traits for [Box](../boxed/struct.box "struct std::boxed::Box")<I, A>
```
impl<I, A> Iterator for Box<I, A>where
I: Iterator + ?Sized,
A: Allocator,
type Item = <I as Iterator>::Item;
impl<F, A> Future for Box<F, A>where
F: Future + Unpin + ?Sized,
A: Allocator + 'static,
type Output = <F as Future>::Output;
impl<R: Read + ?Sized> Read for Box<R>
impl<W: Write + ?Sized> Write for Box<W>
```
Constructs a box from a raw pointer.
After calling this function, the raw pointer is owned by the resulting `Box`. Specifically, the `Box` destructor will call the destructor of `T` and free the allocated memory. For this to be safe, the memory must have been allocated in accordance with the [memory layout](../boxed/index#memory-layout) used by `Box` .
##### Safety
This function is unsafe because improper use may lead to memory problems. For example, a double-free may occur if the function is called twice on the same raw pointer.
The safety conditions are described in the [memory layout](../boxed/index#memory-layout) section.
##### Examples
Recreate a `Box` which was previously converted to a raw pointer using [`Box::into_raw`](../boxed/struct.box#method.into_raw "Box::into_raw"):
```
let x = Box::new(5);
let ptr = Box::into_raw(x);
let x = unsafe { Box::from_raw(ptr) };
```
Manually create a `Box` from scratch by using the global allocator:
```
use std::alloc::{alloc, Layout};
unsafe {
let ptr = alloc(Layout::new::<i32>()) as *mut i32;
// In general .write is required to avoid attempting to destruct
// the (uninitialized) previous contents of `ptr`, though for this
// simple example `*ptr = 5` would have worked as well.
ptr.write(5);
let x = Box::from_raw(ptr);
}
```
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/alloc/alloc.rs.html#234)### impl Allocator for Global
[source](https://doc.rust-lang.org/src/alloc/alloc.rs.html#236)#### fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
🔬This is a nightly-only experimental API. (`allocator_api` [#32838](https://github.com/rust-lang/rust/issues/32838))
Attempts to allocate a block of memory. [Read more](trait.allocator#tymethod.allocate)
[source](https://doc.rust-lang.org/src/alloc/alloc.rs.html#241)#### fn allocate\_zeroed(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
🔬This is a nightly-only experimental API. (`allocator_api` [#32838](https://github.com/rust-lang/rust/issues/32838))
Behaves like `allocate`, but also ensures that the returned memory is zero-initialized. [Read more](trait.allocator#method.allocate_zeroed)
[source](https://doc.rust-lang.org/src/alloc/alloc.rs.html#246)#### unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: Layout)
🔬This is a nightly-only experimental API. (`allocator_api` [#32838](https://github.com/rust-lang/rust/issues/32838))
Deallocates the memory referenced by `ptr`. [Read more](trait.allocator#tymethod.deallocate)
[source](https://doc.rust-lang.org/src/alloc/alloc.rs.html#255-260)#### unsafe fn grow( &self, ptr: NonNull<u8>, old\_layout: Layout, new\_layout: Layout) -> Result<NonNull<[u8]>, AllocError>
🔬This is a nightly-only experimental API. (`allocator_api` [#32838](https://github.com/rust-lang/rust/issues/32838))
Attempts to extend the memory block. [Read more](trait.allocator#method.grow)
[source](https://doc.rust-lang.org/src/alloc/alloc.rs.html#266-271)#### unsafe fn grow\_zeroed( &self, ptr: NonNull<u8>, old\_layout: Layout, new\_layout: Layout) -> Result<NonNull<[u8]>, AllocError>
🔬This is a nightly-only experimental API. (`allocator_api` [#32838](https://github.com/rust-lang/rust/issues/32838))
Behaves like `grow`, but also ensures that the new contents are set to zero before being returned. [Read more](trait.allocator#method.grow_zeroed)
[source](https://doc.rust-lang.org/src/alloc/alloc.rs.html#277-282)#### unsafe fn shrink( &self, ptr: NonNull<u8>, old\_layout: Layout, new\_layout: Layout) -> Result<NonNull<[u8]>, AllocError>
🔬This is a nightly-only experimental API. (`allocator_api` [#32838](https://github.com/rust-lang/rust/issues/32838))
Attempts to shrink the memory block. [Read more](trait.allocator#method.shrink)
[source](https://doc.rust-lang.org/src/core/alloc/mod.rs.html#359-361)#### fn by\_ref(&self) -> &Self
🔬This is a nightly-only experimental API. (`allocator_api` [#32838](https://github.com/rust-lang/rust/issues/32838))
Creates a “by reference” adapter for this instance of `Allocator`. [Read more](trait.allocator#method.by_ref)
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#2082)### impl<S> AsyncIterator for Box<S, Global>where S: [AsyncIterator](../async_iter/trait.asynciterator "trait std::async_iter::AsyncIterator") + [Unpin](../marker/trait.unpin "trait std::marker::Unpin") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
#### type Item = <S as AsyncIterator>::Item
🔬This is a nightly-only experimental API. (`async_iterator` [#79024](https://github.com/rust-lang/rust/issues/79024))
The type of items yielded by the async iterator.
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#2085)#### fn poll\_next( self: Pin<&mut Box<S, Global>>, cx: &mut Context<'\_>) -> Poll<Option<<Box<S, Global> as AsyncIterator>::Item>>
🔬This is a nightly-only experimental API. (`async_iterator` [#79024](https://github.com/rust-lang/rust/issues/79024))
Attempt to pull out the next value of this async iterator, registering the current task for wakeup if the value is not yet available, and returning `None` if the async iterator is exhausted. [Read more](../async_iter/trait.asynciterator#tymethod.poll_next)
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#2089)#### fn size\_hint(&self) -> (usize, Option<usize>)
🔬This is a nightly-only experimental API. (`async_iterator` [#79024](https://github.com/rust-lang/rust/issues/79024))
Returns the bounds on the remaining length of the async iterator. [Read more](../async_iter/trait.asynciterator#method.size_hint)
[source](https://doc.rust-lang.org/src/alloc/ffi/c_str.rs.html#821)1.29.0 · ### impl Clone for Box<CStr, Global>
[source](https://doc.rust-lang.org/src/alloc/ffi/c_str.rs.html#823)#### fn clone(&self) -> Box<CStr, Global>
Notable traits for [Box](../boxed/struct.box "struct std::boxed::Box")<I, A>
```
impl<I, A> Iterator for Box<I, A>where
I: Iterator + ?Sized,
A: Allocator,
type Item = <I as Iterator>::Item;
impl<F, A> Future for Box<F, A>where
F: Future + Unpin + ?Sized,
A: Allocator + 'static,
type Output = <F as Future>::Output;
impl<R: Read + ?Sized> Read for Box<R>
impl<W: Write + ?Sized> Write for Box<W>
```
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)1.0.0 · #### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#1328)1.3.0 · ### impl Clone for Box<str, Global>
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#1329)#### fn clone(&self) -> Box<str, Global>
Notable traits for [Box](../boxed/struct.box "struct std::boxed::Box")<I, A>
```
impl<I, A> Iterator for Box<I, A>where
I: Iterator + ?Sized,
A: Allocator,
type Item = <I as Iterator>::Item;
impl<F, A> Future for Box<F, A>where
F: Future + Unpin + ?Sized,
A: Allocator + 'static,
type Output = <F as Future>::Output;
impl<R: Read + ?Sized> Read for Box<R>
impl<W: Write + ?Sized> Write for Box<W>
```
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)1.0.0 · #### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/alloc/alloc.rs.html#53)### impl Clone for Global
[source](https://doc.rust-lang.org/src/alloc/alloc.rs.html#53)#### fn clone(&self) -> Global
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)1.0.0 · #### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/alloc/alloc.rs.html#53)### impl Debug for Global
[source](https://doc.rust-lang.org/src/alloc/alloc.rs.html#53)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#1255)1.0.0 (const: [unstable](https://github.com/rust-lang/rust/issues/87864 "Tracking issue for const_default_impls")) · ### impl<T> Default for Box<[T], Global>
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#1256)const: [unstable](https://github.com/rust-lang/rust/issues/87864 "Tracking issue for const_default_impls") · #### fn default() -> Box<[T], Global>
Notable traits for [Box](../boxed/struct.box "struct std::boxed::Box")<I, A>
```
impl<I, A> Iterator for Box<I, A>where
I: Iterator + ?Sized,
A: Allocator,
type Item = <I as Iterator>::Item;
impl<F, A> Future for Box<F, A>where
F: Future + Unpin + ?Sized,
A: Allocator + 'static,
type Output = <F as Future>::Output;
impl<R: Read + ?Sized> Read for Box<R>
impl<W: Write + ?Sized> Write for Box<W>
```
Returns the “default value” for a type. [Read more](../default/trait.default#tymethod.default)
[source](https://doc.rust-lang.org/src/alloc/ffi/c_str.rs.html#912)1.17.0 · ### impl Default for Box<CStr, Global>
[source](https://doc.rust-lang.org/src/alloc/ffi/c_str.rs.html#913)#### fn default() -> Box<CStr, Global>
Notable traits for [Box](../boxed/struct.box "struct std::boxed::Box")<I, A>
```
impl<I, A> Iterator for Box<I, A>where
I: Iterator + ?Sized,
A: Allocator,
type Item = <I as Iterator>::Item;
impl<F, A> Future for Box<F, A>where
F: Future + Unpin + ?Sized,
A: Allocator + 'static,
type Output = <F as Future>::Output;
impl<R: Read + ?Sized> Read for Box<R>
impl<W: Write + ?Sized> Write for Box<W>
```
Returns the “default value” for a type. [Read more](../default/trait.default#tymethod.default)
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#1244)1.0.0 · ### impl<T> Default for Box<T, Global>where T: [Default](../default/trait.default "trait std::default::Default"),
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#1246)#### fn default() -> Box<T, Global>
Notable traits for [Box](../boxed/struct.box "struct std::boxed::Box")<I, A>
```
impl<I, A> Iterator for Box<I, A>where
I: Iterator + ?Sized,
A: Allocator,
type Item = <I as Iterator>::Item;
impl<F, A> Future for Box<F, A>where
F: Future + Unpin + ?Sized,
A: Allocator + 'static,
type Output = <F as Future>::Output;
impl<R: Read + ?Sized> Read for Box<R>
impl<W: Write + ?Sized> Write for Box<W>
```
Creates a `Box<T>`, with the `Default` value for T.
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#1265)1.17.0 (const: [unstable](https://github.com/rust-lang/rust/issues/87864 "Tracking issue for const_default_impls")) · ### impl Default for Box<str, Global>
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#1266)const: [unstable](https://github.com/rust-lang/rust/issues/87864 "Tracking issue for const_default_impls") · #### fn default() -> Box<str, Global>
Notable traits for [Box](../boxed/struct.box "struct std::boxed::Box")<I, A>
```
impl<I, A> Iterator for Box<I, A>where
I: Iterator + ?Sized,
A: Allocator,
type Item = <I as Iterator>::Item;
impl<F, A> Future for Box<F, A>where
F: Future + Unpin + ?Sized,
A: Allocator + 'static,
type Output = <F as Future>::Output;
impl<R: Read + ?Sized> Read for Box<R>
impl<W: Write + ?Sized> Write for Box<W>
```
Returns the “default value” for a type. [Read more](../default/trait.default#tymethod.default)
[source](https://doc.rust-lang.org/src/alloc/alloc.rs.html#53)### impl Default for Global
[source](https://doc.rust-lang.org/src/alloc/alloc.rs.html#53)#### fn default() -> Global
Returns the “default value” for a type. [Read more](../default/trait.default#tymethod.default)
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#2379)1.8.0 · ### impl<T> Error for Box<T, Global>where T: [Error](../error/trait.error "trait std::error::Error"),
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#2381)#### fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to\_string()
[Read more](../error/trait.error#method.description)
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#2386)#### fn cause(&self) -> Option<&dyn Error>
👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#2390)#### fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. [Read more](../error/trait.error#method.source)
[source](https://doc.rust-lang.org/src/core/error.rs.html#193)#### fn provide(&'a self, demand: &mut Demand<'a>)
🔬This is a nightly-only experimental API. (`error_generic_member_access` [#99301](https://github.com/rust-lang/rust/issues/99301))
Provides type based access to context intended for error reports. [Read more](../error/trait.error#method.provide)
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#1484)1.17.0 · ### impl<T> From<&[T]> for Box<[T], Global>where T: [Copy](../marker/trait.copy "trait std::marker::Copy"),
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#1498)#### fn from(slice: &[T]) -> Box<[T], Global>
Notable traits for [Box](../boxed/struct.box "struct std::boxed::Box")<I, A>
```
impl<I, A> Iterator for Box<I, A>where
I: Iterator + ?Sized,
A: Allocator,
type Item = <I as Iterator>::Item;
impl<F, A> Future for Box<F, A>where
F: Future + Unpin + ?Sized,
A: Allocator + 'static,
type Output = <F as Future>::Output;
impl<R: Read + ?Sized> Read for Box<R>
impl<W: Write + ?Sized> Write for Box<W>
```
Converts a `&[T]` into a `Box<[T]>`
This conversion allocates on the heap and performs a copy of `slice` and its contents.
##### Examples
```
// create a &[u8] which will be used to create a Box<[u8]>
let slice: &[u8] = &[104, 101, 108, 108, 111];
let boxed_slice: Box<[u8]> = Box::from(slice);
println!("{boxed_slice:?}");
```
[source](https://doc.rust-lang.org/src/alloc/ffi/c_str.rs.html#765)1.17.0 · ### impl From<&CStr> for Box<CStr, Global>
[source](https://doc.rust-lang.org/src/alloc/ffi/c_str.rs.html#768)#### fn from(s: &CStr) -> Box<CStr, Global>
Notable traits for [Box](../boxed/struct.box "struct std::boxed::Box")<I, A>
```
impl<I, A> Iterator for Box<I, A>where
I: Iterator + ?Sized,
A: Allocator,
type Item = <I as Iterator>::Item;
impl<F, A> Future for Box<F, A>where
F: Future + Unpin + ?Sized,
A: Allocator + 'static,
type Output = <F as Future>::Output;
impl<R: Read + ?Sized> Read for Box<R>
impl<W: Write + ?Sized> Write for Box<W>
```
Converts a `&CStr` into a `Box<CStr>`, by copying the contents into a newly allocated [`Box`](../boxed/struct.box "Box").
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#2312)1.6.0 · ### impl From<&str> for Box<dyn Error + 'static, Global>
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#2327)#### fn from(err: &str) -> Box<dyn Error + 'static, Global>
Notable traits for [Box](../boxed/struct.box "struct std::boxed::Box")<I, A>
```
impl<I, A> Iterator for Box<I, A>where
I: Iterator + ?Sized,
A: Allocator,
type Item = <I as Iterator>::Item;
impl<F, A> Future for Box<F, A>where
F: Future + Unpin + ?Sized,
A: Allocator + 'static,
type Output = <F as Future>::Output;
impl<R: Read + ?Sized> Read for Box<R>
impl<W: Write + ?Sized> Write for Box<W>
```
Converts a [`str`](../primitive.str) into a box of dyn [`Error`](../error/trait.error "Error").
##### Examples
```
use std::error::Error;
use std::mem;
let a_str_error = "a str error";
let a_boxed_error = Box::<dyn Error>::from(a_str_error);
assert!(mem::size_of::<Box<dyn Error>>() == mem::size_of_val(&a_boxed_error))
```
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#2287)1.0.0 · ### impl<'a> From<&str> for Box<dyn Error + Send + Sync + 'a, Global>
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#2304)#### fn from(err: &str) -> Box<dyn Error + Send + Sync + 'a, Global>
Notable traits for [Box](../boxed/struct.box "struct std::boxed::Box")<I, A>
```
impl<I, A> Iterator for Box<I, A>where
I: Iterator + ?Sized,
A: Allocator,
type Item = <I as Iterator>::Item;
impl<F, A> Future for Box<F, A>where
F: Future + Unpin + ?Sized,
A: Allocator + 'static,
type Output = <F as Future>::Output;
impl<R: Read + ?Sized> Read for Box<R>
impl<W: Write + ?Sized> Write for Box<W>
```
Converts a [`str`](../primitive.str) into a box of dyn [`Error`](../error/trait.error "Error") + [`Send`](../marker/trait.send "Send") + [`Sync`](../marker/trait.sync "Sync").
##### Examples
```
use std::error::Error;
use std::mem;
let a_str_error = "a str error";
let a_boxed_error = Box::<dyn Error + Send + Sync>::from(a_str_error);
assert!(
mem::size_of::<Box<dyn Error + Send + Sync>>() == mem::size_of_val(&a_boxed_error))
```
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#1528)1.17.0 · ### impl From<&str> for Box<str, Global>
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#1541)#### fn from(s: &str) -> Box<str, Global>
Notable traits for [Box](../boxed/struct.box "struct std::boxed::Box")<I, A>
```
impl<I, A> Iterator for Box<I, A>where
I: Iterator + ?Sized,
A: Allocator,
type Item = <I as Iterator>::Item;
impl<F, A> Future for Box<F, A>where
F: Future + Unpin + ?Sized,
A: Allocator + 'static,
type Output = <F as Future>::Output;
impl<R: Read + ?Sized> Read for Box<R>
impl<W: Write + ?Sized> Write for Box<W>
```
Converts a `&str` into a `Box<str>`
This conversion allocates on the heap and performs a copy of `s`.
##### Examples
```
let boxed: Box<str> = Box::from("hello");
println!("{boxed}");
```
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#1608)1.45.0 · ### impl<T, const N: usize> From<[T; N]> for Box<[T], Global>
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#1619)#### fn from(array: [T; N]) -> Box<[T], Global>
Notable traits for [Box](../boxed/struct.box "struct std::boxed::Box")<I, A>
```
impl<I, A> Iterator for Box<I, A>where
I: Iterator + ?Sized,
A: Allocator,
type Item = <I as Iterator>::Item;
impl<F, A> Future for Box<F, A>where
F: Future + Unpin + ?Sized,
A: Allocator + 'static,
type Output = <F as Future>::Output;
impl<R: Read + ?Sized> Read for Box<R>
impl<W: Write + ?Sized> Write for Box<W>
```
Converts a `[T; N]` into a `Box<[T]>`
This conversion moves the array to newly heap-allocated memory.
##### Examples
```
let boxed: Box<[u8]> = Box::from([4, 2]);
println!("{boxed:?}");
```
[source](https://doc.rust-lang.org/src/alloc/ffi/c_str.rs.html#829)1.20.0 · ### impl From<CString> for Box<CStr, Global>
[source](https://doc.rust-lang.org/src/alloc/ffi/c_str.rs.html#832)#### fn from(s: CString) -> Box<CStr, Global>
Notable traits for [Box](../boxed/struct.box "struct std::boxed::Box")<I, A>
```
impl<I, A> Iterator for Box<I, A>where
I: Iterator + ?Sized,
A: Allocator,
type Item = <I as Iterator>::Item;
impl<F, A> Future for Box<F, A>where
F: Future + Unpin + ?Sized,
A: Allocator + 'static,
type Output = <F as Future>::Output;
impl<R: Read + ?Sized> Read for Box<R>
impl<W: Write + ?Sized> Write for Box<W>
```
Converts a [`CString`](../ffi/struct.cstring "CString") into a `[Box](../boxed/struct.box "Box")<[CStr](../ffi/struct.cstr "CStr")>` without copying or allocating.
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#1510)1.45.0 · ### impl<T> From<Cow<'\_, [T]>> for Box<[T], Global>where T: [Copy](../marker/trait.copy "trait std::marker::Copy"),
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#1518)#### fn from(cow: Cow<'\_, [T]>) -> Box<[T], Global>
Notable traits for [Box](../boxed/struct.box "struct std::boxed::Box")<I, A>
```
impl<I, A> Iterator for Box<I, A>where
I: Iterator + ?Sized,
A: Allocator,
type Item = <I as Iterator>::Item;
impl<F, A> Future for Box<F, A>where
F: Future + Unpin + ?Sized,
A: Allocator + 'static,
type Output = <F as Future>::Output;
impl<R: Read + ?Sized> Read for Box<R>
impl<W: Write + ?Sized> Write for Box<W>
```
Converts a `Cow<'_, [T]>` into a `Box<[T]>`
When `cow` is the `Cow::Borrowed` variant, this conversion allocates on the heap and copies the underlying slice. Otherwise, it will try to reuse the owned `Vec`’s allocation.
[source](https://doc.rust-lang.org/src/alloc/ffi/c_str.rs.html#775)1.45.0 · ### impl From<Cow<'\_, CStr>> for Box<CStr, Global>
[source](https://doc.rust-lang.org/src/alloc/ffi/c_str.rs.html#779)#### fn from(cow: Cow<'\_, CStr>) -> Box<CStr, Global>
Notable traits for [Box](../boxed/struct.box "struct std::boxed::Box")<I, A>
```
impl<I, A> Iterator for Box<I, A>where
I: Iterator + ?Sized,
A: Allocator,
type Item = <I as Iterator>::Item;
impl<F, A> Future for Box<F, A>where
F: Future + Unpin + ?Sized,
A: Allocator + 'static,
type Output = <F as Future>::Output;
impl<R: Read + ?Sized> Read for Box<R>
impl<W: Write + ?Sized> Write for Box<W>
```
Converts a `Cow<'a, CStr>` into a `Box<CStr>`, by copying the contents if they are borrowed.
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#1548)1.45.0 · ### impl From<Cow<'\_, str>> for Box<str, Global>
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#1573)#### fn from(cow: Cow<'\_, str>) -> Box<str, Global>
Notable traits for [Box](../boxed/struct.box "struct std::boxed::Box")<I, A>
```
impl<I, A> Iterator for Box<I, A>where
I: Iterator + ?Sized,
A: Allocator,
type Item = <I as Iterator>::Item;
impl<F, A> Future for Box<F, A>where
F: Future + Unpin + ?Sized,
A: Allocator + 'static,
type Output = <F as Future>::Output;
impl<R: Read + ?Sized> Read for Box<R>
impl<W: Write + ?Sized> Write for Box<W>
```
Converts a `Cow<'_, str>` into a `Box<str>`
When `cow` is the `Cow::Borrowed` variant, this conversion allocates on the heap and copies the underlying `str`. Otherwise, it will try to reuse the owned `String`’s allocation.
##### Examples
```
use std::borrow::Cow;
let unboxed = Cow::Borrowed("hello");
let boxed: Box<str> = Box::from(unboxed);
println!("{boxed}");
```
```
let unboxed = Cow::Owned("hello".to_string());
let boxed: Box<str> = Box::from(unboxed);
println!("{boxed}");
```
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#2358)1.22.0 · ### impl<'a> From<Cow<'a, str>> for Box<dyn Error + 'static, Global>
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#2372)#### fn from(err: Cow<'a, str>) -> Box<dyn Error + 'static, Global>
Notable traits for [Box](../boxed/struct.box "struct std::boxed::Box")<I, A>
```
impl<I, A> Iterator for Box<I, A>where
I: Iterator + ?Sized,
A: Allocator,
type Item = <I as Iterator>::Item;
impl<F, A> Future for Box<F, A>where
F: Future + Unpin + ?Sized,
A: Allocator + 'static,
type Output = <F as Future>::Output;
impl<R: Read + ?Sized> Read for Box<R>
impl<W: Write + ?Sized> Write for Box<W>
```
Converts a [`Cow`](../borrow/enum.cow "Cow") into a box of dyn [`Error`](../error/trait.error "Error").
##### Examples
```
use std::error::Error;
use std::mem;
use std::borrow::Cow;
let a_cow_str_error = Cow::from("a str error");
let a_boxed_error = Box::<dyn Error>::from(a_cow_str_error);
assert!(mem::size_of::<Box<dyn Error>>() == mem::size_of_val(&a_boxed_error))
```
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#2335)1.22.0 · ### impl<'a, 'b> From<Cow<'b, str>> for Box<dyn Error + Send + Sync + 'a, Global>
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#2350)#### fn from(err: Cow<'b, str>) -> Box<dyn Error + Send + Sync + 'a, Global>
Notable traits for [Box](../boxed/struct.box "struct std::boxed::Box")<I, A>
```
impl<I, A> Iterator for Box<I, A>where
I: Iterator + ?Sized,
A: Allocator,
type Item = <I as Iterator>::Item;
impl<F, A> Future for Box<F, A>where
F: Future + Unpin + ?Sized,
A: Allocator + 'static,
type Output = <F as Future>::Output;
impl<R: Read + ?Sized> Read for Box<R>
impl<W: Write + ?Sized> Write for Box<W>
```
Converts a [`Cow`](../borrow/enum.cow "Cow") into a box of dyn [`Error`](../error/trait.error "Error") + [`Send`](../marker/trait.send "Send") + [`Sync`](../marker/trait.sync "Sync").
##### Examples
```
use std::error::Error;
use std::mem;
use std::borrow::Cow;
let a_cow_str_error = Cow::from("a str error");
let a_boxed_error = Box::<dyn Error + Send + Sync>::from(a_cow_str_error);
assert!(
mem::size_of::<Box<dyn Error + Send + Sync>>() == mem::size_of_val(&a_boxed_error))
```
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#2145)1.0.0 · ### impl<'a, E> From<E> for Box<dyn Error + 'a, Global>where E: 'a + [Error](../error/trait.error "trait std::error::Error"),
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#2171)#### fn from(err: E) -> Box<dyn Error + 'a, Global>
Notable traits for [Box](../boxed/struct.box "struct std::boxed::Box")<I, A>
```
impl<I, A> Iterator for Box<I, A>where
I: Iterator + ?Sized,
A: Allocator,
type Item = <I as Iterator>::Item;
impl<F, A> Future for Box<F, A>where
F: Future + Unpin + ?Sized,
A: Allocator + 'static,
type Output = <F as Future>::Output;
impl<R: Read + ?Sized> Read for Box<R>
impl<W: Write + ?Sized> Write for Box<W>
```
Converts a type of [`Error`](../error/trait.error "Error") into a box of dyn [`Error`](../error/trait.error "Error").
##### Examples
```
use std::error::Error;
use std::fmt;
use std::mem;
#[derive(Debug)]
struct AnError;
impl fmt::Display for AnError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "An error")
}
}
impl Error for AnError {}
let an_error = AnError;
assert!(0 == mem::size_of_val(&an_error));
let a_boxed_error = Box::<dyn Error>::from(an_error);
assert!(mem::size_of::<Box<dyn Error>>() == mem::size_of_val(&a_boxed_error))
```
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#2179)1.0.0 · ### impl<'a, E> From<E> for Box<dyn Error + Send + Sync + 'a, Global>where E: 'a + [Error](../error/trait.error "trait std::error::Error") + [Send](../marker/trait.send "trait std::marker::Send") + [Sync](../marker/trait.sync "trait std::marker::Sync"),
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#2211)#### fn from(err: E) -> Box<dyn Error + Send + Sync + 'a, Global>
Notable traits for [Box](../boxed/struct.box "struct std::boxed::Box")<I, A>
```
impl<I, A> Iterator for Box<I, A>where
I: Iterator + ?Sized,
A: Allocator,
type Item = <I as Iterator>::Item;
impl<F, A> Future for Box<F, A>where
F: Future + Unpin + ?Sized,
A: Allocator + 'static,
type Output = <F as Future>::Output;
impl<R: Read + ?Sized> Read for Box<R>
impl<W: Write + ?Sized> Write for Box<W>
```
Converts a type of [`Error`](../error/trait.error "Error") + [`Send`](../marker/trait.send "Send") + [`Sync`](../marker/trait.sync "Sync") into a box of dyn [`Error`](../error/trait.error "Error") + [`Send`](../marker/trait.send "Send") + [`Sync`](../marker/trait.sync "Sync").
##### Examples
```
use std::error::Error;
use std::fmt;
use std::mem;
#[derive(Debug)]
struct AnError;
impl fmt::Display for AnError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "An error")
}
}
impl Error for AnError {}
unsafe impl Send for AnError {}
unsafe impl Sync for AnError {}
let an_error = AnError;
assert!(0 == mem::size_of_val(&an_error));
let a_boxed_error = Box::<dyn Error + Send + Sync>::from(an_error);
assert!(
mem::size_of::<Box<dyn Error + Send + Sync>>() == mem::size_of_val(&a_boxed_error))
```
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#2264)1.6.0 · ### impl From<String> for Box<dyn Error + 'static, Global>
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#2277)#### fn from(str\_err: String) -> Box<dyn Error + 'static, Global>
Notable traits for [Box](../boxed/struct.box "struct std::boxed::Box")<I, A>
```
impl<I, A> Iterator for Box<I, A>where
I: Iterator + ?Sized,
A: Allocator,
type Item = <I as Iterator>::Item;
impl<F, A> Future for Box<F, A>where
F: Future + Unpin + ?Sized,
A: Allocator + 'static,
type Output = <F as Future>::Output;
impl<R: Read + ?Sized> Read for Box<R>
impl<W: Write + ?Sized> Write for Box<W>
```
Converts a [`String`](../string/struct.string "String") into a box of dyn [`Error`](../error/trait.error "Error").
##### Examples
```
use std::error::Error;
use std::mem;
let a_string_error = "a string error".to_string();
let a_boxed_error = Box::<dyn Error>::from(a_string_error);
assert!(mem::size_of::<Box<dyn Error>>() == mem::size_of_val(&a_boxed_error))
```
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#2219)1.0.0 · ### impl From<String> for Box<dyn Error + Send + Sync + 'static, Global>
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#2234)#### fn from(err: String) -> Box<dyn Error + Send + Sync + 'static, Global>
Notable traits for [Box](../boxed/struct.box "struct std::boxed::Box")<I, A>
```
impl<I, A> Iterator for Box<I, A>where
I: Iterator + ?Sized,
A: Allocator,
type Item = <I as Iterator>::Item;
impl<F, A> Future for Box<F, A>where
F: Future + Unpin + ?Sized,
A: Allocator + 'static,
type Output = <F as Future>::Output;
impl<R: Read + ?Sized> Read for Box<R>
impl<W: Write + ?Sized> Write for Box<W>
```
Converts a [`String`](../string/struct.string "String") into a box of dyn [`Error`](../error/trait.error "Error") + [`Send`](../marker/trait.send "Send") + [`Sync`](../marker/trait.sync "Sync").
##### Examples
```
use std::error::Error;
use std::mem;
let a_string_error = "a string error".to_string();
let a_boxed_error = Box::<dyn Error + Send + Sync>::from(a_string_error);
assert!(
mem::size_of::<Box<dyn Error + Send + Sync>>() == mem::size_of_val(&a_boxed_error))
```
[source](https://doc.rust-lang.org/src/alloc/string.rs.html#2680)1.20.0 · ### impl From<String> for Box<str, Global>
[source](https://doc.rust-lang.org/src/alloc/string.rs.html#2694)#### fn from(s: String) -> Box<str, Global>
Notable traits for [Box](../boxed/struct.box "struct std::boxed::Box")<I, A>
```
impl<I, A> Iterator for Box<I, A>where
I: Iterator + ?Sized,
A: Allocator,
type Item = <I as Iterator>::Item;
impl<F, A> Future for Box<F, A>where
F: Future + Unpin + ?Sized,
A: Allocator + 'static,
type Output = <F as Future>::Output;
impl<R: Read + ?Sized> Read for Box<R>
impl<W: Write + ?Sized> Write for Box<W>
```
Converts the given [`String`](../string/struct.string "String") to a boxed `str` slice that is owned.
##### Examples
Basic usage:
```
let s1: String = String::from("hello world");
let s2: Box<str> = Box::from(s1);
let s3: String = String::from(s2);
assert_eq!("hello world", s3)
```
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#1441)1.6.0 · ### impl<T> From<T> for Box<T, Global>
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#1455)#### fn from(t: T) -> Box<T, Global>
Notable traits for [Box](../boxed/struct.box "struct std::boxed::Box")<I, A>
```
impl<I, A> Iterator for Box<I, A>where
I: Iterator + ?Sized,
A: Allocator,
type Item = <I as Iterator>::Item;
impl<F, A> Future for Box<F, A>where
F: Future + Unpin + ?Sized,
A: Allocator + 'static,
type Output = <F as Future>::Output;
impl<R: Read + ?Sized> Read for Box<R>
impl<W: Write + ?Sized> Write for Box<W>
```
Converts a `T` into a `Box<T>`
The conversion allocates on the heap and moves `t` from the stack into it.
##### Examples
```
let x = 5;
let boxed = Box::new(5);
assert_eq!(Box::from(x), boxed);
```
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#1966)1.32.0 · ### impl<I> FromIterator<I> for Box<[I], Global>
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#1967)#### fn from\_iter<T>(iter: T) -> Box<[I], Global>where T: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")<Item = I>,
Notable traits for [Box](../boxed/struct.box "struct std::boxed::Box")<I, A>
```
impl<I, A> Iterator for Box<I, A>where
I: Iterator + ?Sized,
A: Allocator,
type Item = <I as Iterator>::Item;
impl<F, A> Future for Box<F, A>where
F: Future + Unpin + ?Sized,
A: Allocator + 'static,
type Output = <F as Future>::Output;
impl<R: Read + ?Sized> Read for Box<R>
impl<W: Write + ?Sized> Write for Box<W>
```
Creates a value from an iterator. [Read more](../iter/trait.fromiterator#tymethod.from_iter)
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#1626)1.43.0 · ### impl<T, const N: usize> TryFrom<Box<[T], Global>> for Box<[T; N], Global>
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#1638)#### fn try\_from( boxed\_slice: Box<[T], Global>) -> Result<Box<[T; N], Global>, <Box<[T; N], Global> as TryFrom<Box<[T], Global>>>::Error>
Attempts to convert a `Box<[T]>` into a `Box<[T; N]>`.
The conversion occurs in-place and does not require a new memory allocation.
##### Errors
Returns the old `Box<[T]>` in the `Err` variant if `boxed_slice.len()` does not equal `N`.
#### type Error = Box<[T], Global>
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/alloc/alloc.rs.html#53)### impl Copy for Global
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#1962)### impl<T, U> DispatchFromDyn<Box<U, Global>> for Box<T, Global>where T: [Unsize](../marker/trait.unsize "trait std::marker::Unsize")<U> + ?[Sized](../marker/trait.sized "trait std::marker::Sized"), U: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
Auto Trait Implementations
--------------------------
### impl RefUnwindSafe for Global
### impl Send for Global
### impl Sync for Global
### impl Unpin for Global
### impl UnwindSafe for Global
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Type Definition std::alloc::LayoutErr Type Definition std::alloc::LayoutErr
=====================================
```
pub type LayoutErr = LayoutError;
```
👎Deprecated since 1.52.0: Name does not follow std convention, use LayoutError
rust Function std::alloc::realloc Function std::alloc::realloc
============================
```
pub unsafe fn realloc(ptr: *mut u8, layout: Layout, new_size: usize) -> *mut u8
```
Reallocate memory with the global allocator.
This function forwards calls to the [`GlobalAlloc::realloc`](trait.globalalloc#method.realloc "GlobalAlloc::realloc") method of the allocator registered with the `#[global_allocator]` attribute if there is one, or the `std` crate’s default.
This function is expected to be deprecated in favor of the `realloc` method of the [`Global`](struct.global "Global") type when it and the [`Allocator`](trait.allocator "Allocator") trait become stable.
Safety
------
See [`GlobalAlloc::realloc`](trait.globalalloc#method.realloc "GlobalAlloc::realloc").
rust Function std::alloc::take_alloc_error_hook Function std::alloc::take\_alloc\_error\_hook
=============================================
```
pub fn take_alloc_error_hook() -> fn(_: Layout)
```
🔬This is a nightly-only experimental API. (`alloc_error_hook` [#51245](https://github.com/rust-lang/rust/issues/51245))
Unregisters the current allocation error hook, returning it.
*See also the function [`set_alloc_error_hook`](fn.set_alloc_error_hook "set_alloc_error_hook").*
If no custom hook is registered, the default hook will be returned.
rust Function std::alloc::alloc Function std::alloc::alloc
==========================
```
pub unsafe fn alloc(layout: Layout) -> *mut u8
```
Allocate memory with the global allocator.
This function forwards calls to the [`GlobalAlloc::alloc`](trait.globalalloc#tymethod.alloc "GlobalAlloc::alloc") method of the allocator registered with the `#[global_allocator]` attribute if there is one, or the `std` crate’s default.
This function is expected to be deprecated in favor of the `alloc` method of the [`Global`](struct.global "Global") type when it and the [`Allocator`](trait.allocator "Allocator") trait become stable.
Safety
------
See [`GlobalAlloc::alloc`](trait.globalalloc#tymethod.alloc "GlobalAlloc::alloc").
Examples
--------
```
use std::alloc::{alloc, dealloc, handle_alloc_error, Layout};
unsafe {
let layout = Layout::new::<u16>();
let ptr = alloc(layout);
if ptr.is_null() {
handle_alloc_error(layout);
}
*(ptr as *mut u16) = 42;
assert_eq!(*(ptr as *mut u16), 42);
dealloc(ptr, layout);
}
```
rust Struct std::alloc::LayoutError Struct std::alloc::LayoutError
==============================
```
#[non_exhaustive]pub struct LayoutError;
```
The parameters given to `Layout::from_size_align` or some other `Layout` constructor do not satisfy its documented constraints.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/alloc/layout.rs.html#463)### impl Clone for LayoutError
[source](https://doc.rust-lang.org/src/core/alloc/layout.rs.html#463)#### fn clone(&self) -> LayoutError
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)1.0.0 · #### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/core/alloc/layout.rs.html#463)### impl Debug for LayoutError
[source](https://doc.rust-lang.org/src/core/alloc/layout.rs.html#463)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/alloc/layout.rs.html#472)1.28.0 · ### impl Display for LayoutError
[source](https://doc.rust-lang.org/src/core/alloc/layout.rs.html#473)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.display#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/alloc/layout.rs.html#468)1.28.0 · ### impl Error for LayoutError
[source](https://doc.rust-lang.org/src/core/error.rs.html#83)1.30.0 · #### fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. [Read more](../error/trait.error#method.source)
[source](https://doc.rust-lang.org/src/core/error.rs.html#109)1.0.0 · #### fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to\_string()
[Read more](../error/trait.error#method.description)
[source](https://doc.rust-lang.org/src/core/error.rs.html#119)1.0.0 · #### fn cause(&self) -> Option<&dyn Error>
👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
[source](https://doc.rust-lang.org/src/core/error.rs.html#193)#### fn provide(&'a self, demand: &mut Demand<'a>)
🔬This is a nightly-only experimental API. (`error_generic_member_access` [#99301](https://github.com/rust-lang/rust/issues/99301))
Provides type based access to context intended for error reports. [Read more](../error/trait.error#method.provide)
[source](https://doc.rust-lang.org/src/alloc/collections/mod.rs.html#122)### impl From<LayoutError> for TryReserveErrorKind
[source](https://doc.rust-lang.org/src/alloc/collections/mod.rs.html#125)#### fn from(LayoutError) -> TryReserveErrorKind
Always evaluates to [`TryReserveErrorKind::CapacityOverflow`](../collections/enum.tryreserveerrorkind#variant.CapacityOverflow "TryReserveErrorKind::CapacityOverflow").
[source](https://doc.rust-lang.org/src/core/alloc/layout.rs.html#463)### impl PartialEq<LayoutError> for LayoutError
[source](https://doc.rust-lang.org/src/core/alloc/layout.rs.html#463)#### fn eq(&self, other: &LayoutError) -> bool
This method tests for `self` and `other` values to be equal, and is used by `==`. [Read more](../cmp/trait.partialeq#tymethod.eq)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#236)1.0.0 · #### fn ne(&self, other: &Rhs) -> bool
This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. [Read more](../cmp/trait.partialeq#method.ne)
[source](https://doc.rust-lang.org/src/core/alloc/layout.rs.html#463)### impl Eq for LayoutError
[source](https://doc.rust-lang.org/src/core/alloc/layout.rs.html#463)### impl StructuralEq for LayoutError
[source](https://doc.rust-lang.org/src/core/alloc/layout.rs.html#463)### impl StructuralPartialEq for LayoutError
Auto Trait Implementations
--------------------------
### impl RefUnwindSafe for LayoutError
### impl Send for LayoutError
### impl Sync for LayoutError
### impl Unpin for LayoutError
### impl UnwindSafe for LayoutError
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/error.rs.html#197)### impl<E> Provider for Ewhere E: [Error](../error/trait.error "trait std::error::Error") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/error.rs.html#201)#### fn provide(&'a self, demand: &mut Demand<'a>)
🔬This is a nightly-only experimental API. (`provide_any` [#96024](https://github.com/rust-lang/rust/issues/96024))
Data providers should implement this method to provide *all* values they are able to provide by using `demand`. [Read more](../any/trait.provider#tymethod.provide)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/alloc/string.rs.html#2500)### impl<T> ToString for Twhere T: [Display](../fmt/trait.display "trait std::fmt::Display") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/alloc/string.rs.html#2506)#### default fn to\_string(&self) -> String
Converts the given value to a `String`. [Read more](../string/trait.tostring#tymethod.to_string)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
rust Function std::alloc::set_alloc_error_hook Function std::alloc::set\_alloc\_error\_hook
============================================
```
pub fn set_alloc_error_hook(hook: fn(_: Layout))
```
🔬This is a nightly-only experimental API. (`alloc_error_hook` [#51245](https://github.com/rust-lang/rust/issues/51245))
Registers a custom allocation error hook, replacing any that was previously registered.
The allocation error hook is invoked when an infallible memory allocation fails, before the runtime aborts. The default hook prints a message to standard error, but this behavior can be customized with the [`set_alloc_error_hook`](fn.set_alloc_error_hook "set_alloc_error_hook") and [`take_alloc_error_hook`](fn.take_alloc_error_hook "take_alloc_error_hook") functions.
The hook is provided with a `Layout` struct which contains information about the allocation that failed.
The allocation error hook is a global resource.
Examples
--------
```
#![feature(alloc_error_hook)]
use std::alloc::{Layout, set_alloc_error_hook};
fn custom_alloc_error_hook(layout: Layout) {
panic!("memory allocation of {} bytes failed", layout.size());
}
set_alloc_error_hook(custom_alloc_error_hook);
```
rust Struct std::alloc::AllocError Struct std::alloc::AllocError
=============================
```
pub struct AllocError;
```
🔬This is a nightly-only experimental API. (`allocator_api` [#32838](https://github.com/rust-lang/rust/issues/32838))
The `AllocError` error indicates an allocation failure that may be due to resource exhaustion or to something wrong when combining the given input arguments with this allocator.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/alloc/mod.rs.html#34)### impl Clone for AllocError
[source](https://doc.rust-lang.org/src/core/alloc/mod.rs.html#34)#### fn clone(&self) -> AllocError
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)1.0.0 · #### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/core/alloc/mod.rs.html#34)### impl Debug for AllocError
[source](https://doc.rust-lang.org/src/core/alloc/mod.rs.html#34)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/alloc/mod.rs.html#47)### impl Display for AllocError
[source](https://doc.rust-lang.org/src/core/alloc/mod.rs.html#48)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.display#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/alloc/mod.rs.html#43)### impl Error for AllocError
[source](https://doc.rust-lang.org/src/core/error.rs.html#83)1.30.0 · #### fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. [Read more](../error/trait.error#method.source)
[source](https://doc.rust-lang.org/src/core/error.rs.html#109)1.0.0 · #### fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to\_string()
[Read more](../error/trait.error#method.description)
[source](https://doc.rust-lang.org/src/core/error.rs.html#119)1.0.0 · #### fn cause(&self) -> Option<&dyn Error>
👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
[source](https://doc.rust-lang.org/src/core/error.rs.html#193)#### fn provide(&'a self, demand: &mut Demand<'a>)
🔬This is a nightly-only experimental API. (`error_generic_member_access` [#99301](https://github.com/rust-lang/rust/issues/99301))
Provides type based access to context intended for error reports. [Read more](../error/trait.error#method.provide)
[source](https://doc.rust-lang.org/src/core/alloc/mod.rs.html#34)### impl PartialEq<AllocError> for AllocError
[source](https://doc.rust-lang.org/src/core/alloc/mod.rs.html#34)#### fn eq(&self, other: &AllocError) -> bool
This method tests for `self` and `other` values to be equal, and is used by `==`. [Read more](../cmp/trait.partialeq#tymethod.eq)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#236)1.0.0 · #### fn ne(&self, other: &Rhs) -> bool
This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. [Read more](../cmp/trait.partialeq#method.ne)
[source](https://doc.rust-lang.org/src/core/alloc/mod.rs.html#34)### impl Copy for AllocError
[source](https://doc.rust-lang.org/src/core/alloc/mod.rs.html#34)### impl Eq for AllocError
[source](https://doc.rust-lang.org/src/core/alloc/mod.rs.html#34)### impl StructuralEq for AllocError
[source](https://doc.rust-lang.org/src/core/alloc/mod.rs.html#34)### impl StructuralPartialEq for AllocError
Auto Trait Implementations
--------------------------
### impl RefUnwindSafe for AllocError
### impl Send for AllocError
### impl Sync for AllocError
### impl Unpin for AllocError
### impl UnwindSafe for AllocError
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/error.rs.html#197)### impl<E> Provider for Ewhere E: [Error](../error/trait.error "trait std::error::Error") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/error.rs.html#201)#### fn provide(&'a self, demand: &mut Demand<'a>)
🔬This is a nightly-only experimental API. (`provide_any` [#96024](https://github.com/rust-lang/rust/issues/96024))
Data providers should implement this method to provide *all* values they are able to provide by using `demand`. [Read more](../any/trait.provider#tymethod.provide)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/alloc/string.rs.html#2500)### impl<T> ToString for Twhere T: [Display](../fmt/trait.display "trait std::fmt::Display") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/alloc/string.rs.html#2506)#### default fn to\_string(&self) -> String
Converts the given value to a `String`. [Read more](../string/trait.tostring#tymethod.to_string)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Trait std::hash::Hash Trait std::hash::Hash
=====================
```
pub trait Hash {
fn hash<H>(&self, state: &mut H) where H: Hasher;
fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher,
{ ... }
}
```
A hashable type.
Types implementing `Hash` are able to be [`hash`](trait.hash#tymethod.hash)ed with an instance of [`Hasher`](trait.hasher "Hasher").
### Implementing `Hash`
You can derive `Hash` with `#[derive(Hash)]` if all fields implement `Hash`. The resulting hash will be the combination of the values from calling [`hash`](trait.hash#tymethod.hash) on each field.
```
#[derive(Hash)]
struct Rustacean {
name: String,
country: String,
}
```
If you need more control over how a value is hashed, you can of course implement the `Hash` trait yourself:
```
use std::hash::{Hash, Hasher};
struct Person {
id: u32,
name: String,
phone: u64,
}
impl Hash for Person {
fn hash<H: Hasher>(&self, state: &mut H) {
self.id.hash(state);
self.phone.hash(state);
}
}
```
###
`Hash` and `Eq`
When implementing both `Hash` and [`Eq`](../cmp/trait.eq "Eq"), it is important that the following property holds:
```
k1 == k2 -> hash(k1) == hash(k2)
```
In other words, if two keys are equal, their hashes must also be equal. [`HashMap`](../collections/struct.hashmap) and [`HashSet`](../collections/struct.hashset) both rely on this behavior.
Thankfully, you won’t need to worry about upholding this property when deriving both [`Eq`](../cmp/trait.eq "Eq") and `Hash` with `#[derive(PartialEq, Eq, Hash)]`.
### Prefix collisions
Implementations of `hash` should ensure that the data they pass to the `Hasher` are prefix-free. That is, unequal values should cause two different sequences of values to be written, and neither of the two sequences should be a prefix of the other.
For example, the standard implementation of [`Hash` for `&str`](../primitive.str#impl-Hash-for-str) passes an extra `0xFF` byte to the `Hasher` so that the values `("ab", "c")` and `("a", "bc")` hash differently.
### Portability
Due to differences in endianness and type sizes, data fed by `Hash` to a `Hasher` should not be considered portable across platforms. Additionally the data passed by most standard library types should not be considered stable between compiler versions.
This means tests shouldn’t probe hard-coded hash values or data fed to a `Hasher` and instead should check consistency with `Eq`.
Serialization formats intended to be portable between platforms or compiler versions should either avoid encoding hashes or only rely on `Hash` and `Hasher` implementations that provide additional guarantees.
Required Methods
----------------
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#200)#### fn hash<H>(&self, state: &mut H)where H: [Hasher](trait.hasher "trait std::hash::Hasher"),
Feeds this value into the given [`Hasher`](trait.hasher "Hasher").
##### Examples
```
use std::collections::hash_map::DefaultHasher;
use std::hash::{Hash, Hasher};
let mut hasher = DefaultHasher::new();
7920.hash(&mut hasher);
println!("Hash is {:x}!", hasher.finish());
```
Provided Methods
----------------
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#237-239)1.3.0 · #### fn hash\_slice<H>(data: &[Self], state: &mut H)where H: [Hasher](trait.hasher "trait std::hash::Hasher"),
Feeds a slice of this type into the given [`Hasher`](trait.hasher "Hasher").
This method is meant as a convenience, but its implementation is also explicitly left unspecified. It isn’t guaranteed to be equivalent to repeated calls of [`hash`](trait.hash#tymethod.hash) and implementations of [`Hash`](trait.hash#tymethod.hash) should keep that in mind and call [`hash`](trait.hash#tymethod.hash) themselves if the slice isn’t treated as a whole unit in the [`PartialEq`](../cmp/trait.partialeq "PartialEq") implementation.
For example, a [`VecDeque`](../collections/struct.vecdeque) implementation might naïvely call [`as_slices`](../collections/struct.vecdeque#method.as_slices) and then [`hash_slice`](trait.hash#method.hash_slice) on each slice, but this is wrong since the two slices can change with a call to [`make_contiguous`](../collections/struct.vecdeque#method.make_contiguous) without affecting the [`PartialEq`](../cmp/trait.partialeq "PartialEq") result. Since these slices aren’t treated as singular units, and instead part of a larger deque, this method cannot be used.
##### Examples
```
use std::collections::hash_map::DefaultHasher;
use std::hash::{Hash, Hasher};
let mut hasher = DefaultHasher::new();
let numbers = [6, 28, 496, 8128];
Hash::hash_slice(&numbers, &mut hasher);
println!("Hash is {:x}!", hasher.finish());
```
Implementors
------------
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#342)### impl Hash for std::cmp::Ordering
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#762)1.44.0 · ### impl Hash for Infallible
[source](https://doc.rust-lang.org/src/std/io/error.rs.html#166)### impl Hash for ErrorKind
[source](https://doc.rust-lang.org/src/std/net/ip_addr.rs.html#34)1.7.0 · ### impl Hash for IpAddr
[source](https://doc.rust-lang.org/src/std/net/ip_addr.rs.html#200)### impl Hash for Ipv6MulticastScope
[source](https://doc.rust-lang.org/src/std/net/socket_addr.rs.html#42)### impl Hash for SocketAddr
[source](https://doc.rust-lang.org/src/core/up/up/portable-simd/crates/core_simd/src/swizzle.rs.html#76)### impl Hash for Which
[source](https://doc.rust-lang.org/src/core/sync/atomic.rs.html#212)### impl Hash for std::sync::atomic::Ordering
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#845)### impl Hash for bool
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#853)### impl Hash for char
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#829-842)### impl Hash for i8
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#829-842)### impl Hash for i16
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#829-842)### impl Hash for i32
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#829-842)### impl Hash for i64
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#829-842)### impl Hash for i128
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#829-842)### impl Hash for isize
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#869)1.29.0 · ### impl Hash for !
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#861)### impl Hash for str
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#829-842)### impl Hash for u8
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#829-842)### impl Hash for u16
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#829-842)### impl Hash for u32
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#829-842)### impl Hash for u64
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#829-842)### impl Hash for u128
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#920)### impl Hash for ()
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#829-842)### impl Hash for usize
[source](https://doc.rust-lang.org/src/core/alloc/layout.rs.html#37)1.28.0 · ### impl Hash for Layout
[source](https://doc.rust-lang.org/src/core/any.rs.html#665)### impl Hash for TypeId
[source](https://doc.rust-lang.org/src/core/ffi/c_str.rs.html#77)1.64.0 · ### impl Hash for CStr
[source](https://doc.rust-lang.org/src/alloc/ffi/c_str.rs.html#109)1.64.0 · ### impl Hash for CString
[source](https://doc.rust-lang.org/src/std/ffi/os_str.rs.html#1244-1249)### impl Hash for OsStr
[source](https://doc.rust-lang.org/src/std/ffi/os_str.rs.html#640-645)### impl Hash for OsString
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#98)### impl Hash for Error
[source](https://doc.rust-lang.org/src/std/fs.rs.html#207)1.1.0 · ### impl Hash for FileType
[source](https://doc.rust-lang.org/src/core/marker.rs.html#776)1.33.0 · ### impl Hash for PhantomPinned
[source](https://doc.rust-lang.org/src/std/net/ip_addr.rs.html#75)### impl Hash for Ipv4Addr
[source](https://doc.rust-lang.org/src/std/net/ip_addr.rs.html#158)### impl Hash for Ipv6Addr
[source](https://doc.rust-lang.org/src/std/net/socket_addr.rs.html#707-711)### impl Hash for SocketAddrV4
[source](https://doc.rust-lang.org/src/std/net/socket_addr.rs.html#713-717)### impl Hash for SocketAddrV6
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.34.0 · ### impl Hash for NonZeroI8
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.34.0 · ### impl Hash for NonZeroI16
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.34.0 · ### impl Hash for NonZeroI32
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.34.0 · ### impl Hash for NonZeroI64
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.34.0 · ### impl Hash for NonZeroI128
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.34.0 · ### impl Hash for NonZeroIsize
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.28.0 · ### impl Hash for NonZeroU8
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.28.0 · ### impl Hash for NonZeroU16
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.28.0 · ### impl Hash for NonZeroU32
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.28.0 · ### impl Hash for NonZeroU64
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.28.0 · ### impl Hash for NonZeroU128
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.28.0 · ### impl Hash for NonZeroUsize
[source](https://doc.rust-lang.org/src/core/ops/range.rs.html#41)### impl Hash for RangeFull
[source](https://doc.rust-lang.org/src/std/os/unix/ucred.rs.html#13)### impl Hash for UCred
Available on **Unix** only.[source](https://doc.rust-lang.org/src/std/path.rs.html#2931-2979)### impl Hash for Path
[source](https://doc.rust-lang.org/src/std/path.rs.html#1854-1858)### impl Hash for PathBuf
[source](https://doc.rust-lang.org/src/std/path.rs.html#477-481)### impl Hash for PrefixComponent<'\_>
[source](https://doc.rust-lang.org/src/alloc/string.rs.html#2262)### impl Hash for String
[source](https://doc.rust-lang.org/src/std/thread/mod.rs.html#1039)1.19.0 · ### impl Hash for ThreadId
[source](https://doc.rust-lang.org/src/core/time.rs.html#70)1.3.0 · ### impl Hash for Duration
[source](https://doc.rust-lang.org/src/std/time.rs.html#152)1.8.0 · ### impl Hash for Instant
[source](https://doc.rust-lang.org/src/std/time.rs.html#237)1.8.0 · ### impl Hash for SystemTime
[source](https://doc.rust-lang.org/src/std/path.rs.html#505)### impl<'a> Hash for Component<'a>
[source](https://doc.rust-lang.org/src/std/path.rs.html#141)### impl<'a> Hash for Prefix<'a>
[source](https://doc.rust-lang.org/src/core/panic/location.rs.html#31)1.10.0 · ### impl<'a> Hash for Location<'a>
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#422)### impl<B> Hash for Cow<'\_, B>where B: [Hash](trait.hash "trait std::hash::Hash") + [ToOwned](../borrow/trait.toowned "trait std::borrow::ToOwned") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/ptr/metadata.rs.html#267)### impl<Dyn> Hash for DynMetadata<Dyn>where Dyn: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/ops/range.rs.html#78)### impl<Idx> Hash for Range<Idx>where Idx: [Hash](trait.hash "trait std::hash::Hash"),
[source](https://doc.rust-lang.org/src/core/ops/range.rs.html#185)### impl<Idx> Hash for RangeFrom<Idx>where Idx: [Hash](trait.hash "trait std::hash::Hash"),
[source](https://doc.rust-lang.org/src/core/ops/range.rs.html#339)1.26.0 · ### impl<Idx> Hash for RangeInclusive<Idx>where Idx: [Hash](trait.hash "trait std::hash::Hash"),
[source](https://doc.rust-lang.org/src/core/ops/range.rs.html#266)### impl<Idx> Hash for RangeTo<Idx>where Idx: [Hash](trait.hash "trait std::hash::Hash"),
[source](https://doc.rust-lang.org/src/core/ops/range.rs.html#584)1.26.0 · ### impl<Idx> Hash for RangeToInclusive<Idx>where Idx: [Hash](trait.hash "trait std::hash::Hash"),
[source](https://doc.rust-lang.org/src/alloc/collections/btree/map.rs.html#2154)### impl<K, V, A> Hash for BTreeMap<K, V, A>where K: [Hash](trait.hash "trait std::hash::Hash"), V: [Hash](trait.hash "trait std::hash::Hash"), A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator") + [Clone](../clone/trait.clone "trait std::clone::Clone"),
[source](https://doc.rust-lang.org/src/core/pin.rs.html#476)1.41.0 · ### impl<P> Hash for Pin<P>where P: [Deref](../ops/trait.deref "trait std::ops::Deref"), <P as [Deref](../ops/trait.deref "trait std::ops::Deref")>::[Target](../ops/trait.deref#associatedtype.Target "type std::ops::Deref::Target"): [Hash](trait.hash "trait std::hash::Hash"),
[source](https://doc.rust-lang.org/src/core/ptr/mod.rs.html#1949)1.4.0 · ### impl<Ret, T> Hash for fn (T₁, T₂, …, Tₙ) -> Ret
This trait is implemented for function pointers with up to twelve arguments.
[source](https://doc.rust-lang.org/src/core/ptr/mod.rs.html#1949)1.4.0 · ### impl<Ret, T> Hash for extern "C" fn (T₁, T₂, …, Tₙ) -> Ret
This trait is implemented for function pointers with up to twelve arguments.
[source](https://doc.rust-lang.org/src/core/ptr/mod.rs.html#1949)1.4.0 · ### impl<Ret, T> Hash for extern "C" fn (T₁, T₂, …, Tₙ, ...) -> Ret
This trait is implemented for function pointers with up to twelve arguments.
[source](https://doc.rust-lang.org/src/core/ptr/mod.rs.html#1949)1.4.0 · ### impl<Ret, T> Hash for unsafe fn (T₁, T₂, …, Tₙ) -> Ret
This trait is implemented for function pointers with up to twelve arguments.
[source](https://doc.rust-lang.org/src/core/ptr/mod.rs.html#1949)1.4.0 · ### impl<Ret, T> Hash for unsafe extern "C" fn (T₁, T₂, …, Tₙ) -> Ret
This trait is implemented for function pointers with up to twelve arguments.
[source](https://doc.rust-lang.org/src/core/ptr/mod.rs.html#1949)1.4.0 · ### impl<Ret, T> Hash for unsafe extern "C" fn (T₁, T₂, …, Tₙ, ...) -> Ret
This trait is implemented for function pointers with up to twelve arguments.
[source](https://doc.rust-lang.org/src/core/ops/range.rs.html#664)1.17.0 · ### impl<T> Hash for Bound<T>where T: [Hash](trait.hash "trait std::hash::Hash"),
[source](https://doc.rust-lang.org/src/core/option.rs.html#515)### impl<T> Hash for Option<T>where T: [Hash](trait.hash "trait std::hash::Hash"),
[source](https://doc.rust-lang.org/src/core/task/poll.rs.html#11)1.36.0 · ### impl<T> Hash for Poll<T>where T: [Hash](trait.hash "trait std::hash::Hash"),
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#960)### impl<T> Hash for \*const Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#970)### impl<T> Hash for \*mut Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#944)### impl<T> Hash for &Twhere T: [Hash](trait.hash "trait std::hash::Hash") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#952)### impl<T> Hash for &mut Twhere T: [Hash](trait.hash "trait std::hash::Hash") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#935)### impl<T> Hash for [T]where T: [Hash](trait.hash "trait std::hash::Hash"),
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#921)### impl<T> Hash for (T₁, T₂, …, Tₙ)where T: [Hash](trait.hash "trait std::hash::Hash") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
This trait is implemented for tuples up to twelve items long.
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#606)1.19.0 · ### impl<T> Hash for Reverse<T>where T: [Hash](trait.hash "trait std::hash::Hash"),
[source](https://doc.rust-lang.org/src/alloc/collections/linked_list.rs.html#1945)### impl<T> Hash for LinkedList<T>where T: [Hash](trait.hash "trait std::hash::Hash"),
[source](https://doc.rust-lang.org/src/core/marker.rs.html#680)### impl<T> Hash for PhantomData<T>where T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/mem/mod.rs.html#1101)1.21.0 · ### impl<T> Hash for Discriminant<T>
[source](https://doc.rust-lang.org/src/core/mem/manually_drop.rs.html#48)1.20.0 · ### impl<T> Hash for ManuallyDrop<T>where T: [Hash](trait.hash "trait std::hash::Hash") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/num/saturating.rs.html#36)### impl<T> Hash for Saturating<T>where T: [Hash](trait.hash "trait std::hash::Hash"),
[source](https://doc.rust-lang.org/src/core/num/wrapping.rs.html#40)### impl<T> Hash for Wrapping<T>where T: [Hash](trait.hash "trait std::hash::Hash"),
[source](https://doc.rust-lang.org/src/core/ptr/non_null.rs.html#759)1.25.0 · ### impl<T> Hash for NonNull<T>where T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/alloc/rc.rs.html#1830)### impl<T> Hash for Rc<T>where T: [Hash](trait.hash "trait std::hash::Hash") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/alloc/sync.rs.html#2454)### impl<T> Hash for Arc<T>where T: [Hash](trait.hash "trait std::hash::Hash") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#1381)### impl<T, A> Hash for Box<T, A>where T: [Hash](trait.hash "trait std::hash::Hash") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"), A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator"),
[source](https://doc.rust-lang.org/src/alloc/collections/btree/set.rs.html#89)### impl<T, A> Hash for BTreeSet<T, A>where T: [Hash](trait.hash "trait std::hash::Hash"), A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator") + [Clone](../clone/trait.clone "trait std::clone::Clone"),
[source](https://doc.rust-lang.org/src/alloc/collections/vec_deque/mod.rs.html#2914)### impl<T, A> Hash for VecDeque<T, A>where T: [Hash](trait.hash "trait std::hash::Hash"), A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator"),
[source](https://doc.rust-lang.org/src/alloc/vec/mod.rs.html#2611)### impl<T, A> Hash for Vec<T, A>where T: [Hash](trait.hash "trait std::hash::Hash"), A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator"),
The hash of a vector is the same as that of the corresponding slice, as required by the `core::borrow::Borrow` implementation.
```
#![feature(build_hasher_simple_hash_one)]
use std::hash::BuildHasher;
let b = std::collections::hash_map::RandomState::new();
let v: Vec<u8> = vec![0xa8, 0x3c, 0x09];
let s: &[u8] = &[0xa8, 0x3c, 0x09];
assert_eq!(b.hash_one(v), b.hash_one(s));
```
[source](https://doc.rust-lang.org/src/core/result.rs.html#500)### impl<T, E> Hash for Result<T, E>where T: [Hash](trait.hash "trait std::hash::Hash"), E: [Hash](trait.hash "trait std::hash::Hash"),
[source](https://doc.rust-lang.org/src/core/up/up/portable-simd/crates/core_simd/src/vector.rs.html#561)### impl<T, const LANES: usize> Hash for Simd<T, LANES>where T: [SimdElement](../simd/trait.simdelement "trait std::simd::SimdElement") + [Hash](trait.hash "trait std::hash::Hash"), [LaneCount](../simd/struct.lanecount "struct std::simd::LaneCount")<LANES>: [SupportedLaneCount](../simd/trait.supportedlanecount "trait std::simd::SupportedLaneCount"),
[source](https://doc.rust-lang.org/src/core/array/mod.rs.html#254)### impl<T, const N: usize> Hash for [T; N]where T: [Hash](trait.hash "trait std::hash::Hash"),
The hash of an array is the same as that of the corresponding slice, as required by the `Borrow` implementation.
```
#![feature(build_hasher_simple_hash_one)]
use std::hash::BuildHasher;
let b = std::collections::hash_map::RandomState::new();
let a: [u8; 3] = [0xa8, 0x3c, 0x09];
let s: &[u8] = &[0xa8, 0x3c, 0x09];
assert_eq!(b.hash_one(a), b.hash_one(s));
```
[source](https://doc.rust-lang.org/src/core/ops/generator.rs.html#9)### impl<Y, R> Hash for GeneratorState<Y, R>where Y: [Hash](trait.hash "trait std::hash::Hash"), R: [Hash](trait.hash "trait std::hash::Hash"),
| programming_docs |
rust Module std::hash Module std::hash
================
Generic hashing support.
This module provides a generic way to compute the [hash](https://en.wikipedia.org/wiki/Hash_function) of a value. Hashes are most commonly used with [`HashMap`](../collections/struct.hashmap) and [`HashSet`](../collections/struct.hashset).
The simplest way to make a type hashable is to use `#[derive(Hash)]`:
Examples
--------
```
use std::collections::hash_map::DefaultHasher;
use std::hash::{Hash, Hasher};
#[derive(Hash)]
struct Person {
id: u32,
name: String,
phone: u64,
}
let person1 = Person {
id: 5,
name: "Janet".to_string(),
phone: 555_666_7777,
};
let person2 = Person {
id: 5,
name: "Bob".to_string(),
phone: 555_666_7777,
};
assert!(calculate_hash(&person1) != calculate_hash(&person2));
fn calculate_hash<T: Hash>(t: &T) -> u64 {
let mut s = DefaultHasher::new();
t.hash(&mut s);
s.finish()
}
```
If you need more control over how a value is hashed, you need to implement the [`Hash`](trait.hash "Hash") trait:
```
use std::collections::hash_map::DefaultHasher;
use std::hash::{Hash, Hasher};
struct Person {
id: u32,
name: String,
phone: u64,
}
impl Hash for Person {
fn hash<H: Hasher>(&self, state: &mut H) {
self.id.hash(state);
self.phone.hash(state);
}
}
let person1 = Person {
id: 5,
name: "Janet".to_string(),
phone: 555_666_7777,
};
let person2 = Person {
id: 5,
name: "Bob".to_string(),
phone: 555_666_7777,
};
assert_eq!(calculate_hash(&person1), calculate_hash(&person2));
fn calculate_hash<T: Hash>(t: &T) -> u64 {
let mut s = DefaultHasher::new();
t.hash(&mut s);
s.finish()
}
```
Macros
------
[Hash](macro.hash "std::hash::Hash macro")
Derive macro generating an impl of the trait `Hash`.
Structs
-------
[BuildHasherDefault](struct.buildhasherdefault "std::hash::BuildHasherDefault struct")
Used to create a default [`BuildHasher`](trait.buildhasher "BuildHasher") instance for types that implement [`Hasher`](trait.hasher "Hasher") and [`Default`](../default/trait.default "Default").
[SipHasher](struct.siphasher "std::hash::SipHasher struct")Deprecated
An implementation of SipHash 2-4.
Traits
------
[BuildHasher](trait.buildhasher "std::hash::BuildHasher trait")
A trait for creating instances of [`Hasher`](trait.hasher "Hasher").
[Hash](trait.hash "std::hash::Hash trait")
A hashable type.
[Hasher](trait.hasher "std::hash::Hasher trait")
A trait for hashing an arbitrary stream of bytes.
rust Trait std::hash::Hasher Trait std::hash::Hasher
=======================
```
pub trait Hasher {
Show 16 methods fn finish(&self) -> u64;
fn write(&mut self, bytes: &[u8]);
fn write_u8(&mut self, i: u8) { ... }
fn write_u16(&mut self, i: u16) { ... }
fn write_u32(&mut self, i: u32) { ... }
fn write_u64(&mut self, i: u64) { ... }
fn write_u128(&mut self, i: u128) { ... }
fn write_usize(&mut self, i: usize) { ... }
fn write_i8(&mut self, i: i8) { ... }
fn write_i16(&mut self, i: i16) { ... }
fn write_i32(&mut self, i: i32) { ... }
fn write_i64(&mut self, i: i64) { ... }
fn write_i128(&mut self, i: i128) { ... }
fn write_isize(&mut self, i: isize) { ... }
fn write_length_prefix(&mut self, len: usize) { ... }
fn write_str(&mut self, s: &str) { ... }
}
```
A trait for hashing an arbitrary stream of bytes.
Instances of `Hasher` usually represent state that is changed while hashing data.
`Hasher` provides a fairly basic interface for retrieving the generated hash (with [`finish`](trait.hasher#tymethod.finish)), and writing integers as well as slices of bytes into an instance (with [`write`](trait.hasher#tymethod.write) and [`write_u8`](trait.hasher#method.write_u8) etc.). Most of the time, `Hasher` instances are used in conjunction with the [`Hash`](trait.hash "Hash") trait.
This trait provides no guarantees about how the various `write_*` methods are defined and implementations of [`Hash`](trait.hash "Hash") should not assume that they work one way or another. You cannot assume, for example, that a [`write_u32`](trait.hasher#method.write_u32) call is equivalent to four calls of [`write_u8`](trait.hasher#method.write_u8). Nor can you assume that adjacent `write` calls are merged, so it’s possible, for example, that
```
hasher.write(&[1, 2]);
hasher.write(&[3, 4, 5, 6]);
```
and
```
hasher.write(&[1, 2, 3, 4]);
hasher.write(&[5, 6]);
```
end up producing different hashes.
Thus to produce the same hash value, [`Hash`](trait.hash "Hash") implementations must ensure for equivalent items that exactly the same sequence of calls is made – the same methods with the same parameters in the same order.
Examples
--------
```
use std::collections::hash_map::DefaultHasher;
use std::hash::Hasher;
let mut hasher = DefaultHasher::new();
hasher.write_u32(1989);
hasher.write_u8(11);
hasher.write_u8(9);
hasher.write(b"Huh?");
println!("Hash is {:x}!", hasher.finish());
```
Required Methods
----------------
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#338)#### fn finish(&self) -> u64
Returns the hash value for the values written so far.
Despite its name, the method does not reset the hasher’s internal state. Additional [`write`](trait.hasher#tymethod.write)s will continue from the current value. If you need to start a fresh hash value, you will have to create a new hasher.
##### Examples
```
use std::collections::hash_map::DefaultHasher;
use std::hash::Hasher;
let mut hasher = DefaultHasher::new();
hasher.write(b"Cool!");
println!("Hash is {:x}!", hasher.finish());
```
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#362)#### fn write(&mut self, bytes: &[u8])
Writes some data into this `Hasher`.
##### Examples
```
use std::collections::hash_map::DefaultHasher;
use std::hash::Hasher;
let mut hasher = DefaultHasher::new();
let data = [0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef];
hasher.write(&data);
println!("Hash is {:x}!", hasher.finish());
```
##### Note to Implementers
You generally should not do length-prefixing as part of implementing this method. It’s up to the [`Hash`](trait.hash "Hash") implementation to call [`Hasher::write_length_prefix`](trait.hasher#method.write_length_prefix "Hasher::write_length_prefix") before sequences that need it.
Provided Methods
----------------
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#367)1.3.0 · #### fn write\_u8(&mut self, i: u8)
Writes a single `u8` into this hasher.
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#373)1.3.0 · #### fn write\_u16(&mut self, i: u16)
Writes a single `u16` into this hasher.
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#379)1.3.0 · #### fn write\_u32(&mut self, i: u32)
Writes a single `u32` into this hasher.
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#385)1.3.0 · #### fn write\_u64(&mut self, i: u64)
Writes a single `u64` into this hasher.
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#391)1.26.0 · #### fn write\_u128(&mut self, i: u128)
Writes a single `u128` into this hasher.
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#397)1.3.0 · #### fn write\_usize(&mut self, i: usize)
Writes a single `usize` into this hasher.
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#404)1.3.0 · #### fn write\_i8(&mut self, i: i8)
Writes a single `i8` into this hasher.
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#410)1.3.0 · #### fn write\_i16(&mut self, i: i16)
Writes a single `i16` into this hasher.
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#416)1.3.0 · #### fn write\_i32(&mut self, i: i32)
Writes a single `i32` into this hasher.
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#422)1.3.0 · #### fn write\_i64(&mut self, i: i64)
Writes a single `i64` into this hasher.
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#428)1.26.0 · #### fn write\_i128(&mut self, i: i128)
Writes a single `i128` into this hasher.
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#434)1.3.0 · #### fn write\_isize(&mut self, i: isize)
Writes a single `isize` into this hasher.
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#487)#### fn write\_length\_prefix(&mut self, len: usize)
🔬This is a nightly-only experimental API. (`hasher_prefixfree_extras` [#96762](https://github.com/rust-lang/rust/issues/96762))
Writes a length prefix into this hasher, as part of being prefix-free.
If you’re implementing [`Hash`](trait.hash "Hash") for a custom collection, call this before writing its contents to this `Hasher`. That way `(collection![1, 2, 3], collection![4, 5])` and `(collection![1, 2], collection![3, 4, 5])` will provide different sequences of values to the `Hasher`
The `impl<T> Hash for [T]` includes a call to this method, so if you’re hashing a slice (or array or vector) via its `Hash::hash` method, you should **not** call this yourself.
This method is only for providing domain separation. If you want to hash a `usize` that represents part of the *data*, then it’s important that you pass it to [`Hasher::write_usize`](trait.hasher#method.write_usize "Hasher::write_usize") instead of to this method.
##### Examples
```
#![feature(hasher_prefixfree_extras)]
use std::hash::{Hash, Hasher};
impl<T: Hash> Hash for MyCollection<T> {
fn hash<H: Hasher>(&self, state: &mut H) {
state.write_length_prefix(self.len());
for elt in self {
elt.hash(state);
}
}
}
```
##### Note to Implementers
If you’ve decided that your `Hasher` is willing to be susceptible to Hash-DoS attacks, then you might consider skipping hashing some or all of the `len` provided in the name of increased performance.
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#554)#### fn write\_str(&mut self, s: &str)
🔬This is a nightly-only experimental API. (`hasher_prefixfree_extras` [#96762](https://github.com/rust-lang/rust/issues/96762))
Writes a single `str` into this hasher.
If you’re implementing [`Hash`](trait.hash "Hash"), you generally do not need to call this, as the `impl Hash for str` does, so you should prefer that instead.
This includes the domain separator for prefix-freedom, so you should **not** call `Self::write_length_prefix` before calling this.
##### Note to Implementers
There are at least two reasonable default ways to implement this. Which one will be the default is not yet decided, so for now you probably want to override it specifically.
###### [The general answer](#the-general-answer)
It’s always correct to implement this with a length prefix:
```
fn write_str(&mut self, s: &str) {
self.write_length_prefix(s.len());
self.write(s.as_bytes());
}
```
And, if your `Hasher` works in `usize` chunks, this is likely a very efficient way to do it, as anything more complicated may well end up slower than just running the round with the length.
###### [If your `Hasher` works byte-wise](#if-your-hasher-works-byte-wise)
One nice thing about `str` being UTF-8 is that the `b'\xFF'` byte never happens. That means that you can append that to the byte stream being hashed and maintain prefix-freedom:
```
fn write_str(&mut self, s: &str) {
self.write(s.as_bytes());
self.write_u8(0xff);
}
```
This does require that your implementation not add extra padding, and thus generally requires that you maintain a buffer, running a round only once that buffer is full (or `finish` is called).
That’s because if `write` pads data out to a fixed chunk size, it’s likely that it does it in such a way that `"a"` and `"a\x00"` would end up hashing the same sequence of things, introducing conflicts.
Implementors
------------
[source](https://doc.rust-lang.org/src/std/collections/hash/map.rs.html#3184-3202)1.13.0 · ### impl Hasher for DefaultHasher
[source](https://doc.rust-lang.org/src/core/hash/sip.rs.html#223)### impl Hasher for SipHasher
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#561)1.22.0 · ### impl<H> Hasher for &mut Hwhere H: [Hasher](trait.hasher "trait std::hash::Hasher") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#1388)1.22.0 · ### impl<T, A> Hasher for Box<T, A>where T: [Hasher](trait.hasher "trait std::hash::Hasher") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"), A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator"),
rust Struct std::hash::BuildHasherDefault Struct std::hash::BuildHasherDefault
====================================
```
pub struct BuildHasherDefault<H>(_);
```
Used to create a default [`BuildHasher`](trait.buildhasher "BuildHasher") instance for types that implement [`Hasher`](trait.hasher "Hasher") and [`Default`](../default/trait.default "Default").
`BuildHasherDefault<H>` can be used when a type `H` implements [`Hasher`](trait.hasher "Hasher") and [`Default`](../default/trait.default "Default"), and you need a corresponding [`BuildHasher`](trait.buildhasher "BuildHasher") instance, but none is defined.
Any `BuildHasherDefault` is [zero-sized](https://doc.rust-lang.org/nomicon/exotic-sizes.html#zero-sized-types-zsts). It can be created with [`default`](struct.buildhasherdefault#method.default). When using `BuildHasherDefault` with [`HashMap`](../collections/struct.hashmap) or [`HashSet`](../collections/struct.hashset), this doesn’t need to be done, since they implement appropriate [`Default`](../default/trait.default "Default") instances themselves.
Examples
--------
Using `BuildHasherDefault` to specify a custom [`BuildHasher`](trait.buildhasher "BuildHasher") for [`HashMap`](../collections/struct.hashmap):
```
use std::collections::HashMap;
use std::hash::{BuildHasherDefault, Hasher};
#[derive(Default)]
struct MyHasher;
impl Hasher for MyHasher {
fn write(&mut self, bytes: &[u8]) {
// Your hashing algorithm goes here!
unimplemented!()
}
fn finish(&self) -> u64 {
// Your hashing algorithm goes here!
unimplemented!()
}
}
type MyBuildHasher = BuildHasherDefault<MyHasher>;
let hash_map = HashMap::<u32, u32, MyBuildHasher>::default();
```
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#767)### impl<H> BuildHasher for BuildHasherDefault<H>where H: [Default](../default/trait.default "trait std::default::Default") + [Hasher](trait.hasher "trait std::hash::Hasher"),
#### type Hasher = H
Type of the hasher that will be created.
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#770)#### fn build\_hasher(&self) -> H
Creates a new hasher. [Read more](trait.buildhasher#tymethod.build_hasher)
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#701-703)#### fn hash\_one<T>(&self, x: T) -> u64where T: [Hash](trait.hash "trait std::hash::Hash"),
🔬This is a nightly-only experimental API. (`build_hasher_simple_hash_one` [#86161](https://github.com/rust-lang/rust/issues/86161))
Calculates the hash of a single value. [Read more](trait.buildhasher#method.hash_one)
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#776)### impl<H> Clone for BuildHasherDefault<H>
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#777)#### fn clone(&self) -> BuildHasherDefault<H>
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)1.0.0 · #### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#760)1.9.0 · ### impl<H> Debug for BuildHasherDefault<H>
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#761)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#784)const: [unstable](https://github.com/rust-lang/rust/issues/87864 "Tracking issue for const_default_impls") · ### impl<H> Default for BuildHasherDefault<H>
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#785)const: [unstable](https://github.com/rust-lang/rust/issues/87864 "Tracking issue for const_default_impls") · #### fn default() -> BuildHasherDefault<H>
Returns the “default value” for a type. [Read more](../default/trait.default#tymethod.default)
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#791)1.29.0 · ### impl<H> PartialEq<BuildHasherDefault<H>> for BuildHasherDefault<H>
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#792)#### fn eq(&self, \_other: &BuildHasherDefault<H>) -> bool
This method tests for `self` and `other` values to be equal, and is used by `==`. [Read more](../cmp/trait.partialeq#tymethod.eq)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#236)1.0.0 · #### fn ne(&self, other: &Rhs) -> bool
This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. [Read more](../cmp/trait.partialeq#method.ne)
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#798)1.29.0 · ### impl<H> Eq for BuildHasherDefault<H>
Auto Trait Implementations
--------------------------
### impl<H> RefUnwindSafe for BuildHasherDefault<H>
### impl<H> Send for BuildHasherDefault<H>
### impl<H> Sync for BuildHasherDefault<H>
### impl<H> Unpin for BuildHasherDefault<H>
### impl<H> UnwindSafe for BuildHasherDefault<H>
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Trait std::hash::BuildHasher Trait std::hash::BuildHasher
============================
```
pub trait BuildHasher {
type Hasher: Hasher;
fn build_hasher(&self) -> Self::Hasher;
fn hash_one<T>(&self, x: T) -> u64 where T: Hash,
{ ... }
}
```
A trait for creating instances of [`Hasher`](trait.hasher "Hasher").
A `BuildHasher` is typically used (e.g., by [`HashMap`](../collections/struct.hashmap)) to create [`Hasher`](trait.hasher "Hasher")s for each key such that they are hashed independently of one another, since [`Hasher`](trait.hasher "Hasher")s contain state.
For each instance of `BuildHasher`, the [`Hasher`](trait.hasher "Hasher")s created by [`build_hasher`](trait.buildhasher#tymethod.build_hasher) should be identical. That is, if the same stream of bytes is fed into each hasher, the same output will also be generated.
Examples
--------
```
use std::collections::hash_map::RandomState;
use std::hash::{BuildHasher, Hasher};
let s = RandomState::new();
let mut hasher_1 = s.build_hasher();
let mut hasher_2 = s.build_hasher();
hasher_1.write_u32(8128);
hasher_2.write_u32(8128);
assert_eq!(hasher_1.finish(), hasher_2.finish());
```
Required Associated Types
-------------------------
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#644)#### type Hasher: Hasher
Type of the hasher that will be created.
Required Methods
----------------
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#661)#### fn build\_hasher(&self) -> Self::Hasher
Creates a new hasher.
Each call to `build_hasher` on the same instance should produce identical [`Hasher`](trait.hasher "Hasher")s.
##### Examples
```
use std::collections::hash_map::RandomState;
use std::hash::BuildHasher;
let s = RandomState::new();
let new_s = s.build_hasher();
```
Provided Methods
----------------
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#701-703)#### fn hash\_one<T>(&self, x: T) -> u64where T: [Hash](trait.hash "trait std::hash::Hash"),
🔬This is a nightly-only experimental API. (`build_hasher_simple_hash_one` [#86161](https://github.com/rust-lang/rust/issues/86161))
Calculates the hash of a single value.
This is intended as a convenience for code which *consumes* hashes, such as the implementation of a hash table or in unit tests that check whether a custom [`Hash`](trait.hash "Hash") implementation behaves as expected.
This must not be used in any code which *creates* hashes, such as in an implementation of [`Hash`](trait.hash "Hash"). The way to create a combined hash of multiple values is to call [`Hash::hash`](trait.hash#tymethod.hash "Hash::hash") multiple times using the same [`Hasher`](trait.hasher "Hasher"), not to call this method repeatedly and combine the results.
##### Example
```
#![feature(build_hasher_simple_hash_one)]
use std::cmp::{max, min};
use std::hash::{BuildHasher, Hash, Hasher};
struct OrderAmbivalentPair<T: Ord>(T, T);
impl<T: Ord + Hash> Hash for OrderAmbivalentPair<T> {
fn hash<H: Hasher>(&self, hasher: &mut H) {
min(&self.0, &self.1).hash(hasher);
max(&self.0, &self.1).hash(hasher);
}
}
// Then later, in a `#[test]` for the type...
let bh = std::collections::hash_map::RandomState::new();
assert_eq!(
bh.hash_one(OrderAmbivalentPair(1, 2)),
bh.hash_one(OrderAmbivalentPair(2, 1))
);
assert_eq!(
bh.hash_one(OrderAmbivalentPair(10, 2)),
bh.hash_one(&OrderAmbivalentPair(2, 10))
);
```
Implementors
------------
[source](https://doc.rust-lang.org/src/std/collections/hash/map.rs.html#3138-3145)### impl BuildHasher for RandomState
#### type Hasher = DefaultHasher
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#767)### impl<H> BuildHasher for BuildHasherDefault<H>where H: [Default](../default/trait.default "trait std::default::Default") + [Hasher](trait.hasher "trait std::hash::Hasher"),
#### type Hasher = H
rust Macro std::hash::Hash Macro std::hash::Hash
=====================
```
pub macro Hash($item:item) {
...
}
```
Derive macro generating an impl of the trait `Hash`.
rust Struct std::hash::SipHasher Struct std::hash::SipHasher
===========================
```
pub struct SipHasher(_);
```
👎Deprecated since 1.13.0: use `std::collections::hash_map::DefaultHasher` instead
An implementation of SipHash 2-4.
See: <https://131002.net/siphash/>
SipHash is a general-purpose hashing function: it runs at a good speed (competitive with Spooky and City) and permits strong *keyed* hashing. This lets you key your hash tables from a strong RNG, such as [`rand::os::OsRng`](https://docs.rs/rand/latest/rand/rngs/struct.OsRng.html).
Although the SipHash algorithm is considered to be generally strong, it is not intended for cryptographic purposes. As such, all cryptographic uses of this implementation are *strongly discouraged*.
Implementations
---------------
[source](https://doc.rust-lang.org/src/core/hash/sip.rs.html#145)### impl SipHasher
[source](https://doc.rust-lang.org/src/core/hash/sip.rs.html#154)#### pub fn new() -> SipHasher
👎Deprecated since 1.13.0: use `std::collections::hash_map::DefaultHasher` instead
Creates a new `SipHasher` with the two initial keys set to 0.
[source](https://doc.rust-lang.org/src/core/hash/sip.rs.html#166)#### pub fn new\_with\_keys(key0: u64, key1: u64) -> SipHasher
👎Deprecated since 1.13.0: use `std::collections::hash_map::DefaultHasher` instead
Creates a `SipHasher` that is keyed off the provided keys.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/hash/sip.rs.html#48)### impl Clone for SipHasher
[source](https://doc.rust-lang.org/src/core/hash/sip.rs.html#48)#### fn clone(&self) -> SipHasher
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)#### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/core/hash/sip.rs.html#48)### impl Debug for SipHasher
[source](https://doc.rust-lang.org/src/core/hash/sip.rs.html#48)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/hash/sip.rs.html#48)### impl Default for SipHasher
[source](https://doc.rust-lang.org/src/core/hash/sip.rs.html#48)#### fn default() -> SipHasher
Returns the “default value” for a type. [Read more](../default/trait.default#tymethod.default)
[source](https://doc.rust-lang.org/src/core/hash/sip.rs.html#223)### impl Hasher for SipHasher
[source](https://doc.rust-lang.org/src/core/hash/sip.rs.html#225)#### fn write(&mut self, msg: &[u8])
Writes some data into this `Hasher`. [Read more](trait.hasher#tymethod.write)
[source](https://doc.rust-lang.org/src/core/hash/sip.rs.html#230)#### fn write\_str(&mut self, s: &str)
🔬This is a nightly-only experimental API. (`hasher_prefixfree_extras` [#96762](https://github.com/rust-lang/rust/issues/96762))
Writes a single `str` into this hasher. [Read more](trait.hasher#method.write_str)
[source](https://doc.rust-lang.org/src/core/hash/sip.rs.html#235)#### fn finish(&self) -> u64
Returns the hash value for the values written so far. [Read more](trait.hasher#tymethod.finish)
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#367)1.3.0 · #### fn write\_u8(&mut self, i: u8)
Writes a single `u8` into this hasher.
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#373)1.3.0 · #### fn write\_u16(&mut self, i: u16)
Writes a single `u16` into this hasher.
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#379)1.3.0 · #### fn write\_u32(&mut self, i: u32)
Writes a single `u32` into this hasher.
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#385)1.3.0 · #### fn write\_u64(&mut self, i: u64)
Writes a single `u64` into this hasher.
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#391)1.26.0 · #### fn write\_u128(&mut self, i: u128)
Writes a single `u128` into this hasher.
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#397)1.3.0 · #### fn write\_usize(&mut self, i: usize)
Writes a single `usize` into this hasher.
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#404)1.3.0 · #### fn write\_i8(&mut self, i: i8)
Writes a single `i8` into this hasher.
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#410)1.3.0 · #### fn write\_i16(&mut self, i: i16)
Writes a single `i16` into this hasher.
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#416)1.3.0 · #### fn write\_i32(&mut self, i: i32)
Writes a single `i32` into this hasher.
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#422)1.3.0 · #### fn write\_i64(&mut self, i: i64)
Writes a single `i64` into this hasher.
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#428)1.26.0 · #### fn write\_i128(&mut self, i: i128)
Writes a single `i128` into this hasher.
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#434)1.3.0 · #### fn write\_isize(&mut self, i: isize)
Writes a single `isize` into this hasher.
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#487)#### fn write\_length\_prefix(&mut self, len: usize)
🔬This is a nightly-only experimental API. (`hasher_prefixfree_extras` [#96762](https://github.com/rust-lang/rust/issues/96762))
Writes a length prefix into this hasher, as part of being prefix-free. [Read more](trait.hasher#method.write_length_prefix)
Auto Trait Implementations
--------------------------
### impl RefUnwindSafe for SipHasher
### impl Send for SipHasher
### impl Sync for SipHasher
### impl Unpin for SipHasher
### impl UnwindSafe for SipHasher
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
rust Struct std::async_iter::FromIter Struct std::async\_iter::FromIter
=================================
```
pub struct FromIter<I> { /* private fields */ }
```
🔬This is a nightly-only experimental API. (`async_iter_from_iter` [#81798](https://github.com/rust-lang/rust/issues/81798))
An async iterator that was created from iterator.
This async iterator is created by the [`from_iter`](fn.from_iter) function. See it documentation for more.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/async_iter/from_iter.rs.html#28)### impl<I> AsyncIterator for FromIter<I>where I: [Iterator](../iter/trait.iterator "trait std::iter::Iterator"),
#### type Item = <I as Iterator>::Item
🔬This is a nightly-only experimental API. (`async_iterator` [#79024](https://github.com/rust-lang/rust/issues/79024))
The type of items yielded by the async iterator.
[source](https://doc.rust-lang.org/src/core/async_iter/from_iter.rs.html#31)#### fn poll\_next( self: Pin<&mut FromIter<I>>, \_cx: &mut Context<'\_>) -> Poll<Option<<FromIter<I> as AsyncIterator>::Item>>
🔬This is a nightly-only experimental API. (`async_iterator` [#79024](https://github.com/rust-lang/rust/issues/79024))
Attempt to pull out the next value of this async iterator, registering the current task for wakeup if the value is not yet available, and returning `None` if the async iterator is exhausted. [Read more](trait.asynciterator#tymethod.poll_next)
[source](https://doc.rust-lang.org/src/core/async_iter/from_iter.rs.html#35)#### fn size\_hint(&self) -> (usize, Option<usize>)
🔬This is a nightly-only experimental API. (`async_iterator` [#79024](https://github.com/rust-lang/rust/issues/79024))
Returns the bounds on the remaining length of the async iterator. [Read more](trait.asynciterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/async_iter/from_iter.rs.html#13)### impl<I> Clone for FromIter<I>where I: [Clone](../clone/trait.clone "trait std::clone::Clone"),
[source](https://doc.rust-lang.org/src/core/async_iter/from_iter.rs.html#13)#### fn clone(&self) -> FromIter<I>
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)1.0.0 · #### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/core/async_iter/from_iter.rs.html#13)### impl<I> Debug for FromIter<I>where I: [Debug](../fmt/trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/async_iter/from_iter.rs.html#13)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/async_iter/from_iter.rs.html#19)### impl<I> Unpin for FromIter<I>
Auto Trait Implementations
--------------------------
### impl<I> RefUnwindSafe for FromIter<I>where I: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<I> Send for FromIter<I>where I: [Send](../marker/trait.send "trait std::marker::Send"),
### impl<I> Sync for FromIter<I>where I: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<I> UnwindSafe for FromIter<I>where I: [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"),
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Function std::async_iter::from_iter Function std::async\_iter::from\_iter
=====================================
```
pub fn from_iter<I>(iter: I) -> FromIter<<I as IntoIterator>::IntoIter>where I: IntoIterator,
```
🔬This is a nightly-only experimental API. (`async_iter_from_iter` [#81798](https://github.com/rust-lang/rust/issues/81798))
Converts an iterator into an async iterator.
rust Module std::async_iter Module std::async\_iter
=======================
🔬This is a nightly-only experimental API. (`async_iterator` [#79024](https://github.com/rust-lang/rust/issues/79024))
Composable asynchronous iteration.
If you’ve found yourself with an asynchronous collection of some kind, and needed to perform an operation on the elements of said collection, you’ll quickly run into ‘async iterators’. Async Iterators are heavily used in idiomatic asynchronous Rust code, so it’s worth becoming familiar with them.
Before explaining more, let’s talk about how this module is structured:
Organization
------------
This module is largely organized by type:
* [Traits](#traits) are the core portion: these traits define what kind of async iterators exist and what you can do with them. The methods of these traits are worth putting some extra study time into.
* Functions provide some helpful ways to create some basic async iterators.
* Structs are often the return types of the various methods on this module’s traits. You’ll usually want to look at the method that creates the `struct`, rather than the `struct` itself. For more detail about why, see ‘[Implementing Async Iterator](#implementing-async-iterator)’.
That’s it! Let’s dig into async iterators.
Async Iterators
---------------
The heart and soul of this module is the [`AsyncIterator`](trait.asynciterator "AsyncIterator") trait. The core of [`AsyncIterator`](trait.asynciterator "AsyncIterator") looks like this:
```
trait AsyncIterator {
type Item;
fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>>;
}
```
Unlike `Iterator`, `AsyncIterator` makes a distinction between the [`poll_next`](trait.asynciterator#tymethod.poll_next) method which is used when implementing an `AsyncIterator`, and a (to-be-implemented) `next` method which is used when consuming an async iterator. Consumers of `AsyncIterator` only need to consider `next`, which when called, returns a future which yields `Option<AsyncIterator::Item>`.
The future returned by `next` will yield `Some(Item)` as long as there are elements, and once they’ve all been exhausted, will yield `None` to indicate that iteration is finished. If we’re waiting on something asynchronous to resolve, the future will wait until the async iterator is ready to yield again.
Individual async iterators may choose to resume iteration, and so calling `next` again may or may not eventually yield `Some(Item)` again at some point.
[`AsyncIterator`](trait.asynciterator "AsyncIterator")’s full definition includes a number of other methods as well, but they are default methods, built on top of [`poll_next`](trait.asynciterator#tymethod.poll_next), and so you get them for free.
Implementing Async Iterator
---------------------------
Creating an async iterator of your own involves two steps: creating a `struct` to hold the async iterator’s state, and then implementing [`AsyncIterator`](trait.asynciterator "AsyncIterator") for that `struct`.
Let’s make an async iterator named `Counter` which counts from `1` to `5`:
```
#![feature(async_iterator)]
// First, the struct:
/// An async iterator which counts from one to five
struct Counter {
count: usize,
}
// we want our count to start at one, so let's add a new() method to help.
// This isn't strictly necessary, but is convenient. Note that we start
// `count` at zero, we'll see why in `poll_next()`'s implementation below.
impl Counter {
fn new() -> Counter {
Counter { count: 0 }
}
}
// Then, we implement `AsyncIterator` for our `Counter`:
impl AsyncIterator for Counter {
// we will be counting with usize
type Item = usize;
// poll_next() is the only required method
fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
// Increment our count. This is why we started at zero.
self.count += 1;
// Check to see if we've finished counting or not.
if self.count < 6 {
Poll::Ready(Some(self.count))
} else {
Poll::Ready(None)
}
}
}
```
Laziness
--------
Async iterators are *lazy*. This means that just creating an async iterator doesn’t *do* a whole lot. Nothing really happens until you call `poll_next`. This is sometimes a source of confusion when creating an async iterator solely for its side effects. The compiler will warn us about this kind of behavior:
```
warning: unused result that must be used: async iterators do nothing unless polled
```
Structs
-------
[FromIter](struct.fromiter "std::async_iter::FromIter struct")Experimental
An async iterator that was created from iterator.
Traits
------
[AsyncIterator](trait.asynciterator "std::async_iter::AsyncIterator trait")Experimental
An interface for dealing with asynchronous iterators.
Functions
---------
[from\_iter](fn.from_iter "std::async_iter::from_iter fn")Experimental
Converts an iterator into an async iterator.
rust Trait std::async_iter::AsyncIterator Trait std::async\_iter::AsyncIterator
=====================================
```
pub trait AsyncIterator {
type Item;
fn poll_next( self: Pin<&mut Self>, cx: &mut Context<'_> ) -> Poll<Option<Self::Item>>;
fn size_hint(&self) -> (usize, Option<usize>) { ... }
}
```
🔬This is a nightly-only experimental API. (`async_iterator` [#79024](https://github.com/rust-lang/rust/issues/79024))
An interface for dealing with asynchronous iterators.
This is the main async iterator trait. For more about the concept of async iterators generally, please see the [module-level documentation](index). In particular, you may want to know how to [implement `AsyncIterator`](index#implementing-async-iterator).
Required Associated Types
-------------------------
[source](https://doc.rust-lang.org/src/core/async_iter/async_iter.rs.html#18)#### type Item
🔬This is a nightly-only experimental API. (`async_iterator` [#79024](https://github.com/rust-lang/rust/issues/79024))
The type of items yielded by the async iterator.
Required Methods
----------------
[source](https://doc.rust-lang.org/src/core/async_iter/async_iter.rs.html#49)#### fn poll\_next( self: Pin<&mut Self>, cx: &mut Context<'\_>) -> Poll<Option<Self::Item>>
🔬This is a nightly-only experimental API. (`async_iterator` [#79024](https://github.com/rust-lang/rust/issues/79024))
Attempt to pull out the next value of this async iterator, registering the current task for wakeup if the value is not yet available, and returning `None` if the async iterator is exhausted.
##### Return value
There are several possible return values, each indicating a distinct async iterator state:
* `Poll::Pending` means that this async iterator’s next value is not ready yet. Implementations will ensure that the current task will be notified when the next value may be ready.
* `Poll::Ready(Some(val))` means that the async iterator has successfully produced a value, `val`, and may produce further values on subsequent `poll_next` calls.
* `Poll::Ready(None)` means that the async iterator has terminated, and `poll_next` should not be invoked again.
##### Panics
Once an async iterator has finished (returned `Ready(None)` from `poll_next`), calling its `poll_next` method again may panic, block forever, or cause other kinds of problems; the `AsyncIterator` trait places no requirements on the effects of such a call. However, as the `poll_next` method is not marked `unsafe`, Rust’s usual rules apply: calls must never cause undefined behavior (memory corruption, incorrect use of `unsafe` functions, or the like), regardless of the async iterator’s state.
Provided Methods
----------------
[source](https://doc.rust-lang.org/src/core/async_iter/async_iter.rs.html#78)#### fn size\_hint(&self) -> (usize, Option<usize>)
🔬This is a nightly-only experimental API. (`async_iterator` [#79024](https://github.com/rust-lang/rust/issues/79024))
Returns the bounds on the remaining length of the async iterator.
Specifically, `size_hint()` returns a tuple where the first element is the lower bound, and the second element is the upper bound.
The second half of the tuple that is returned is an `[Option](../option/enum.option "Option")<[usize](../primitive.usize "usize")>`. A [`None`](../option/enum.option#variant.None "None") here means that either there is no known upper bound, or the upper bound is larger than [`usize`](../primitive.usize "usize").
##### Implementation notes
It is not enforced that an async iterator implementation yields the declared number of elements. A buggy async iterator may yield less than the lower bound or more than the upper bound of elements.
`size_hint()` is primarily intended to be used for optimizations such as reserving space for the elements of the async iterator, but must not be trusted to e.g., omit bounds checks in unsafe code. An incorrect implementation of `size_hint()` should not lead to memory safety violations.
That said, the implementation should provide a correct estimation, because otherwise it would be a violation of the trait’s protocol.
The default implementation returns `(0, [None](../option/enum.option#variant.None "None"))` which is correct for any async iterator.
Implementors
------------
[source](https://doc.rust-lang.org/src/core/async_iter/from_iter.rs.html#28)### impl<I> AsyncIterator for FromIter<I>where I: [Iterator](../iter/trait.iterator "trait std::iter::Iterator"),
#### type Item = <I as Iterator>::Item
[source](https://doc.rust-lang.org/src/core/async_iter/async_iter.rs.html#97)### impl<P> AsyncIterator for Pin<P>where P: [DerefMut](../ops/trait.derefmut "trait std::ops::DerefMut"), <P as [Deref](../ops/trait.deref "trait std::ops::Deref")>::[Target](../ops/trait.deref#associatedtype.Target "type std::ops::Deref::Target"): [AsyncIterator](trait.asynciterator "trait std::async_iter::AsyncIterator"),
#### type Item = <<P as Deref>::Target as AsyncIterator>::Item
[source](https://doc.rust-lang.org/src/core/async_iter/async_iter.rs.html#84)### impl<S> AsyncIterator for &mut Swhere S: [AsyncIterator](trait.asynciterator "trait std::async_iter::AsyncIterator") + [Unpin](../marker/trait.unpin "trait std::marker::Unpin") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
#### type Item = <S as AsyncIterator>::Item
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#2082)### impl<S> AsyncIterator for Box<S, Global>where S: [AsyncIterator](trait.asynciterator "trait std::async_iter::AsyncIterator") + [Unpin](../marker/trait.unpin "trait std::marker::Unpin") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
#### type Item = <S as AsyncIterator>::Item
[source](https://doc.rust-lang.org/src/core/panic/unwind_safe.rs.html#301)### impl<S> AsyncIterator for AssertUnwindSafe<S>where S: [AsyncIterator](trait.asynciterator "trait std::async_iter::AsyncIterator"),
#### type Item = <S as AsyncIterator>::Item
rust Function std::array::try_from_fn Function std::array::try\_from\_fn
==================================
```
pub fn try_from_fn<R, const N: usize, F>( cb: F) -> <<R as Try>::Residual as Residual<[<R as Try>::Output; N]>>::TryTypewhere F: FnMut(usize) -> R, R: Try, <R as Try>::Residual: Residual<[<R as Try>::Output; N]>,
```
🔬This is a nightly-only experimental API. (`array_try_from_fn` [#89379](https://github.com/rust-lang/rust/issues/89379))
Creates an array `[T; N]` where each fallible array element `T` is returned by the `cb` call. Unlike [`from_fn`](fn.from_fn "from_fn"), where the element creation can’t fail, this version will return an error if any element creation was unsuccessful.
The return type of this function depends on the return type of the closure. If you return `Result<T, E>` from the closure, you’ll get a `Result<[T; N]; E>`. If you return `Option<T>` from the closure, you’ll get an `Option<[T; N]>`.
Arguments
---------
* `cb`: Callback where the passed argument is the current array index.
Example
-------
```
#![feature(array_try_from_fn)]
let array: Result<[u8; 5], _> = std::array::try_from_fn(|i| i.try_into());
assert_eq!(array, Ok([0, 1, 2, 3, 4]));
let array: Result<[i8; 200], _> = std::array::try_from_fn(|i| i.try_into());
assert!(array.is_err());
let array: Option<[_; 4]> = std::array::try_from_fn(|i| i.checked_add(100));
assert_eq!(array, Some([100, 101, 102, 103]));
let array: Option<[_; 4]> = std::array::try_from_fn(|i| i.checked_sub(100));
assert_eq!(array, None);
```
rust Module std::array Module std::array
=================
Utilities for the array primitive type.
*[See also the array primitive type](../primitive.array).*
Structs
-------
[IntoIter](struct.intoiter "std::array::IntoIter struct")
A by-value [array](../primitive.array "array") iterator.
[TryFromSliceError](struct.tryfromsliceerror "std::array::TryFromSliceError struct")
The error type returned when a conversion from a slice to an array fails.
Functions
---------
[try\_from\_fn](fn.try_from_fn "std::array::try_from_fn fn")Experimental
Creates an array `[T; N]` where each fallible array element `T` is returned by the `cb` call. Unlike [`from_fn`](fn.from_fn "from_fn"), where the element creation can’t fail, this version will return an error if any element creation was unsuccessful.
[from\_fn](fn.from_fn "std::array::from_fn fn")
Creates an array `[T; N]` where each array element `T` is returned by the `cb` call.
[from\_mut](fn.from_mut "std::array::from_mut fn")
Converts a mutable reference to `T` into a mutable reference to an array of length 1 (without copying).
[from\_ref](fn.from_ref "std::array::from_ref fn")
Converts a reference to `T` into a reference to an array of length 1 (without copying).
rust Function std::array::from_mut Function std::array::from\_mut
==============================
```
pub fn from_mut<T>(s: &mut T) -> &mut [T; 1]
```
Converts a mutable reference to `T` into a mutable reference to an array of length 1 (without copying).
rust Function std::array::from_fn Function std::array::from\_fn
=============================
```
pub fn from_fn<T, const N: usize, F>(cb: F) -> [T; N]where F: FnMut(usize) -> T,
```
Creates an array `[T; N]` where each array element `T` is returned by the `cb` call.
Arguments
---------
* `cb`: Callback where the passed argument is the current array index.
Example
-------
```
let array = core::array::from_fn(|i| i);
assert_eq!(array, [0, 1, 2, 3, 4]);
```
rust Function std::array::from_ref Function std::array::from\_ref
==============================
```
pub const fn from_ref<T>(s: &T) -> &[T; 1]
```
Converts a reference to `T` into a reference to an array of length 1 (without copying).
rust Struct std::array::IntoIter Struct std::array::IntoIter
===========================
```
pub struct IntoIter<T, const N: usize> { /* private fields */ }
```
A by-value [array](../primitive.array "array") iterator.
Implementations
---------------
[source](https://doc.rust-lang.org/src/core/array/iter.rs.html#79)### impl<T, const N: usize> IntoIter<T, N>
[source](https://doc.rust-lang.org/src/core/array/iter.rs.html#83)#### pub fn new(array: [T; N]) -> IntoIter<T, N>
Notable traits for [IntoIter](struct.intoiter "struct std::array::IntoIter")<T, N>
```
impl<T, const N: usize> Iterator for IntoIter<T, N>
type Item = T;
```
👎Deprecated since 1.59.0: use `IntoIterator::into_iter` instead
Creates a new iterator over the given `array`.
[source](https://doc.rust-lang.org/src/core/array/iter.rs.html#146-149)const: [unstable](https://github.com/rust-lang/rust/issues/91583 "Tracking issue for const_array_into_iter_constructors") · #### pub unsafe fn new\_unchecked( buffer: [MaybeUninit<T>; N], initialized: Range<usize>) -> IntoIter<T, N>
Notable traits for [IntoIter](struct.intoiter "struct std::array::IntoIter")<T, N>
```
impl<T, const N: usize> Iterator for IntoIter<T, N>
type Item = T;
```
🔬This is a nightly-only experimental API. (`array_into_iter_constructors` [#91583](https://github.com/rust-lang/rust/issues/91583))
Creates an iterator over the elements in a partially-initialized buffer.
If you have a fully-initialized array, then use [`IntoIterator`](../iter/trait.intoiterator "IntoIterator"). But this is useful for returning partial results from unsafe code.
##### Safety
* The `buffer[initialized]` elements must all be initialized.
* The range must be canonical, with `initialized.start <= initialized.end`.
* The range must be in-bounds for the buffer, with `initialized.end <= N`. (Like how indexing `[0][100..100]` fails despite the range being empty.)
It’s sound to have more elements initialized than mentioned, though that will most likely result in them being leaked.
##### Examples
```
#![feature(array_into_iter_constructors)]
#![feature(maybe_uninit_array_assume_init)]
#![feature(maybe_uninit_uninit_array)]
use std::array::IntoIter;
use std::mem::MaybeUninit;
fn next_chunk<T: Copy, const N: usize>(
it: &mut impl Iterator<Item = T>,
) -> Result<[T; N], IntoIter<T, N>> {
let mut buffer = MaybeUninit::uninit_array();
let mut i = 0;
while i < N {
match it.next() {
Some(x) => {
buffer[i].write(x);
i += 1;
}
None => {
// SAFETY: We've initialized the first `i` items
unsafe {
return Err(IntoIter::new_unchecked(buffer, 0..i));
}
}
}
}
// SAFETY: We've initialized all N items
unsafe { Ok(MaybeUninit::array_assume_init(buffer)) }
}
let r: [_; 4] = next_chunk(&mut (10..16)).unwrap();
assert_eq!(r, [10, 11, 12, 13]);
let r: IntoIter<_, 40> = next_chunk(&mut (10..16)).unwrap_err();
assert_eq!(r.collect::<Vec<_>>(), vec![10, 11, 12, 13, 14, 15]);
```
[source](https://doc.rust-lang.org/src/core/array/iter.rs.html#207)const: [unstable](https://github.com/rust-lang/rust/issues/91583 "Tracking issue for const_array_into_iter_constructors") · #### pub fn empty() -> IntoIter<T, N>
Notable traits for [IntoIter](struct.intoiter "struct std::array::IntoIter")<T, N>
```
impl<T, const N: usize> Iterator for IntoIter<T, N>
type Item = T;
```
🔬This is a nightly-only experimental API. (`array_into_iter_constructors` [#91583](https://github.com/rust-lang/rust/issues/91583))
Creates an iterator over `T` which returns no elements.
If you just need an empty iterator, then use [`iter::empty()`](../iter/fn.empty) instead. And if you need an empty array, use `[]`.
But this is useful when you need an `array::IntoIter<T, N>` *specifically*.
##### Examples
```
#![feature(array_into_iter_constructors)]
use std::array::IntoIter;
let empty = IntoIter::<i32, 3>::empty();
assert_eq!(empty.len(), 0);
assert_eq!(empty.as_slice(), &[]);
let empty = IntoIter::<std::convert::Infallible, 200>::empty();
assert_eq!(empty.len(), 0);
```
`[1, 2].into_iter()` and `[].into_iter()` have different types
```
#![feature(array_into_iter_constructors)]
use std::array::IntoIter;
pub fn get_bytes(b: bool) -> IntoIter<i8, 4> {
if b {
[1, 2, 3, 4].into_iter()
} else {
[].into_iter() // error[E0308]: mismatched types
}
}
```
But using this method you can get an empty iterator of appropriate size:
ⓘ
```
#![feature(array_into_iter_constructors)]
use std::array::IntoIter;
pub fn get_bytes(b: bool) -> IntoIter<i8, 4> {
if b {
[1, 2, 3, 4].into_iter()
} else {
IntoIter::empty()
}
}
assert_eq!(get_bytes(true).collect::<Vec<_>>(), vec![1, 2, 3, 4]);
assert_eq!(get_bytes(false).collect::<Vec<_>>(), vec![]);
```
[source](https://doc.rust-lang.org/src/core/array/iter.rs.html#219)#### pub fn as\_slice(&self) -> &[T]
Notable traits for &[[u8](../primitive.u8)]
```
impl Read for &[u8]
impl Write for &mut [u8]
```
Returns an immutable slice of all elements that have not been yielded yet.
[source](https://doc.rust-lang.org/src/core/array/iter.rs.html#229)#### pub fn as\_mut\_slice(&mut self) -> &mut [T]
Notable traits for &[[u8](../primitive.u8)]
```
impl Read for &[u8]
impl Write for &mut [u8]
```
Returns a mutable slice of all elements that have not been yielded yet.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/array/iter.rs.html#395)1.40.0 · ### impl<T, const N: usize> Clone for IntoIter<T, N>where T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
[source](https://doc.rust-lang.org/src/core/array/iter.rs.html#396)#### fn clone(&self) -> IntoIter<T, N>
Notable traits for [IntoIter](struct.intoiter "struct std::array::IntoIter")<T, N>
```
impl<T, const N: usize> Iterator for IntoIter<T, N>
type Item = T;
```
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)1.0.0 · #### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/core/array/iter.rs.html#414)1.40.0 · ### impl<T, const N: usize> Debug for IntoIter<T, N>where T: [Debug](../fmt/trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/array/iter.rs.html#415)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/array/iter.rs.html#308)1.40.0 · ### impl<T, const N: usize> DoubleEndedIterator for IntoIter<T, N>
[source](https://doc.rust-lang.org/src/core/array/iter.rs.html#309)#### fn next\_back(&mut self) -> Option<<IntoIter<T, N> as Iterator>::Item>
Removes and returns an element from the end of the iterator. [Read more](../iter/trait.doubleendediterator#tymethod.next_back)
[source](https://doc.rust-lang.org/src/core/array/iter.rs.html#327-329)#### fn rfold<Acc, Fold>(self, init: Acc, rfold: Fold) -> Accwhere Fold: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[IntoIter](struct.intoiter "struct std::array::IntoIter")<T, N> as [Iterator](../iter/trait.iterator "trait std::iter::Iterator")>::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Acc,
An iterator method that reduces the iterator’s elements to a single, final value, starting from the back. [Read more](../iter/trait.doubleendediterator#method.rfold)
[source](https://doc.rust-lang.org/src/core/array/iter.rs.html#340)#### fn advance\_back\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator from the back by `n` elements. [Read more](../iter/trait.doubleendediterator#method.advance_back_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#184)1.37.0 · #### fn nth\_back(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element from the end of the iterator. [Read more](../iter/trait.doubleendediterator#method.nth_back)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#221-225)1.27.0 · #### fn try\_rfold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
This is the reverse version of [`Iterator::try_fold()`](../iter/trait.iterator#method.try_fold "Iterator::try_fold()"): it takes elements starting from the back of the iterator. [Read more](../iter/trait.doubleendediterator#method.try_rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#347-350)1.27.0 · #### fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator from the back that satisfies a predicate. [Read more](../iter/trait.doubleendediterator#method.rfind)
[source](https://doc.rust-lang.org/src/core/array/iter.rs.html#363)1.40.0 · ### impl<T, const N: usize> Drop for IntoIter<T, N>
[source](https://doc.rust-lang.org/src/core/array/iter.rs.html#364)#### fn drop(&mut self)
Executes the destructor for this type. [Read more](../ops/trait.drop#tymethod.drop)
[source](https://doc.rust-lang.org/src/core/array/iter.rs.html#373)1.40.0 · ### impl<T, const N: usize> ExactSizeIterator for IntoIter<T, N>
[source](https://doc.rust-lang.org/src/core/array/iter.rs.html#374)#### fn len(&self) -> usize
Returns the exact remaining length of the iterator. [Read more](../iter/trait.exactsizeiterator#method.len)
[source](https://doc.rust-lang.org/src/core/array/iter.rs.html#379)#### fn is\_empty(&self) -> bool
🔬This is a nightly-only experimental API. (`exact_size_is_empty` [#35428](https://github.com/rust-lang/rust/issues/35428))
Returns `true` if the iterator is empty. [Read more](../iter/trait.exactsizeiterator#method.is_empty)
[source](https://doc.rust-lang.org/src/core/array/iter.rs.html#239)1.40.0 · ### impl<T, const N: usize> Iterator for IntoIter<T, N>
#### type Item = T
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/array/iter.rs.html#241)#### fn next(&mut self) -> Option<<IntoIter<T, N> as Iterator>::Item>
Advances the iterator and returns the next value. [Read more](../iter/trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/array/iter.rs.html#258)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](../iter/trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/array/iter.rs.html#264-266)#### fn fold<Acc, Fold>(self, init: Acc, fold: Fold) -> Accwhere Fold: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[IntoIter](struct.intoiter "struct std::array::IntoIter")<T, N> as [Iterator](../iter/trait.iterator "trait std::iter::Iterator")>::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Acc,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](../iter/trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/array/iter.rs.html#277)#### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](../iter/trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/array/iter.rs.html#281)#### fn last(self) -> Option<<IntoIter<T, N> as Iterator>::Item>
Consumes the iterator, returning the last element. [Read more](../iter/trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/array/iter.rs.html#285)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](../iter/trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](../iter/trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#376)1.0.0 · #### fn nth(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element of the iterator. [Read more](../iter/trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](../iter/struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](../iter/trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)1.0.0 · #### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](../iter/struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](../iter/trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)1.0.0 · #### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](../iter/struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](../iter/trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](../iter/struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](../iter/trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)1.0.0 · #### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](../iter/struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](../iter/trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](../iter/trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)1.0.0 · #### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](../iter/struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](../iter/trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)1.0.0 · #### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](../iter/struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](../iter/trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)1.0.0 · #### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](../iter/struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](../iter/trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)1.0.0 · #### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](../iter/struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](../iter/struct.peekable#method.peek) and [`peek_mut`](../iter/struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](../iter/trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)1.0.0 · #### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](../iter/struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](../iter/trait.iterator#method.skip)s elements based on a predicate. [Read more](../iter/trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)1.0.0 · #### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](../iter/struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](../iter/trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](../iter/struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](../iter/trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)1.0.0 · #### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](../iter/struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](../iter/trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)1.0.0 · #### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](../iter/struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](../iter/trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)1.0.0 · #### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](../iter/struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](../iter/trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](../iter/trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)1.0.0 · #### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](../iter/struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](../iter/trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)1.0.0 · #### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](../iter/struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](../iter/trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)1.0.0 · #### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](../iter/struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](../iter/trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)1.0.0 · #### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](../iter/trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)1.0.0 · #### fn collect<B>(self) -> Bwhere B: [FromIterator](../iter/trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](../iter/trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](../iter/trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)1.0.0 · #### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](../iter/trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2079-2082)#### fn partition\_in\_place<'a, T, P>(self, predicate: P) -> usizewhere T: 'a, Self: [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator")<Item = [&'a mut](../primitive.reference) T>, P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_partition_in_place` [#62543](https://github.com/rust-lang/rust/issues/62543))
Reorders the elements of this iterator *in-place* according to the given predicate, such that all those that return `true` precede all those that return `false`. Returns the number of `true` elements found. [Read more](../iter/trait.iterator#method.partition_in_place)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](../iter/trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2230-2234)1.27.0 · #### fn try\_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](../iter/trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](../iter/trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)#### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](../iter/trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](../iter/trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)1.0.0 · #### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)1.0.0 · #### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)1.0.0 · #### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](../iter/trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](../iter/trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](../iter/trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)1.0.0 · #### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](../iter/trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2920-2923)1.0.0 · #### fn rposition<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool), Self: [ExactSizeIterator](../iter/trait.exactsizeiterator "trait std::iter::ExactSizeIterator") + [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
Searches for an element in an iterator from the right, returning its index. [Read more](../iter/trait.iterator#method.rposition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](../iter/trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](../iter/trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3161-3163)1.0.0 · #### fn rev(self) -> Rev<Self>where Self: [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
Notable traits for [Rev](../iter/struct.rev "struct std::iter::Rev")<I>
```
impl<I> Iterator for Rev<I>where
I: DoubleEndedIterator,
type Item = <I as Iterator>::Item;
```
Reverses an iterator’s direction. [Read more](../iter/trait.iterator#method.rev)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)1.0.0 · #### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](../iter/trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](../iter/struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](../iter/trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)1.0.0 · #### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](../iter/struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](../iter/trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](../iter/struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](../iter/trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](../iter/trait.sum "trait std::iter::Sum")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](../iter/trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](../iter/trait.product "trait std::iter::Product")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](../iter/trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another. [Read more](../iter/trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another. [Read more](../iter/trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](../iter/trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are unequal to those of another. [Read more](../iter/trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](../iter/trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](../iter/trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](../iter/trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](../iter/trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](../iter/trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](../iter/trait.iterator#method.is_sorted_by_key)
[source](https://doc.rust-lang.org/src/core/array/iter.rs.html#385)1.40.0 · ### impl<T, const N: usize> FusedIterator for IntoIter<T, N>
[source](https://doc.rust-lang.org/src/core/array/iter.rs.html#392)1.40.0 · ### impl<T, const N: usize> TrustedLen for IntoIter<T, N>
Auto Trait Implementations
--------------------------
### impl<T, const N: usize> RefUnwindSafe for IntoIter<T, N>where T: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<T, const N: usize> Send for IntoIter<T, N>where T: [Send](../marker/trait.send "trait std::marker::Send"),
### impl<T, const N: usize> Sync for IntoIter<T, N>where T: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<T, const N: usize> Unpin for IntoIter<T, N>where T: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"),
### impl<T, const N: usize> UnwindSafe for IntoIter<T, N>where T: [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"),
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](../iter/trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](../iter/trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Struct std::array::TryFromSliceError Struct std::array::TryFromSliceError
====================================
```
pub struct TryFromSliceError(_);
```
The error type returned when a conversion from a slice to an array fails.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/array/mod.rs.html#113)### impl Clone for TryFromSliceError
[source](https://doc.rust-lang.org/src/core/array/mod.rs.html#113)#### fn clone(&self) -> TryFromSliceError
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)1.0.0 · #### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/core/array/mod.rs.html#113)### impl Debug for TryFromSliceError
[source](https://doc.rust-lang.org/src/core/array/mod.rs.html#113)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/array/mod.rs.html#117)1.36.0 · ### impl Display for TryFromSliceError
[source](https://doc.rust-lang.org/src/core/array/mod.rs.html#119)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.display#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/array/mod.rs.html#126)### impl Error for TryFromSliceError
[source](https://doc.rust-lang.org/src/core/array/mod.rs.html#128)#### fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to\_string()
[Read more](../error/trait.error#method.description)
[source](https://doc.rust-lang.org/src/core/error.rs.html#83)1.30.0 · #### fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. [Read more](../error/trait.error#method.source)
[source](https://doc.rust-lang.org/src/core/error.rs.html#119)1.0.0 · #### fn cause(&self) -> Option<&dyn Error>
👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
[source](https://doc.rust-lang.org/src/core/error.rs.html#193)#### fn provide(&'a self, demand: &mut Demand<'a>)
🔬This is a nightly-only experimental API. (`error_generic_member_access` [#99301](https://github.com/rust-lang/rust/issues/99301))
Provides type based access to context intended for error reports. [Read more](../error/trait.error#method.provide)
[source](https://doc.rust-lang.org/src/core/array/mod.rs.html#149)1.36.0 (const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert")) · ### impl From<Infallible> for TryFromSliceError
[source](https://doc.rust-lang.org/src/core/array/mod.rs.html#150)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(x: Infallible) -> TryFromSliceError
Converts to this type from the input type.
[source](https://doc.rust-lang.org/src/core/array/mod.rs.html#113)### impl Copy for TryFromSliceError
Auto Trait Implementations
--------------------------
### impl RefUnwindSafe for TryFromSliceError
### impl Send for TryFromSliceError
### impl Sync for TryFromSliceError
### impl Unpin for TryFromSliceError
### impl UnwindSafe for TryFromSliceError
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/error.rs.html#197)### impl<E> Provider for Ewhere E: [Error](../error/trait.error "trait std::error::Error") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/error.rs.html#201)#### fn provide(&'a self, demand: &mut Demand<'a>)
🔬This is a nightly-only experimental API. (`provide_any` [#96024](https://github.com/rust-lang/rust/issues/96024))
Data providers should implement this method to provide *all* values they are able to provide by using `demand`. [Read more](../any/trait.provider#tymethod.provide)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/alloc/string.rs.html#2500)### impl<T> ToString for Twhere T: [Display](../fmt/trait.display "trait std::fmt::Display") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/alloc/string.rs.html#2506)#### default fn to\_string(&self) -> String
Converts the given value to a `String`. [Read more](../string/trait.tostring#tymethod.to_string)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
rust Enum std::fmt::Alignment Enum std::fmt::Alignment
========================
```
pub enum Alignment {
Left,
Right,
Center,
}
```
Possible alignments returned by `Formatter::align`
Variants
--------
### `Left`
Indication that contents should be left-aligned.
### `Right`
Indication that contents should be right-aligned.
### `Center`
Indication that contents should be center-aligned.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#25)### impl Clone for Alignment
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#25)#### fn clone(&self) -> Alignment
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)1.0.0 · #### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#25)### impl Debug for Alignment
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#25)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#25)### impl PartialEq<Alignment> for Alignment
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#25)#### fn eq(&self, other: &Alignment) -> bool
This method tests for `self` and `other` values to be equal, and is used by `==`. [Read more](../cmp/trait.partialeq#tymethod.eq)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#236)1.0.0 · #### fn ne(&self, other: &Rhs) -> bool
This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. [Read more](../cmp/trait.partialeq#method.ne)
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#25)### impl Copy for Alignment
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#25)### impl Eq for Alignment
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#25)### impl StructuralEq for Alignment
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#25)### impl StructuralPartialEq for Alignment
Auto Trait Implementations
--------------------------
### impl RefUnwindSafe for Alignment
### impl Send for Alignment
### impl Sync for Alignment
### impl Unpin for Alignment
### impl UnwindSafe for Alignment
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
rust Trait std::fmt::UpperExp Trait std::fmt::UpperExp
========================
```
pub trait UpperExp {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>;
}
```
`E` formatting.
The `UpperExp` trait should format its output in scientific notation with an upper-case `E`.
For more information on formatters, see [the module-level documentation](index).
Examples
--------
Basic usage with `f64`:
```
let x = 42.0; // 42.0 is '4.2E1' in scientific notation
assert_eq!(format!("{x:E}"), "4.2E1");
```
Implementing `UpperExp` on a type:
```
use std::fmt;
struct Length(i32);
impl fmt::UpperExp for Length {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let val = f64::from(self.0);
fmt::UpperExp::fmt(&val, f) // delegate to f64's implementation
}
}
let l = Length(100);
assert_eq!(
format!("l in scientific notation is: {l:E}"),
"l in scientific notation is: 1E2"
);
assert_eq!(
format!("l in scientific notation is: {l:05E}"),
"l in scientific notation is: 001E2"
);
```
Required Methods
----------------
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#1153)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter.
Implementors
------------
[source](https://doc.rust-lang.org/src/core/fmt/float.rs.html#225)### impl UpperExp for f32
[source](https://doc.rust-lang.org/src/core/fmt/float.rs.html#226)### impl UpperExp for f64
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#465-468)1.42.0 · ### impl UpperExp for i8
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#465-468)1.42.0 · ### impl UpperExp for i16
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#465-468)1.42.0 · ### impl UpperExp for i32
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#465-468)1.42.0 · ### impl UpperExp for i64
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#479)1.42.0 · ### impl UpperExp for i128
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#465-468)1.42.0 · ### impl UpperExp for isize
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#465-468)1.42.0 · ### impl UpperExp for u8
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#465-468)1.42.0 · ### impl UpperExp for u16
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#465-468)1.42.0 · ### impl UpperExp for u32
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#465-468)1.42.0 · ### impl UpperExp for u64
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#479)1.42.0 · ### impl UpperExp for u128
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#465-468)1.42.0 · ### impl UpperExp for usize
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#2376)### impl<T> UpperExp for &Twhere T: [UpperExp](trait.upperexp "trait std::fmt::UpperExp") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#2376)### impl<T> UpperExp for &mut Twhere T: [UpperExp](trait.upperexp "trait std::fmt::UpperExp") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/up/up/portable-simd/crates/core_simd/src/fmt.rs.html#31-39)### impl<T, const LANES: usize> UpperExp for Simd<T, LANES>where T: [SimdElement](../simd/trait.simdelement "trait std::simd::SimdElement") + [UpperExp](trait.upperexp "trait std::fmt::UpperExp"), [LaneCount](../simd/struct.lanecount "struct std::simd::LaneCount")<LANES>: [SupportedLaneCount](../simd/trait.supportedlanecount "trait std::simd::SupportedLaneCount"),
rust Struct std::fmt::DebugSet Struct std::fmt::DebugSet
=========================
```
pub struct DebugSet<'a, 'b>where 'b: 'a,{ /* private fields */ }
```
A struct to help with [`fmt::Debug`](trait.debug) implementations.
This is useful when you wish to output a formatted set of items as a part of your [`Debug::fmt`](trait.debug#tymethod.fmt "Debug::fmt") implementation.
This can be constructed by the [`Formatter::debug_set`](struct.formatter#method.debug_set "Formatter::debug_set") method.
Examples
--------
```
use std::fmt;
struct Foo(Vec<i32>);
impl fmt::Debug for Foo {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fmt.debug_set().entries(self.0.iter()).finish()
}
}
assert_eq!(
format!("{:?}", Foo(vec![10, 11])),
"{10, 11}",
);
```
Implementations
---------------
[source](https://doc.rust-lang.org/src/core/fmt/builders.rs.html#443)### impl<'a, 'b> DebugSet<'a, 'b>where 'b: 'a,
[source](https://doc.rust-lang.org/src/core/fmt/builders.rs.html#468)#### pub fn entry(&mut self, entry: &dyn Debug) -> &mut DebugSet<'a, 'b>
Adds a new entry to the set output.
##### Examples
```
use std::fmt;
struct Foo(Vec<i32>, Vec<u32>);
impl fmt::Debug for Foo {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt.debug_set()
.entry(&self.0) // Adds the first "entry".
.entry(&self.1) // Adds the second "entry".
.finish()
}
}
assert_eq!(
format!("{:?}", Foo(vec![10, 11], vec![12, 13])),
"{[10, 11], [12, 13]}",
);
```
[source](https://doc.rust-lang.org/src/core/fmt/builders.rs.html#497-500)#### pub fn entries<D, I>(&mut self, entries: I) -> &mut DebugSet<'a, 'b>where D: [Debug](trait.debug "trait std::fmt::Debug"), I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")<Item = D>,
Adds the contents of an iterator of entries to the set output.
##### Examples
```
use std::fmt;
struct Foo(Vec<i32>, Vec<u32>);
impl fmt::Debug for Foo {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt.debug_set()
.entries(self.0.iter()) // Adds the first "entry".
.entries(self.1.iter()) // Adds the second "entry".
.finish()
}
}
assert_eq!(
format!("{:?}", Foo(vec![10, 11], vec![12, 13])),
"{10, 11, 12, 13}",
);
```
[source](https://doc.rust-lang.org/src/core/fmt/builders.rs.html#531)#### pub fn finish(&mut self) -> Result<(), Error>
Finishes output and returns any error encountered.
##### Examples
```
use std::fmt;
struct Foo(Vec<i32>);
impl fmt::Debug for Foo {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt.debug_set()
.entries(self.0.iter())
.finish() // Ends the struct formatting.
}
}
assert_eq!(
format!("{:?}", Foo(vec![10, 11])),
"{10, 11}",
);
```
Auto Trait Implementations
--------------------------
### impl<'a, 'b> !RefUnwindSafe for DebugSet<'a, 'b>
### impl<'a, 'b> !Send for DebugSet<'a, 'b>
### impl<'a, 'b> !Sync for DebugSet<'a, 'b>
### impl<'a, 'b> Unpin for DebugSet<'a, 'b>where 'b: 'a,
### impl<'a, 'b> !UnwindSafe for DebugSet<'a, 'b>
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Module std::fmt Module std::fmt
===============
Utilities for formatting and printing `String`s.
This module contains the runtime support for the [`format!`](../macro.format "format!") syntax extension. This macro is implemented in the compiler to emit calls to this module in order to format arguments at runtime into strings.
Usage
-----
The [`format!`](../macro.format "format!") macro is intended to be familiar to those coming from C’s `printf`/`fprintf` functions or Python’s `str.format` function.
Some examples of the [`format!`](../macro.format "format!") extension are:
```
format!("Hello"); // => "Hello"
format!("Hello, {}!", "world"); // => "Hello, world!"
format!("The number is {}", 1); // => "The number is 1"
format!("{:?}", (3, 4)); // => "(3, 4)"
format!("{value}", value=4); // => "4"
let people = "Rustaceans";
format!("Hello {people}!"); // => "Hello Rustaceans!"
format!("{} {}", 1, 2); // => "1 2"
format!("{:04}", 42); // => "0042" with leading zeros
format!("{:#?}", (100, 200)); // => "(
// 100,
// 200,
// )"
```
From these, you can see that the first argument is a format string. It is required by the compiler for this to be a string literal; it cannot be a variable passed in (in order to perform validity checking). The compiler will then parse the format string and determine if the list of arguments provided is suitable to pass to this format string.
To convert a single value to a string, use the [`to_string`](../string/trait.tostring#tymethod.to_string "ToString::to_string") method. This will use the [`Display`](trait.display "Display") formatting trait.
### Positional parameters
Each formatting argument is allowed to specify which value argument it’s referencing, and if omitted it is assumed to be “the next argument”. For example, the format string `{} {} {}` would take three parameters, and they would be formatted in the same order as they’re given. The format string `{2} {1} {0}`, however, would format arguments in reverse order.
Things can get a little tricky once you start intermingling the two types of positional specifiers. The “next argument” specifier can be thought of as an iterator over the argument. Each time a “next argument” specifier is seen, the iterator advances. This leads to behavior like this:
```
format!("{1} {} {0} {}", 1, 2); // => "2 1 1 2"
```
The internal iterator over the argument has not been advanced by the time the first `{}` is seen, so it prints the first argument. Then upon reaching the second `{}`, the iterator has advanced forward to the second argument. Essentially, parameters that explicitly name their argument do not affect parameters that do not name an argument in terms of positional specifiers.
A format string is required to use all of its arguments, otherwise it is a compile-time error. You may refer to the same argument more than once in the format string.
### Named parameters
Rust itself does not have a Python-like equivalent of named parameters to a function, but the [`format!`](../macro.format "format!") macro is a syntax extension that allows it to leverage named parameters. Named parameters are listed at the end of the argument list and have the syntax:
```
identifier '=' expression
```
For example, the following [`format!`](../macro.format "format!") expressions all use named arguments:
```
format!("{argument}", argument = "test"); // => "test"
format!("{name} {}", 1, name = 2); // => "2 1"
format!("{a} {c} {b}", a="a", b='b', c=3); // => "a 3 b"
```
If a named parameter does not appear in the argument list, `format!` will reference a variable with that name in the current scope.
```
let argument = 2 + 2;
format!("{argument}"); // => "4"
fn make_string(a: u32, b: &str) -> String {
format!("{b} {a}")
}
make_string(927, "label"); // => "label 927"
```
It is not valid to put positional parameters (those without names) after arguments that have names. Like with positional parameters, it is not valid to provide named parameters that are unused by the format string.
Formatting Parameters
---------------------
Each argument being formatted can be transformed by a number of formatting parameters (corresponding to `format_spec` in [the syntax](#syntax)). These parameters affect the string representation of what’s being formatted.
### Width
```
// All of these print "Hello x !"
println!("Hello {:5}!", "x");
println!("Hello {:1$}!", "x", 5);
println!("Hello {1:0$}!", 5, "x");
println!("Hello {:width$}!", "x", width = 5);
let width = 5;
println!("Hello {:width$}!", "x");
```
This is a parameter for the “minimum width” that the format should take up. If the value’s string does not fill up this many characters, then the padding specified by fill/alignment will be used to take up the required space (see below).
The value for the width can also be provided as a [`usize`](../primitive.usize "usize") in the list of parameters by adding a postfix `$`, indicating that the second argument is a [`usize`](../primitive.usize "usize") specifying the width.
Referring to an argument with the dollar syntax does not affect the “next argument” counter, so it’s usually a good idea to refer to arguments by position, or use named arguments.
### Fill/Alignment
```
assert_eq!(format!("Hello {:<5}!", "x"), "Hello x !");
assert_eq!(format!("Hello {:-<5}!", "x"), "Hello x----!");
assert_eq!(format!("Hello {:^5}!", "x"), "Hello x !");
assert_eq!(format!("Hello {:>5}!", "x"), "Hello x!");
```
The optional fill character and alignment is provided normally in conjunction with the [`width`](#width) parameter. It must be defined before `width`, right after the `:`. This indicates that if the value being formatted is smaller than `width` some extra characters will be printed around it. Filling comes in the following variants for different alignments:
* `[fill]<` - the argument is left-aligned in `width` columns
* `[fill]^` - the argument is center-aligned in `width` columns
* `[fill]>` - the argument is right-aligned in `width` columns
The default [fill/alignment](#fillalignment) for non-numerics is a space and left-aligned. The default for numeric formatters is also a space character but with right-alignment. If the `0` flag (see below) is specified for numerics, then the implicit fill character is `0`.
Note that alignment might not be implemented by some types. In particular, it is not generally implemented for the `Debug` trait. A good way to ensure padding is applied is to format your input, then pad this resulting string to obtain your output:
```
println!("Hello {:^15}!", format!("{:?}", Some("hi"))); // => "Hello Some("hi") !"
```
### Sign/`#`/`0`
```
assert_eq!(format!("Hello {:+}!", 5), "Hello +5!");
assert_eq!(format!("{:#x}!", 27), "0x1b!");
assert_eq!(format!("Hello {:05}!", 5), "Hello 00005!");
assert_eq!(format!("Hello {:05}!", -5), "Hello -0005!");
assert_eq!(format!("{:#010x}!", 27), "0x0000001b!");
```
These are all flags altering the behavior of the formatter.
* `+` - This is intended for numeric types and indicates that the sign should always be printed. Positive signs are never printed by default, and the negative sign is only printed by default for signed values. This flag indicates that the correct sign (`+` or `-`) should always be printed.
* `-` - Currently not used
* `#` - This flag indicates that the “alternate” form of printing should be used. The alternate forms are:
+ `#?` - pretty-print the [`Debug`](trait.debug "Debug") formatting (adds linebreaks and indentation)
+ `#x` - precedes the argument with a `0x`
+ `#X` - precedes the argument with a `0x`
+ `#b` - precedes the argument with a `0b`
+ `#o` - precedes the argument with a `0o`
* `0` - This is used to indicate for integer formats that the padding to `width` should both be done with a `0` character as well as be sign-aware. A format like `{:08}` would yield `00000001` for the integer `1`, while the same format would yield `-0000001` for the integer `-1`. Notice that the negative version has one fewer zero than the positive version. Note that padding zeros are always placed after the sign (if any) and before the digits. When used together with the `#` flag, a similar rule applies: padding zeros are inserted after the prefix but before the digits. The prefix is included in the total width.
### Precision
For non-numeric types, this can be considered a “maximum width”. If the resulting string is longer than this width, then it is truncated down to this many characters and that truncated value is emitted with proper `fill`, `alignment` and `width` if those parameters are set.
For integral types, this is ignored.
For floating-point types, this indicates how many digits after the decimal point should be printed.
There are three possible ways to specify the desired `precision`:
1. An integer `.N`:
the integer `N` itself is the precision.
2. An integer or name followed by dollar sign `.N$`:
use format *argument* `N` (which must be a `usize`) as the precision.
3. An asterisk `.*`:
`.*` means that this `{...}` is associated with *two* format inputs rather than one:
* If a format string in the fashion of `{:<spec>.*}` is used, then the first input holds the `usize` precision, and the second holds the value to print.
* If a format string in the fashion of `{<arg>:<spec>.*}` is used, then the `<arg>` part refers to the value to print, and the `precision` is taken like it was specified with an omitted positional parameter (`{}` instead of `{<arg>:}`).
For example, the following calls all print the same thing `Hello x is 0.01000`:
```
// Hello {arg 0 ("x")} is {arg 1 (0.01) with precision specified inline (5)}
println!("Hello {0} is {1:.5}", "x", 0.01);
// Hello {arg 1 ("x")} is {arg 2 (0.01) with precision specified in arg 0 (5)}
println!("Hello {1} is {2:.0$}", 5, "x", 0.01);
// Hello {arg 0 ("x")} is {arg 2 (0.01) with precision specified in arg 1 (5)}
println!("Hello {0} is {2:.1$}", "x", 5, 0.01);
// Hello {next arg -> arg 0 ("x")} is {second of next two args -> arg 2 (0.01) with precision
// specified in first of next two args -> arg 1 (5)}
println!("Hello {} is {:.*}", "x", 5, 0.01);
// Hello {arg 1 ("x")} is {arg 2 (0.01) with precision
// specified in next arg -> arg 0 (5)}
println!("Hello {1} is {2:.*}", 5, "x", 0.01);
// Hello {next arg -> arg 0 ("x")} is {arg 2 (0.01) with precision
// specified in next arg -> arg 1 (5)}
println!("Hello {} is {2:.*}", "x", 5, 0.01);
// Hello {next arg -> arg 0 ("x")} is {arg "number" (0.01) with precision specified
// in arg "prec" (5)}
println!("Hello {} is {number:.prec$}", "x", prec = 5, number = 0.01);
```
While these:
```
println!("{}, `{name:.*}` has 3 fractional digits", "Hello", 3, name=1234.56);
println!("{}, `{name:.*}` has 3 characters", "Hello", 3, name="1234.56");
println!("{}, `{name:>8.*}` has 3 right-aligned characters", "Hello", 3, name="1234.56");
```
print three significantly different things:
```
Hello, `1234.560` has 3 fractional digits
Hello, `123` has 3 characters
Hello, ` 123` has 3 right-aligned characters
```
### Localization
In some programming languages, the behavior of string formatting functions depends on the operating system’s locale setting. The format functions provided by Rust’s standard library do not have any concept of locale and will produce the same results on all systems regardless of user configuration.
For example, the following code will always print `1.5` even if the system locale uses a decimal separator other than a dot.
```
println!("The value is {}", 1.5);
```
Escaping
--------
The literal characters `{` and `}` may be included in a string by preceding them with the same character. For example, the `{` character is escaped with `{{` and the `}` character is escaped with `}}`.
```
assert_eq!(format!("Hello {{}}"), "Hello {}");
assert_eq!(format!("{{ Hello"), "{ Hello");
```
Syntax
------
To summarize, here you can find the full grammar of format strings. The syntax for the formatting language used is drawn from other languages, so it should not be too alien. Arguments are formatted with Python-like syntax, meaning that arguments are surrounded by `{}` instead of the C-like `%`. The actual grammar for the formatting syntax is:
```
format_string := text [ maybe_format text ] *
maybe_format := '{' '{' | '}' '}' | format
format := '{' [ argument ] [ ':' format_spec ] [ ws ] * '}'
argument := integer | identifier
format_spec := [[fill]align][sign]['#']['0'][width]['.' precision]type
fill := character
align := '<' | '^' | '>'
sign := '+' | '-'
width := count
precision := count | '*'
type := '' | '?' | 'x?' | 'X?' | identifier
count := parameter | integer
parameter := argument '$'
```
In the above grammar,
* `text` must not contain any `'{'` or `'}'` characters,
* `ws` is any character for which [`char::is_whitespace`](../primitive.char#method.is_whitespace "char::is_whitespace") returns `true`, has no semantic meaning and is completely optional,
* `integer` is a decimal integer that may contain leading zeroes and
* `identifier` is an `IDENTIFIER_OR_KEYWORD` (not an `IDENTIFIER`) as defined by the [Rust language reference](../../reference/identifiers).
Formatting traits
-----------------
When requesting that an argument be formatted with a particular type, you are actually requesting that an argument ascribes to a particular trait. This allows multiple actual types to be formatted via `{:x}` (like [`i8`](../primitive.i8 "i8") as well as [`isize`](../primitive.isize "isize")). The current mapping of types to traits is:
* *nothing* ⇒ [`Display`](trait.display "Display")
* `?` ⇒ [`Debug`](trait.debug "Debug")
* `x?` ⇒ [`Debug`](trait.debug "Debug") with lower-case hexadecimal integers
* `X?` ⇒ [`Debug`](trait.debug "Debug") with upper-case hexadecimal integers
* `o` ⇒ [`Octal`](trait.octal "Octal")
* `x` ⇒ [`LowerHex`](trait.lowerhex "LowerHex")
* `X` ⇒ [`UpperHex`](trait.upperhex "UpperHex")
* `p` ⇒ [`Pointer`](trait.pointer "Pointer")
* `b` ⇒ [`Binary`](trait.binary "Binary")
* `e` ⇒ [`LowerExp`](trait.lowerexp "LowerExp")
* `E` ⇒ [`UpperExp`](trait.upperexp "UpperExp")
What this means is that any type of argument which implements the [`fmt::Binary`](trait.binary "Binary") trait can then be formatted with `{:b}`. Implementations are provided for these traits for a number of primitive types by the standard library as well. If no format is specified (as in `{}` or `{:6}`), then the format trait used is the [`Display`](trait.display "Display") trait.
When implementing a format trait for your own type, you will have to implement a method of the signature:
```
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
```
Your type will be passed as `self` by-reference, and then the function should emit output into the Formatter `f` which implements `fmt::Write`. It is up to each format trait implementation to correctly adhere to the requested formatting parameters. The values of these parameters can be accessed with methods of the [`Formatter`](struct.formatter "Formatter") struct. In order to help with this, the [`Formatter`](struct.formatter "Formatter") struct also provides some helper methods.
Additionally, the return value of this function is [`fmt::Result`](type.result "fmt::Result") which is a type alias of `[Result](../result/enum.result "std::result::Result")<(), [std::fmt::Error](struct.error "fmt::Error")>`. Formatting implementations should ensure that they propagate errors from the [`Formatter`](struct.formatter "Formatter") (e.g., when calling [`write!`](../macro.write "write!")). However, they should never return errors spuriously. That is, a formatting implementation must and may only return an error if the passed-in [`Formatter`](struct.formatter "Formatter") returns an error. This is because, contrary to what the function signature might suggest, string formatting is an infallible operation. This function only returns a result because writing to the underlying stream might fail and it must provide a way to propagate the fact that an error has occurred back up the stack.
An example of implementing the formatting traits would look like:
```
use std::fmt;
#[derive(Debug)]
struct Vector2D {
x: isize,
y: isize,
}
impl fmt::Display for Vector2D {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
// The `f` value implements the `Write` trait, which is what the
// write! macro is expecting. Note that this formatting ignores the
// various flags provided to format strings.
write!(f, "({}, {})", self.x, self.y)
}
}
// Different traits allow different forms of output of a type. The meaning
// of this format is to print the magnitude of a vector.
impl fmt::Binary for Vector2D {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let magnitude = (self.x * self.x + self.y * self.y) as f64;
let magnitude = magnitude.sqrt();
// Respect the formatting flags by using the helper method
// `pad_integral` on the Formatter object. See the method
// documentation for details, and the function `pad` can be used
// to pad strings.
let decimals = f.precision().unwrap_or(3);
let string = format!("{:.*}", decimals, magnitude);
f.pad_integral(true, "", &string)
}
}
fn main() {
let myvector = Vector2D { x: 3, y: 4 };
println!("{myvector}"); // => "(3, 4)"
println!("{myvector:?}"); // => "Vector2D {x: 3, y:4}"
println!("{myvector:10.3b}"); // => " 5.000"
}
```
####
`fmt::Display` vs `fmt::Debug`
These two formatting traits have distinct purposes:
* [`fmt::Display`](trait.display "Display") implementations assert that the type can be faithfully represented as a UTF-8 string at all times. It is **not** expected that all types implement the [`Display`](trait.display "Display") trait.
* [`fmt::Debug`](trait.debug "Debug") implementations should be implemented for **all** public types. Output will typically represent the internal state as faithfully as possible. The purpose of the [`Debug`](trait.debug "Debug") trait is to facilitate debugging Rust code. In most cases, using `#[derive(Debug)]` is sufficient and recommended.
Some examples of the output from both traits:
```
assert_eq!(format!("{} {:?}", 3, 4), "3 4");
assert_eq!(format!("{} {:?}", 'a', 'b'), "a 'b'");
assert_eq!(format!("{} {:?}", "foo\n", "bar\n"), "foo\n \"bar\\n\"");
```
Related macros
--------------
There are a number of related macros in the [`format!`](../macro.format "format!") family. The ones that are currently implemented are:
ⓘ
```
format! // described above
write! // first argument is either a &mut io::Write or a &mut fmt::Write, the destination
writeln! // same as write but appends a newline
print! // the format string is printed to the standard output
println! // same as print but appends a newline
eprint! // the format string is printed to the standard error
eprintln! // same as eprint but appends a newline
format_args! // described below.
```
#### `write!`
[`write!`](../macro.write "write!") and [`writeln!`](../macro.writeln "writeln!") are two macros which are used to emit the format string to a specified stream. This is used to prevent intermediate allocations of format strings and instead directly write the output. Under the hood, this function is actually invoking the [`write_fmt`](../io/trait.write#method.write_fmt) function defined on the [`std::io::Write`](../io/trait.write) and the [`std::fmt::Write`](trait.write) trait. Example usage is:
```
use std::io::Write;
let mut w = Vec::new();
write!(&mut w, "Hello {}!", "world");
```
#### `print!`
This and [`println!`](../macro.println "println!") emit their output to stdout. Similarly to the [`write!`](../macro.write "write!") macro, the goal of these macros is to avoid intermediate allocations when printing output. Example usage is:
```
print!("Hello {}!", "world");
println!("I have a newline {}", "character at the end");
```
#### `eprint!`
The [`eprint!`](../macro.eprint "eprint!") and [`eprintln!`](../macro.eprintln "eprintln!") macros are identical to [`print!`](../macro.print "print!") and [`println!`](../macro.println "println!"), respectively, except they emit their output to stderr.
#### `format_args!`
[`format_args!`](../macro.format_args "format_args!") is a curious macro used to safely pass around an opaque object describing the format string. This object does not require any heap allocations to create, and it only references information on the stack. Under the hood, all of the related macros are implemented in terms of this. First off, some example usage is:
```
use std::fmt;
use std::io::{self, Write};
let mut some_writer = io::stdout();
write!(&mut some_writer, "{}", format_args!("print with a {}", "macro"));
fn my_fmt_fn(args: fmt::Arguments) {
write!(&mut io::stdout(), "{}", args);
}
my_fmt_fn(format_args!(", or a {} too", "function"));
```
The result of the [`format_args!`](../macro.format_args "format_args!") macro is a value of type [`fmt::Arguments`](struct.arguments "fmt::Arguments"). This structure can then be passed to the [`write`](fn.write "fmt::write") and [`format`](fn.format "fmt::format") functions inside this module in order to process the format string. The goal of this macro is to even further prevent intermediate allocations when dealing with formatting strings.
For example, a logging library could use the standard formatting syntax, but it would internally pass around this structure until it has been determined where output should go to.
Macros
------
[Debug](macro.debug "std::fmt::Debug macro")
Derive macro generating an impl of the trait `Debug`.
Structs
-------
[Arguments](struct.arguments "std::fmt::Arguments struct")
This structure represents a safely precompiled version of a format string and its arguments. This cannot be generated at runtime because it cannot safely be done, so no constructors are given and the fields are private to prevent modification.
[DebugList](struct.debuglist "std::fmt::DebugList struct")
A struct to help with [`fmt::Debug`](trait.debug) implementations.
[DebugMap](struct.debugmap "std::fmt::DebugMap struct")
A struct to help with [`fmt::Debug`](trait.debug) implementations.
[DebugSet](struct.debugset "std::fmt::DebugSet struct")
A struct to help with [`fmt::Debug`](trait.debug) implementations.
[DebugStruct](struct.debugstruct "std::fmt::DebugStruct struct")
A struct to help with [`fmt::Debug`](trait.debug) implementations.
[DebugTuple](struct.debugtuple "std::fmt::DebugTuple struct")
A struct to help with [`fmt::Debug`](trait.debug) implementations.
[Error](struct.error "std::fmt::Error struct")
The error type which is returned from formatting a message into a stream.
[Formatter](struct.formatter "std::fmt::Formatter struct")
Configuration for formatting.
Enums
-----
[Alignment](enum.alignment "std::fmt::Alignment enum")
Possible alignments returned by `Formatter::align`
Traits
------
[Binary](trait.binary "std::fmt::Binary trait")
`b` formatting.
[Debug](trait.debug "std::fmt::Debug trait")
`?` formatting.
[Display](trait.display "std::fmt::Display trait")
Format trait for an empty format, `{}`.
[LowerExp](trait.lowerexp "std::fmt::LowerExp trait")
`e` formatting.
[LowerHex](trait.lowerhex "std::fmt::LowerHex trait")
`x` formatting.
[Octal](trait.octal "std::fmt::Octal trait")
`o` formatting.
[Pointer](trait.pointer "std::fmt::Pointer trait")
`p` formatting.
[UpperExp](trait.upperexp "std::fmt::UpperExp trait")
`E` formatting.
[UpperHex](trait.upperhex "std::fmt::UpperHex trait")
`X` formatting.
[Write](trait.write "std::fmt::Write trait")
A trait for writing or formatting into Unicode-accepting buffers or streams.
Functions
---------
[format](fn.format "std::fmt::format fn")
The `format` function takes an [`Arguments`](struct.arguments "Arguments") struct and returns the resulting formatted string.
[write](fn.write "std::fmt::write fn")
The `write` function takes an output stream, and an `Arguments` struct that can be precompiled with the `format_args!` macro.
Type Definitions
----------------
[Result](type.result "std::fmt::Result type")
The type returned by formatter methods.
| programming_docs |
rust Trait std::fmt::UpperHex Trait std::fmt::UpperHex
========================
```
pub trait UpperHex {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>;
}
```
`X` formatting.
The `UpperHex` trait should format its output as a number in hexadecimal, with `A` through `F` in upper case.
For primitive signed integers (`i8` to `i128`, and `isize`), negative values are formatted as the two’s complement representation.
The alternate flag, `#`, adds a `0x` in front of the output.
For more information on formatters, see [the module-level documentation](index).
Examples
--------
Basic usage with `i32`:
```
let x = 42; // 42 is '2A' in hex
assert_eq!(format!("{x:X}"), "2A");
assert_eq!(format!("{x:#X}"), "0x2A");
assert_eq!(format!("{:X}", -16), "FFFFFFF0");
```
Implementing `UpperHex` on a type:
```
use std::fmt;
struct Length(i32);
impl fmt::UpperHex for Length {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let val = self.0;
fmt::UpperHex::fmt(&val, f) // delegate to i32's implementation
}
}
let l = Length(i32::MAX);
assert_eq!(format!("l as hex is: {l:X}"), "l as hex is: 7FFFFFFF");
assert_eq!(format!("l as hex is: {l:#010X}"), "l as hex is: 0x7FFFFFFF");
```
Required Methods
----------------
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#999)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter.
Implementors
------------
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#175)### impl UpperHex for i8
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#176)### impl UpperHex for i16
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#177)### impl UpperHex for i32
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#178)### impl UpperHex for i64
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#179)### impl UpperHex for i128
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#174)### impl UpperHex for isize
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#175)### impl UpperHex for u8
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#176)### impl UpperHex for u16
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#177)### impl UpperHex for u32
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#178)### impl UpperHex for u64
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#179)### impl UpperHex for u128
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#174)### impl UpperHex for usize
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.34.0 · ### impl UpperHex for NonZeroI8
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.34.0 · ### impl UpperHex for NonZeroI16
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.34.0 · ### impl UpperHex for NonZeroI32
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.34.0 · ### impl UpperHex for NonZeroI64
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.34.0 · ### impl UpperHex for NonZeroI128
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.34.0 · ### impl UpperHex for NonZeroIsize
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.28.0 · ### impl UpperHex for NonZeroU8
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.28.0 · ### impl UpperHex for NonZeroU16
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.28.0 · ### impl UpperHex for NonZeroU32
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.28.0 · ### impl UpperHex for NonZeroU64
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.28.0 · ### impl UpperHex for NonZeroU128
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.28.0 · ### impl UpperHex for NonZeroUsize
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#2376)### impl<T> UpperHex for &Twhere T: [UpperHex](trait.upperhex "trait std::fmt::UpperHex") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#2376)### impl<T> UpperHex for &mut Twhere T: [UpperHex](trait.upperhex "trait std::fmt::UpperHex") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/num/saturating.rs.html#76)### impl<T> UpperHex for Saturating<T>where T: [UpperHex](trait.upperhex "trait std::fmt::UpperHex"),
[source](https://doc.rust-lang.org/src/core/num/wrapping.rs.html#80)1.11.0 · ### impl<T> UpperHex for Wrapping<T>where T: [UpperHex](trait.upperhex "trait std::fmt::UpperHex"),
[source](https://doc.rust-lang.org/src/core/up/up/portable-simd/crates/core_simd/src/fmt.rs.html#31-39)### impl<T, const LANES: usize> UpperHex for Simd<T, LANES>where T: [SimdElement](../simd/trait.simdelement "trait std::simd::SimdElement") + [UpperHex](trait.upperhex "trait std::fmt::UpperHex"), [LaneCount](../simd/struct.lanecount "struct std::simd::LaneCount")<LANES>: [SupportedLaneCount](../simd/trait.supportedlanecount "trait std::simd::SupportedLaneCount"),
rust Struct std::fmt::DebugList Struct std::fmt::DebugList
==========================
```
pub struct DebugList<'a, 'b>where 'b: 'a,{ /* private fields */ }
```
A struct to help with [`fmt::Debug`](trait.debug) implementations.
This is useful when you wish to output a formatted list of items as a part of your [`Debug::fmt`](trait.debug#tymethod.fmt "Debug::fmt") implementation.
This can be constructed by the [`Formatter::debug_list`](struct.formatter#method.debug_list "Formatter::debug_list") method.
Examples
--------
```
use std::fmt;
struct Foo(Vec<i32>);
impl fmt::Debug for Foo {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fmt.debug_list().entries(self.0.iter()).finish()
}
}
assert_eq!(
format!("{:?}", Foo(vec![10, 11])),
"[10, 11]",
);
```
Implementations
---------------
[source](https://doc.rust-lang.org/src/core/fmt/builders.rs.html#573)### impl<'a, 'b> DebugList<'a, 'b>where 'b: 'a,
[source](https://doc.rust-lang.org/src/core/fmt/builders.rs.html#598)#### pub fn entry(&mut self, entry: &dyn Debug) -> &mut DebugList<'a, 'b>
Adds a new entry to the list output.
##### Examples
```
use std::fmt;
struct Foo(Vec<i32>, Vec<u32>);
impl fmt::Debug for Foo {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt.debug_list()
.entry(&self.0) // We add the first "entry".
.entry(&self.1) // We add the second "entry".
.finish()
}
}
assert_eq!(
format!("{:?}", Foo(vec![10, 11], vec![12, 13])),
"[[10, 11], [12, 13]]",
);
```
[source](https://doc.rust-lang.org/src/core/fmt/builders.rs.html#627-630)#### pub fn entries<D, I>(&mut self, entries: I) -> &mut DebugList<'a, 'b>where D: [Debug](trait.debug "trait std::fmt::Debug"), I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")<Item = D>,
Adds the contents of an iterator of entries to the list output.
##### Examples
```
use std::fmt;
struct Foo(Vec<i32>, Vec<u32>);
impl fmt::Debug for Foo {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt.debug_list()
.entries(self.0.iter())
.entries(self.1.iter())
.finish()
}
}
assert_eq!(
format!("{:?}", Foo(vec![10, 11], vec![12, 13])),
"[10, 11, 12, 13]",
);
```
[source](https://doc.rust-lang.org/src/core/fmt/builders.rs.html#661)#### pub fn finish(&mut self) -> Result<(), Error>
Finishes output and returns any error encountered.
##### Examples
```
use std::fmt;
struct Foo(Vec<i32>);
impl fmt::Debug for Foo {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt.debug_list()
.entries(self.0.iter())
.finish() // Ends the struct formatting.
}
}
assert_eq!(
format!("{:?}", Foo(vec![10, 11])),
"[10, 11]",
);
```
Auto Trait Implementations
--------------------------
### impl<'a, 'b> !RefUnwindSafe for DebugList<'a, 'b>
### impl<'a, 'b> !Send for DebugList<'a, 'b>
### impl<'a, 'b> !Sync for DebugList<'a, 'b>
### impl<'a, 'b> Unpin for DebugList<'a, 'b>where 'b: 'a,
### impl<'a, 'b> !UnwindSafe for DebugList<'a, 'b>
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
rust Trait std::fmt::Pointer Trait std::fmt::Pointer
=======================
```
pub trait Pointer {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>;
}
```
`p` formatting.
The `Pointer` trait should format its output as a memory location. This is commonly presented as hexadecimal.
For more information on formatters, see [the module-level documentation](index).
Examples
--------
Basic usage with `&i32`:
```
let x = &42;
let address = format!("{x:p}"); // this produces something like '0x7f06092ac6d0'
```
Implementing `Pointer` on a type:
```
use std::fmt;
struct Length(i32);
impl fmt::Pointer for Length {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
// use `as` to convert to a `*const T`, which implements Pointer, which we can use
let ptr = self as *const Self;
fmt::Pointer::fmt(&ptr, f)
}
}
let l = Length(42);
println!("l is in memory here: {l:p}");
let l_ptr = format!("{l:018p}");
assert_eq!(l_ptr.len(), 18);
assert_eq!(&l_ptr[..2], "0x");
```
Required Methods
----------------
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#1051)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter.
Implementors
------------
[source](https://doc.rust-lang.org/src/core/pin.rs.html#903)1.33.0 · ### impl<P> Pointer for Pin<P>where P: [Pointer](trait.pointer "trait std::fmt::Pointer"),
[source](https://doc.rust-lang.org/src/core/ptr/mod.rs.html#1949)1.4.0 · ### impl<Ret, T> Pointer for fn (T₁, T₂, …, Tₙ) -> Ret
This trait is implemented for function pointers with up to twelve arguments.
[source](https://doc.rust-lang.org/src/core/ptr/mod.rs.html#1949)1.4.0 · ### impl<Ret, T> Pointer for extern "C" fn (T₁, T₂, …, Tₙ) -> Ret
This trait is implemented for function pointers with up to twelve arguments.
[source](https://doc.rust-lang.org/src/core/ptr/mod.rs.html#1949)1.4.0 · ### impl<Ret, T> Pointer for extern "C" fn (T₁, T₂, …, Tₙ, ...) -> Ret
This trait is implemented for function pointers with up to twelve arguments.
[source](https://doc.rust-lang.org/src/core/ptr/mod.rs.html#1949)1.4.0 · ### impl<Ret, T> Pointer for unsafe fn (T₁, T₂, …, Tₙ) -> Ret
This trait is implemented for function pointers with up to twelve arguments.
[source](https://doc.rust-lang.org/src/core/ptr/mod.rs.html#1949)1.4.0 · ### impl<Ret, T> Pointer for unsafe extern "C" fn (T₁, T₂, …, Tₙ) -> Ret
This trait is implemented for function pointers with up to twelve arguments.
[source](https://doc.rust-lang.org/src/core/ptr/mod.rs.html#1949)1.4.0 · ### impl<Ret, T> Pointer for unsafe extern "C" fn (T₁, T₂, …, Tₙ, ...) -> Ret
This trait is implemented for function pointers with up to twelve arguments.
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#2466)### impl<T> Pointer for \*const Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#2506)### impl<T> Pointer for \*mut Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#2513)### impl<T> Pointer for &Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#2520)### impl<T> Pointer for &mut Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/ptr/non_null.rs.html#725)1.25.0 · ### impl<T> Pointer for NonNull<T>where T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/alloc/rc.rs.html#1851)### impl<T> Pointer for Rc<T>where T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/sync/atomic.rs.html#3414)1.24.0 · ### impl<T> Pointer for AtomicPtr<T>
[source](https://doc.rust-lang.org/src/alloc/sync.rs.html#2429)### impl<T> Pointer for Arc<T>where T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#1840)### impl<T, A> Pointer for Box<T, A>where A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator"), T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
rust Struct std::fmt::DebugStruct Struct std::fmt::DebugStruct
============================
```
pub struct DebugStruct<'a, 'b>where 'b: 'a,{ /* private fields */ }
```
A struct to help with [`fmt::Debug`](trait.debug) implementations.
This is useful when you wish to output a formatted struct as a part of your [`Debug::fmt`](trait.debug#tymethod.fmt "Debug::fmt") implementation.
This can be constructed by the [`Formatter::debug_struct`](struct.formatter#method.debug_struct "Formatter::debug_struct") method.
Examples
--------
```
use std::fmt;
struct Foo {
bar: i32,
baz: String,
}
impl fmt::Debug for Foo {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fmt.debug_struct("Foo")
.field("bar", &self.bar)
.field("baz", &self.baz)
.finish()
}
}
assert_eq!(
format!("{:?}", Foo { bar: 10, baz: "Hello World".to_string() }),
"Foo { bar: 10, baz: \"Hello World\" }",
);
```
Implementations
---------------
[source](https://doc.rust-lang.org/src/core/fmt/builders.rs.html#93)### impl<'a, 'b> DebugStruct<'a, 'b>where 'b: 'a,
[source](https://doc.rust-lang.org/src/core/fmt/builders.rs.html#123)#### pub fn field(&mut self, name: &str, value: &dyn Debug) -> &mut DebugStruct<'a, 'b>
Adds a new field to the generated struct output.
##### Examples
```
use std::fmt;
struct Bar {
bar: i32,
another: String,
}
impl fmt::Debug for Bar {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt.debug_struct("Bar")
.field("bar", &self.bar) // We add `bar` field.
.field("another", &self.another) // We add `another` field.
// We even add a field which doesn't exist (because why not?).
.field("not_existing_field", &1)
.finish() // We're good to go!
}
}
assert_eq!(
format!("{:?}", Bar { bar: 10, another: "Hello World".to_string() }),
"Bar { bar: 10, another: \"Hello World\", not_existing_field: 1 }",
);
```
[source](https://doc.rust-lang.org/src/core/fmt/builders.rs.html#176)1.53.0 · #### pub fn finish\_non\_exhaustive(&mut self) -> Result<(), Error>
Marks the struct as non-exhaustive, indicating to the reader that there are some other fields that are not shown in the debug representation.
##### Examples
```
use std::fmt;
struct Bar {
bar: i32,
hidden: f32,
}
impl fmt::Debug for Bar {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt.debug_struct("Bar")
.field("bar", &self.bar)
.finish_non_exhaustive() // Show that some other field(s) exist.
}
}
assert_eq!(
format!("{:?}", Bar { bar: 10, hidden: 1.0 }),
"Bar { bar: 10, .. }",
);
```
[source](https://doc.rust-lang.org/src/core/fmt/builders.rs.html#223)#### pub fn finish(&mut self) -> Result<(), Error>
Finishes output and returns any error encountered.
##### Examples
```
use std::fmt;
struct Bar {
bar: i32,
baz: String,
}
impl fmt::Debug for Bar {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt.debug_struct("Bar")
.field("bar", &self.bar)
.field("baz", &self.baz)
.finish() // You need to call it to "finish" the
// struct formatting.
}
}
assert_eq!(
format!("{:?}", Bar { bar: 10, baz: "Hello World".to_string() }),
"Bar { bar: 10, baz: \"Hello World\" }",
);
```
Auto Trait Implementations
--------------------------
### impl<'a, 'b> !RefUnwindSafe for DebugStruct<'a, 'b>
### impl<'a, 'b> !Send for DebugStruct<'a, 'b>
### impl<'a, 'b> !Sync for DebugStruct<'a, 'b>
### impl<'a, 'b> Unpin for DebugStruct<'a, 'b>where 'b: 'a,
### impl<'a, 'b> !UnwindSafe for DebugStruct<'a, 'b>
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Struct std::fmt::Error Struct std::fmt::Error
======================
```
pub struct Error;
```
The error type which is returned from formatting a message into a stream.
This type does not support transmission of an error other than that an error occurred. Any extra information must be arranged to be transmitted through some other means.
An important thing to remember is that the type `fmt::Error` should not be confused with [`std::io::Error`](../io/struct.error) or [`std::error::Error`](../error/trait.error), which you may also have in scope.
Examples
--------
```
use std::fmt::{self, write};
let mut output = String::new();
if let Err(fmt::Error) = write(&mut output, format_args!("Hello {}!", "world")) {
panic!("An error occurred");
}
```
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#98)### impl Clone for Error
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#98)#### fn clone(&self) -> Error
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)#### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#98)### impl Debug for Error
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#98)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#98)### impl Default for Error
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#98)#### fn default() -> Error
Returns the “default value” for a type. [Read more](../default/trait.default#tymethod.default)
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#2353)### impl Display for Error
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#2354)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](trait.display#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/error.rs.html#457)1.11.0 · ### impl Error for Error
[source](https://doc.rust-lang.org/src/core/error.rs.html#459)#### fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to\_string()
[Read more](../error/trait.error#method.description)
[source](https://doc.rust-lang.org/src/core/error.rs.html#83)1.30.0 · #### fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. [Read more](../error/trait.error#method.source)
[source](https://doc.rust-lang.org/src/core/error.rs.html#119)#### fn cause(&self) -> Option<&dyn Error>
👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
[source](https://doc.rust-lang.org/src/core/error.rs.html#193)#### fn provide(&'a self, demand: &mut Demand<'a>)
🔬This is a nightly-only experimental API. (`error_generic_member_access` [#99301](https://github.com/rust-lang/rust/issues/99301))
Provides type based access to context intended for error reports. [Read more](../error/trait.error#method.provide)
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#98)### impl Hash for Error
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#98)#### fn hash<\_\_H>(&self, state: &mut \_\_H)where \_\_H: [Hasher](../hash/trait.hasher "trait std::hash::Hasher"),
Feeds this value into the given [`Hasher`](../hash/trait.hasher "Hasher"). [Read more](../hash/trait.hash#tymethod.hash)
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#237-239)1.3.0 · #### fn hash\_slice<H>(data: &[Self], state: &mut H)where H: [Hasher](../hash/trait.hasher "trait std::hash::Hasher"),
Feeds a slice of this type into the given [`Hasher`](../hash/trait.hasher "Hasher"). [Read more](../hash/trait.hash#method.hash_slice)
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#98)### impl Ord for Error
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#98)#### fn cmp(&self, other: &Error) -> Ordering
This method returns an [`Ordering`](../cmp/enum.ordering "Ordering") between `self` and `other`. [Read more](../cmp/trait.ord#tymethod.cmp)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#804-807)1.21.0 · #### fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. [Read more](../cmp/trait.ord#method.max)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#831-834)1.21.0 · #### fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. [Read more](../cmp/trait.ord#method.min)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#863-867)1.50.0 · #### fn clamp(self, min: Self, max: Self) -> Selfwhere Self: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<Self>,
Restrict a value to a certain interval. [Read more](../cmp/trait.ord#method.clamp)
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#98)### impl PartialEq<Error> for Error
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#98)#### fn eq(&self, other: &Error) -> bool
This method tests for `self` and `other` values to be equal, and is used by `==`. [Read more](../cmp/trait.partialeq#tymethod.eq)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#236)#### fn ne(&self, other: &Rhs) -> bool
This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. [Read more](../cmp/trait.partialeq#method.ne)
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#98)### impl PartialOrd<Error> for Error
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#98)#### fn partial\_cmp(&self, other: &Error) -> Option<Ordering>
This method returns an ordering between `self` and `other` values if one exists. [Read more](../cmp/trait.partialord#tymethod.partial_cmp)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1138)#### fn lt(&self, other: &Rhs) -> bool
This method tests less than (for `self` and `other`) and is used by the `<` operator. [Read more](../cmp/trait.partialord#method.lt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1157)#### fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for `self` and `other`) and is used by the `<=` operator. [Read more](../cmp/trait.partialord#method.le)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1175)#### fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for `self` and `other`) and is used by the `>` operator. [Read more](../cmp/trait.partialord#method.gt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1194)#### fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for `self` and `other`) and is used by the `>=` operator. [Read more](../cmp/trait.partialord#method.ge)
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#98)### impl Copy for Error
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#98)### impl Eq for Error
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#98)### impl StructuralEq for Error
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#98)### impl StructuralPartialEq for Error
Auto Trait Implementations
--------------------------
### impl RefUnwindSafe for Error
### impl Send for Error
### impl Sync for Error
### impl Unpin for Error
### impl UnwindSafe for Error
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/error.rs.html#197)### impl<E> Provider for Ewhere E: [Error](../error/trait.error "trait std::error::Error") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/error.rs.html#201)#### fn provide(&'a self, demand: &mut Demand<'a>)
🔬This is a nightly-only experimental API. (`provide_any` [#96024](https://github.com/rust-lang/rust/issues/96024))
Data providers should implement this method to provide *all* values they are able to provide by using `demand`. [Read more](../any/trait.provider#tymethod.provide)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/alloc/string.rs.html#2500)### impl<T> ToString for Twhere T: [Display](trait.display "trait std::fmt::Display") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/alloc/string.rs.html#2506)#### default fn to\_string(&self) -> String
Converts the given value to a `String`. [Read more](../string/trait.tostring#tymethod.to_string)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
rust Trait std::fmt::Octal Trait std::fmt::Octal
=====================
```
pub trait Octal {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>;
}
```
`o` formatting.
The `Octal` trait should format its output as a number in base-8.
For primitive signed integers (`i8` to `i128`, and `isize`), negative values are formatted as the two’s complement representation.
The alternate flag, `#`, adds a `0o` in front of the output.
For more information on formatters, see [the module-level documentation](index).
Examples
--------
Basic usage with `i32`:
```
let x = 42; // 42 is '52' in octal
assert_eq!(format!("{x:o}"), "52");
assert_eq!(format!("{x:#o}"), "0o52");
assert_eq!(format!("{:o}", -16), "37777777760");
```
Implementing `Octal` on a type:
```
use std::fmt;
struct Length(i32);
impl fmt::Octal for Length {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let val = self.0;
fmt::Octal::fmt(&val, f) // delegate to i32's implementation
}
}
let l = Length(9);
assert_eq!(format!("l as octal is: {l:o}"), "l as octal is: 11");
assert_eq!(format!("l as octal is: {l:#06o}"), "l as octal is: 0o0011");
```
Required Methods
----------------
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#832)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter.
Implementors
------------
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#175)### impl Octal for i8
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#176)### impl Octal for i16
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#177)### impl Octal for i32
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#178)### impl Octal for i64
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#179)### impl Octal for i128
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#174)### impl Octal for isize
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#175)### impl Octal for u8
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#176)### impl Octal for u16
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#177)### impl Octal for u32
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#178)### impl Octal for u64
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#179)### impl Octal for u128
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#174)### impl Octal for usize
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.34.0 · ### impl Octal for NonZeroI8
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.34.0 · ### impl Octal for NonZeroI16
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.34.0 · ### impl Octal for NonZeroI32
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.34.0 · ### impl Octal for NonZeroI64
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.34.0 · ### impl Octal for NonZeroI128
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.34.0 · ### impl Octal for NonZeroIsize
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.28.0 · ### impl Octal for NonZeroU8
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.28.0 · ### impl Octal for NonZeroU16
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.28.0 · ### impl Octal for NonZeroU32
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.28.0 · ### impl Octal for NonZeroU64
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.28.0 · ### impl Octal for NonZeroU128
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.28.0 · ### impl Octal for NonZeroUsize
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#2376)### impl<T> Octal for &Twhere T: [Octal](trait.octal "trait std::fmt::Octal") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#2376)### impl<T> Octal for &mut Twhere T: [Octal](trait.octal "trait std::fmt::Octal") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/num/saturating.rs.html#62)### impl<T> Octal for Saturating<T>where T: [Octal](trait.octal "trait std::fmt::Octal"),
[source](https://doc.rust-lang.org/src/core/num/wrapping.rs.html#66)1.11.0 · ### impl<T> Octal for Wrapping<T>where T: [Octal](trait.octal "trait std::fmt::Octal"),
[source](https://doc.rust-lang.org/src/core/up/up/portable-simd/crates/core_simd/src/fmt.rs.html#31-39)### impl<T, const LANES: usize> Octal for Simd<T, LANES>where T: [SimdElement](../simd/trait.simdelement "trait std::simd::SimdElement") + [Octal](trait.octal "trait std::fmt::Octal"), [LaneCount](../simd/struct.lanecount "struct std::simd::LaneCount")<LANES>: [SupportedLaneCount](../simd/trait.supportedlanecount "trait std::simd::SupportedLaneCount"),
rust Function std::fmt::write Function std::fmt::write
========================
```
pub fn write(output: &mut dyn Write, args: Arguments<'_>) -> Result<(), Error>
```
The `write` function takes an output stream, and an `Arguments` struct that can be precompiled with the `format_args!` macro.
The arguments will be formatted according to the specified format string into the output stream provided.
Examples
--------
Basic usage:
```
use std::fmt;
let mut output = String::new();
fmt::write(&mut output, format_args!("Hello {}!", "world"))
.expect("Error occurred while trying to write in String");
assert_eq!(output, "Hello world!");
```
Please note that using [`write!`](../macro.write) might be preferable. Example:
```
use std::fmt::Write;
let mut output = String::new();
write!(&mut output, "Hello {}!", "world")
.expect("Error occurred while trying to write in String");
assert_eq!(output, "Hello world!");
```
rust Struct std::fmt::Formatter Struct std::fmt::Formatter
==========================
```
pub struct Formatter<'a> { /* private fields */ }
```
Configuration for formatting.
A `Formatter` represents various options related to formatting. Users do not construct `Formatter`s directly; a mutable reference to one is passed to the `fmt` method of all formatting traits, like [`Debug`](trait.debug "Debug") and [`Display`](trait.display "Display").
To interact with a `Formatter`, you’ll call various methods to change the various options related to formatting. For examples, please see the documentation of the methods defined on `Formatter` below.
Implementations
---------------
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#1287)### impl<'a> Formatter<'a>
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#1354)#### pub fn pad\_integral( &mut self, is\_nonnegative: bool, prefix: &str, buf: &str) -> Result<(), Error>
Performs the correct padding for an integer which has already been emitted into a str. The str should *not* contain the sign for the integer, that will be added by this method.
##### Arguments
* is\_nonnegative - whether the original integer was either positive or zero.
* prefix - if the ‘#’ character (Alternate) is provided, this is the prefix to put in front of the number.
* buf - the byte array that the number has been formatted into
This function will correctly account for the flags provided as well as the minimum width. It will not take precision into account.
##### Examples
```
use std::fmt;
struct Foo { nb: i32 }
impl Foo {
fn new(nb: i32) -> Foo {
Foo {
nb,
}
}
}
impl fmt::Display for Foo {
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
// We need to remove "-" from the number output.
let tmp = self.nb.abs().to_string();
formatter.pad_integral(self.nb >= 0, "Foo ", &tmp)
}
}
assert_eq!(&format!("{}", Foo::new(2)), "2");
assert_eq!(&format!("{}", Foo::new(-1)), "-1");
assert_eq!(&format!("{}", Foo::new(0)), "0");
assert_eq!(&format!("{:#}", Foo::new(-1)), "-Foo 1");
assert_eq!(&format!("{:0>#8}", Foo::new(-1)), "00-Foo 1");
```
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#1448)#### pub fn pad(&mut self, s: &str) -> Result<(), Error>
This function takes a string slice and emits it to the internal buffer after applying the relevant formatting flags specified. The flags recognized for generic strings are:
* width - the minimum width of what to emit
* fill/align - what to emit and where to emit it if the string provided needs to be padded
* precision - the maximum length to emit, the string is truncated if it is longer than this length
Notably this function ignores the `flag` parameters.
##### Examples
```
use std::fmt;
struct Foo;
impl fmt::Display for Foo {
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
formatter.pad("Foo")
}
}
assert_eq!(&format!("{Foo:<4}"), "Foo ");
assert_eq!(&format!("{Foo:0>4}"), "0Foo");
```
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#1632)#### pub fn write\_str(&mut self, data: &str) -> Result<(), Error>
Writes some data to the underlying buffer contained within this formatter.
##### Examples
```
use std::fmt;
struct Foo;
impl fmt::Display for Foo {
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
formatter.write_str("Foo")
// This is equivalent to:
// write!(formatter, "Foo")
}
}
assert_eq!(&format!("{Foo}"), "Foo");
assert_eq!(&format!("{Foo:0>8}"), "Foo");
```
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#1655)#### pub fn write\_fmt(&mut self, fmt: Arguments<'\_>) -> Result<(), Error>
Writes some formatted information into this instance.
##### Examples
```
use std::fmt;
struct Foo(i32);
impl fmt::Display for Foo {
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
formatter.write_fmt(format_args!("Foo {}", self.0))
}
}
assert_eq!(&format!("{}", Foo(-1)), "Foo -1");
assert_eq!(&format!("{:0>8}", Foo(2)), "Foo 2");
```
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#1667)#### pub fn flags(&self) -> u32
👎Deprecated since 1.24.0: use the `sign_plus`, `sign_minus`, `alternate`, or `sign_aware_zero_pad` methods instead
Flags for formatting
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#1700)1.5.0 · #### pub fn fill(&self) -> char
Character used as ‘fill’ whenever there is alignment.
##### Examples
```
use std::fmt;
struct Foo;
impl fmt::Display for Foo {
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
let c = formatter.fill();
if let Some(width) = formatter.width() {
for _ in 0..width {
write!(formatter, "{c}")?;
}
Ok(())
} else {
write!(formatter, "{c}")
}
}
}
// We set alignment to the right with ">".
assert_eq!(&format!("{Foo:G>3}"), "GGG");
assert_eq!(&format!("{Foo:t>6}"), "tttttt");
```
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#1737)1.28.0 · #### pub fn align(&self) -> Option<Alignment>
Flag indicating what form of alignment was requested.
##### Examples
```
extern crate core;
use std::fmt::{self, Alignment};
struct Foo;
impl fmt::Display for Foo {
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
let s = if let Some(s) = formatter.align() {
match s {
Alignment::Left => "left",
Alignment::Right => "right",
Alignment::Center => "center",
}
} else {
"into the void"
};
write!(formatter, "{s}")
}
}
assert_eq!(&format!("{Foo:<}"), "left");
assert_eq!(&format!("{Foo:>}"), "right");
assert_eq!(&format!("{Foo:^}"), "center");
assert_eq!(&format!("{Foo}"), "into the void");
```
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#1772)1.5.0 · #### pub fn width(&self) -> Option<usize>
Optionally specified integer width that the output should be.
##### Examples
```
use std::fmt;
struct Foo(i32);
impl fmt::Display for Foo {
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
if let Some(width) = formatter.width() {
// If we received a width, we use it
write!(formatter, "{:width$}", &format!("Foo({})", self.0), width = width)
} else {
// Otherwise we do nothing special
write!(formatter, "Foo({})", self.0)
}
}
}
assert_eq!(&format!("{:10}", Foo(23)), "Foo(23) ");
assert_eq!(&format!("{}", Foo(23)), "Foo(23)");
```
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#1803)1.5.0 · #### pub fn precision(&self) -> Option<usize>
Optionally specified precision for numeric types. Alternatively, the maximum width for string types.
##### Examples
```
use std::fmt;
struct Foo(f32);
impl fmt::Display for Foo {
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
if let Some(precision) = formatter.precision() {
// If we received a precision, we use it.
write!(formatter, "Foo({1:.*})", precision, self.0)
} else {
// Otherwise we default to 2.
write!(formatter, "Foo({:.2})", self.0)
}
}
}
assert_eq!(&format!("{:.4}", Foo(23.2)), "Foo(23.2000)");
assert_eq!(&format!("{}", Foo(23.2)), "Foo(23.20)");
```
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#1835)1.5.0 · #### pub fn sign\_plus(&self) -> bool
Determines if the `+` flag was specified.
##### Examples
```
use std::fmt;
struct Foo(i32);
impl fmt::Display for Foo {
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
if formatter.sign_plus() {
write!(formatter,
"Foo({}{})",
if self.0 < 0 { '-' } else { '+' },
self.0.abs())
} else {
write!(formatter, "Foo({})", self.0)
}
}
}
assert_eq!(&format!("{:+}", Foo(23)), "Foo(+23)");
assert_eq!(&format!("{:+}", Foo(-23)), "Foo(-23)");
assert_eq!(&format!("{}", Foo(23)), "Foo(23)");
```
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#1864)1.5.0 · #### pub fn sign\_minus(&self) -> bool
Determines if the `-` flag was specified.
##### Examples
```
use std::fmt;
struct Foo(i32);
impl fmt::Display for Foo {
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
if formatter.sign_minus() {
// You want a minus sign? Have one!
write!(formatter, "-Foo({})", self.0)
} else {
write!(formatter, "Foo({})", self.0)
}
}
}
assert_eq!(&format!("{:-}", Foo(23)), "-Foo(23)");
assert_eq!(&format!("{}", Foo(23)), "Foo(23)");
```
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#1892)1.5.0 · #### pub fn alternate(&self) -> bool
Determines if the `#` flag was specified.
##### Examples
```
use std::fmt;
struct Foo(i32);
impl fmt::Display for Foo {
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
if formatter.alternate() {
write!(formatter, "Foo({})", self.0)
} else {
write!(formatter, "{}", self.0)
}
}
}
assert_eq!(&format!("{:#}", Foo(23)), "Foo(23)");
assert_eq!(&format!("{}", Foo(23)), "23");
```
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#1918)1.5.0 · #### pub fn sign\_aware\_zero\_pad(&self) -> bool
Determines if the `0` flag was specified.
##### Examples
```
use std::fmt;
struct Foo(i32);
impl fmt::Display for Foo {
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
assert!(formatter.sign_aware_zero_pad());
assert_eq!(formatter.width(), Some(4));
// We ignore the formatter's options.
write!(formatter, "{}", self.0)
}
}
assert_eq!(&format!("{:04}", Foo(23)), "23");
```
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#1969)1.2.0 · #### pub fn debug\_struct(&'b mut self, name: &str) -> DebugStruct<'b, 'a>
Creates a [`DebugStruct`](struct.debugstruct "DebugStruct") builder designed to assist with creation of [`fmt::Debug`](trait.debug) implementations for structs.
##### Examples
```
use std::fmt;
use std::net::Ipv4Addr;
struct Foo {
bar: i32,
baz: String,
addr: Ipv4Addr,
}
impl fmt::Debug for Foo {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fmt.debug_struct("Foo")
.field("bar", &self.bar)
.field("baz", &self.baz)
.field("addr", &format_args!("{}", self.addr))
.finish()
}
}
assert_eq!(
"Foo { bar: 10, baz: \"Hello World\", addr: 127.0.0.1 }",
format!("{:?}", Foo {
bar: 10,
baz: "Hello World".to_string(),
addr: Ipv4Addr::new(127, 0, 0, 1),
})
);
```
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#2123)1.2.0 · #### pub fn debug\_tuple(&'b mut self, name: &str) -> DebugTuple<'b, 'a>
Creates a `DebugTuple` builder designed to assist with creation of `fmt::Debug` implementations for tuple structs.
##### Examples
```
use std::fmt;
use std::marker::PhantomData;
struct Foo<T>(i32, String, PhantomData<T>);
impl<T> fmt::Debug for Foo<T> {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fmt.debug_tuple("Foo")
.field(&self.0)
.field(&self.1)
.field(&format_args!("_"))
.finish()
}
}
assert_eq!(
"Foo(10, \"Hello\", _)",
format!("{:?}", Foo(10, "Hello".to_string(), PhantomData::<u8>))
);
```
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#2248)1.2.0 · #### pub fn debug\_list(&'b mut self) -> DebugList<'b, 'a>
Creates a `DebugList` builder designed to assist with creation of `fmt::Debug` implementations for list-like structures.
##### Examples
```
use std::fmt;
struct Foo(Vec<i32>);
impl fmt::Debug for Foo {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fmt.debug_list().entries(self.0.iter()).finish()
}
}
assert_eq!(format!("{:?}", Foo(vec![10, 11])), "[10, 11]");
```
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#2306)1.2.0 · #### pub fn debug\_set(&'b mut self) -> DebugSet<'b, 'a>
Creates a `DebugSet` builder designed to assist with creation of `fmt::Debug` implementations for set-like structures.
##### Examples
```
use std::fmt;
struct Foo(Vec<i32>);
impl fmt::Debug for Foo {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fmt.debug_set().entries(self.0.iter()).finish()
}
}
assert_eq!(format!("{:?}", Foo(vec![10, 11])), "{10, 11}");
```
In this more complex example, we use [`format_args!`](../macro.format_args) and `.debug_set()` to build a list of match arms:
```
use std::fmt;
struct Arm<'a, L: 'a, R: 'a>(&'a (L, R));
struct Table<'a, K: 'a, V: 'a>(&'a [(K, V)], V);
impl<'a, L, R> fmt::Debug for Arm<'a, L, R>
where
L: 'a + fmt::Debug, R: 'a + fmt::Debug
{
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
L::fmt(&(self.0).0, fmt)?;
fmt.write_str(" => ")?;
R::fmt(&(self.0).1, fmt)
}
}
impl<'a, K, V> fmt::Debug for Table<'a, K, V>
where
K: 'a + fmt::Debug, V: 'a + fmt::Debug
{
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fmt.debug_set()
.entries(self.0.iter().map(Arm))
.entry(&Arm(&(format_args!("_"), &self.1)))
.finish()
}
}
```
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#2332)1.2.0 · #### pub fn debug\_map(&'b mut self) -> DebugMap<'b, 'a>
Creates a `DebugMap` builder designed to assist with creation of `fmt::Debug` implementations for map-like structures.
##### Examples
```
use std::fmt;
struct Foo(Vec<(String, i32)>);
impl fmt::Debug for Foo {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fmt.debug_map().entries(self.0.iter().map(|&(ref k, ref v)| (k, v))).finish()
}
}
assert_eq!(
format!("{:?}", Foo(vec![("A".to_string(), 10), ("B".to_string(), 11)])),
r#"{"A": 10, "B": 11}"#
);
```
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#2338)1.2.0 · ### impl Write for Formatter<'\_>
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#2339)#### fn write\_str(&mut self, s: &str) -> Result<(), Error>
Writes a string slice into this writer, returning whether the write succeeded. [Read more](trait.write#tymethod.write_str)
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#2343)#### fn write\_char(&mut self, c: char) -> Result<(), Error>
Writes a [`char`](../primitive.char "char") into this writer, returning whether the write succeeded. [Read more](trait.write#method.write_char)
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#2347)#### fn write\_fmt(&mut self, args: Arguments<'\_>) -> Result<(), Error>
Glue for usage of the [`write!`](../macro.write "write!") macro with implementors of this trait. [Read more](trait.write#method.write_fmt)
Auto Trait Implementations
--------------------------
### impl<'a> !RefUnwindSafe for Formatter<'a>
### impl<'a> !Send for Formatter<'a>
### impl<'a> !Sync for Formatter<'a>
### impl<'a> Unpin for Formatter<'a>
### impl<'a> !UnwindSafe for Formatter<'a>
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Trait std::fmt::LowerExp Trait std::fmt::LowerExp
========================
```
pub trait LowerExp {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>;
}
```
`e` formatting.
The `LowerExp` trait should format its output in scientific notation with a lower-case `e`.
For more information on formatters, see [the module-level documentation](index).
Examples
--------
Basic usage with `f64`:
```
let x = 42.0; // 42.0 is '4.2e1' in scientific notation
assert_eq!(format!("{x:e}"), "4.2e1");
```
Implementing `LowerExp` on a type:
```
use std::fmt;
struct Length(i32);
impl fmt::LowerExp for Length {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let val = f64::from(self.0);
fmt::LowerExp::fmt(&val, f) // delegate to f64's implementation
}
}
let l = Length(100);
assert_eq!(
format!("l in scientific notation is: {l:e}"),
"l in scientific notation is: 1e2"
);
assert_eq!(
format!("l in scientific notation is: {l:05e}"),
"l in scientific notation is: 001e2"
);
```
Required Methods
----------------
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#1102)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter.
Implementors
------------
[source](https://doc.rust-lang.org/src/core/fmt/float.rs.html#225)### impl LowerExp for f32
[source](https://doc.rust-lang.org/src/core/fmt/float.rs.html#226)### impl LowerExp for f64
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#465-468)1.42.0 · ### impl LowerExp for i8
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#465-468)1.42.0 · ### impl LowerExp for i16
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#465-468)1.42.0 · ### impl LowerExp for i32
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#465-468)1.42.0 · ### impl LowerExp for i64
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#479)1.42.0 · ### impl LowerExp for i128
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#465-468)1.42.0 · ### impl LowerExp for isize
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#465-468)1.42.0 · ### impl LowerExp for u8
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#465-468)1.42.0 · ### impl LowerExp for u16
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#465-468)1.42.0 · ### impl LowerExp for u32
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#465-468)1.42.0 · ### impl LowerExp for u64
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#479)1.42.0 · ### impl LowerExp for u128
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#465-468)1.42.0 · ### impl LowerExp for usize
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#2376)### impl<T> LowerExp for &Twhere T: [LowerExp](trait.lowerexp "trait std::fmt::LowerExp") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#2376)### impl<T> LowerExp for &mut Twhere T: [LowerExp](trait.lowerexp "trait std::fmt::LowerExp") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/up/up/portable-simd/crates/core_simd/src/fmt.rs.html#31-39)### impl<T, const LANES: usize> LowerExp for Simd<T, LANES>where T: [SimdElement](../simd/trait.simdelement "trait std::simd::SimdElement") + [LowerExp](trait.lowerexp "trait std::fmt::LowerExp"), [LaneCount](../simd/struct.lanecount "struct std::simd::LaneCount")<LANES>: [SupportedLaneCount](../simd/trait.supportedlanecount "trait std::simd::SupportedLaneCount"),
rust Trait std::fmt::Write Trait std::fmt::Write
=====================
```
pub trait Write {
fn write_str(&mut self, s: &str) -> Result<(), Error>;
fn write_char(&mut self, c: char) -> Result<(), Error> { ... }
fn write_fmt(&mut self, args: Arguments<'_>) -> Result<(), Error> { ... }
}
```
A trait for writing or formatting into Unicode-accepting buffers or streams.
This trait only accepts UTF-8–encoded data and is not [flushable](../io/trait.write#tymethod.flush). If you only want to accept Unicode and you don’t need flushing, you should implement this trait; otherwise you should implement [`std::io::Write`](../io/trait.write).
Required Methods
----------------
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#140)#### fn write\_str(&mut self, s: &str) -> Result<(), Error>
Writes a string slice into this writer, returning whether the write succeeded.
This method can only succeed if the entire string slice was successfully written, and this method will not return until all data has been written or an error occurs.
##### Errors
This function will return an instance of [`Error`](struct.error "Error") on error.
The purpose of std::fmt::Error is to abort the formatting operation when the underlying destination encounters some error preventing it from accepting more text; it should generally be propagated rather than handled, at least when implementing formatting traits.
##### Examples
```
use std::fmt::{Error, Write};
fn writer<W: Write>(f: &mut W, s: &str) -> Result<(), Error> {
f.write_str(s)
}
let mut buf = String::new();
writer(&mut buf, "hola").unwrap();
assert_eq!(&buf, "hola");
```
Provided Methods
----------------
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#168)1.1.0 · #### fn write\_char(&mut self, c: char) -> Result<(), Error>
Writes a [`char`](../primitive.char "char") into this writer, returning whether the write succeeded.
A single [`char`](../primitive.char "char") may be encoded as more than one byte. This method can only succeed if the entire byte sequence was successfully written, and this method will not return until all data has been written or an error occurs.
##### Errors
This function will return an instance of [`Error`](struct.error "Error") on error.
##### Examples
```
use std::fmt::{Error, Write};
fn writer<W: Write>(f: &mut W, c: char) -> Result<(), Error> {
f.write_char(c)
}
let mut buf = String::new();
writer(&mut buf, 'a').unwrap();
writer(&mut buf, 'b').unwrap();
assert_eq!(&buf, "ab");
```
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#191)#### fn write\_fmt(&mut self, args: Arguments<'\_>) -> Result<(), Error>
Glue for usage of the [`write!`](../macro.write "write!") macro with implementors of this trait.
This method should generally not be invoked manually, but rather through the [`write!`](../macro.write "write!") macro itself.
##### Examples
```
use std::fmt::{Error, Write};
fn writer<W: Write>(f: &mut W, s: &str) -> Result<(), Error> {
f.write_fmt(format_args!("{s}"))
}
let mut buf = String::new();
writer(&mut buf, "world").unwrap();
assert_eq!(&buf, "world");
```
Implementors
------------
[source](https://doc.rust-lang.org/src/std/ffi/os_str.rs.html#648-653)1.64.0 · ### impl Write for OsString
[source](https://doc.rust-lang.org/src/alloc/string.rs.html#2836)### impl Write for String
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#2338)1.2.0 · ### impl Write for Formatter<'\_>
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#197)1.4.0 · ### impl<W> Write for &mut Wwhere W: [Write](trait.write "trait std::fmt::Write") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
rust Struct std::fmt::DebugTuple Struct std::fmt::DebugTuple
===========================
```
pub struct DebugTuple<'a, 'b>where 'b: 'a,{ /* private fields */ }
```
A struct to help with [`fmt::Debug`](trait.debug) implementations.
This is useful when you wish to output a formatted tuple as a part of your [`Debug::fmt`](trait.debug#tymethod.fmt "Debug::fmt") implementation.
This can be constructed by the [`Formatter::debug_tuple`](struct.formatter#method.debug_tuple "Formatter::debug_tuple") method.
Examples
--------
```
use std::fmt;
struct Foo(i32, String);
impl fmt::Debug for Foo {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fmt.debug_tuple("Foo")
.field(&self.0)
.field(&self.1)
.finish()
}
}
assert_eq!(
format!("{:?}", Foo(10, "Hello World".to_string())),
"Foo(10, \"Hello World\")",
);
```
Implementations
---------------
[source](https://doc.rust-lang.org/src/core/fmt/builders.rs.html#283)### impl<'a, 'b> DebugTuple<'a, 'b>where 'b: 'a,
[source](https://doc.rust-lang.org/src/core/fmt/builders.rs.html#308)#### pub fn field(&mut self, value: &dyn Debug) -> &mut DebugTuple<'a, 'b>
Adds a new field to the generated tuple struct output.
##### Examples
```
use std::fmt;
struct Foo(i32, String);
impl fmt::Debug for Foo {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt.debug_tuple("Foo")
.field(&self.0) // We add the first field.
.field(&self.1) // We add the second field.
.finish() // We're good to go!
}
}
assert_eq!(
format!("{:?}", Foo(10, "Hello World".to_string())),
"Foo(10, \"Hello World\")",
);
```
[source](https://doc.rust-lang.org/src/core/fmt/builders.rs.html#355)#### pub fn finish(&mut self) -> Result<(), Error>
Finishes output and returns any error encountered.
##### Examples
```
use std::fmt;
struct Foo(i32, String);
impl fmt::Debug for Foo {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt.debug_tuple("Foo")
.field(&self.0)
.field(&self.1)
.finish() // You need to call it to "finish" the
// tuple formatting.
}
}
assert_eq!(
format!("{:?}", Foo(10, "Hello World".to_string())),
"Foo(10, \"Hello World\")",
);
```
Auto Trait Implementations
--------------------------
### impl<'a, 'b> !RefUnwindSafe for DebugTuple<'a, 'b>
### impl<'a, 'b> !Send for DebugTuple<'a, 'b>
### impl<'a, 'b> !Sync for DebugTuple<'a, 'b>
### impl<'a, 'b> Unpin for DebugTuple<'a, 'b>where 'b: 'a,
### impl<'a, 'b> !UnwindSafe for DebugTuple<'a, 'b>
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
rust Trait std::fmt::LowerHex Trait std::fmt::LowerHex
========================
```
pub trait LowerHex {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>;
}
```
`x` formatting.
The `LowerHex` trait should format its output as a number in hexadecimal, with `a` through `f` in lower case.
For primitive signed integers (`i8` to `i128`, and `isize`), negative values are formatted as the two’s complement representation.
The alternate flag, `#`, adds a `0x` in front of the output.
For more information on formatters, see [the module-level documentation](index).
Examples
--------
Basic usage with `i32`:
```
let x = 42; // 42 is '2a' in hex
assert_eq!(format!("{x:x}"), "2a");
assert_eq!(format!("{x:#x}"), "0x2a");
assert_eq!(format!("{:x}", -16), "fffffff0");
```
Implementing `LowerHex` on a type:
```
use std::fmt;
struct Length(i32);
impl fmt::LowerHex for Length {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let val = self.0;
fmt::LowerHex::fmt(&val, f) // delegate to i32's implementation
}
}
let l = Length(9);
assert_eq!(format!("l as hex is: {l:x}"), "l as hex is: 9");
assert_eq!(format!("l as hex is: {l:#010x}"), "l as hex is: 0x00000009");
```
Required Methods
----------------
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#944)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter.
Implementors
------------
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#175)### impl LowerHex for i8
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#176)### impl LowerHex for i16
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#177)### impl LowerHex for i32
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#178)### impl LowerHex for i64
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#179)### impl LowerHex for i128
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#174)### impl LowerHex for isize
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#175)### impl LowerHex for u8
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#176)### impl LowerHex for u16
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#177)### impl LowerHex for u32
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#178)### impl LowerHex for u64
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#179)### impl LowerHex for u128
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#174)### impl LowerHex for usize
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.34.0 · ### impl LowerHex for NonZeroI8
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.34.0 · ### impl LowerHex for NonZeroI16
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.34.0 · ### impl LowerHex for NonZeroI32
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.34.0 · ### impl LowerHex for NonZeroI64
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.34.0 · ### impl LowerHex for NonZeroI128
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.34.0 · ### impl LowerHex for NonZeroIsize
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.28.0 · ### impl LowerHex for NonZeroU8
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.28.0 · ### impl LowerHex for NonZeroU16
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.28.0 · ### impl LowerHex for NonZeroU32
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.28.0 · ### impl LowerHex for NonZeroU64
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.28.0 · ### impl LowerHex for NonZeroU128
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.28.0 · ### impl LowerHex for NonZeroUsize
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#2376)### impl<T> LowerHex for &Twhere T: [LowerHex](trait.lowerhex "trait std::fmt::LowerHex") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#2376)### impl<T> LowerHex for &mut Twhere T: [LowerHex](trait.lowerhex "trait std::fmt::LowerHex") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/num/saturating.rs.html#69)### impl<T> LowerHex for Saturating<T>where T: [LowerHex](trait.lowerhex "trait std::fmt::LowerHex"),
[source](https://doc.rust-lang.org/src/core/num/wrapping.rs.html#73)1.11.0 · ### impl<T> LowerHex for Wrapping<T>where T: [LowerHex](trait.lowerhex "trait std::fmt::LowerHex"),
[source](https://doc.rust-lang.org/src/core/up/up/portable-simd/crates/core_simd/src/fmt.rs.html#31-39)### impl<T, const LANES: usize> LowerHex for Simd<T, LANES>where T: [SimdElement](../simd/trait.simdelement "trait std::simd::SimdElement") + [LowerHex](trait.lowerhex "trait std::fmt::LowerHex"), [LaneCount](../simd/struct.lanecount "struct std::simd::LaneCount")<LANES>: [SupportedLaneCount](../simd/trait.supportedlanecount "trait std::simd::SupportedLaneCount"),
rust Trait std::fmt::Binary Trait std::fmt::Binary
======================
```
pub trait Binary {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>;
}
```
`b` formatting.
The `Binary` trait should format its output as a number in binary.
For primitive signed integers ([`i8`](../primitive.i8 "i8") to [`i128`](../primitive.i128 "i128"), and [`isize`](../primitive.isize "isize")), negative values are formatted as the two’s complement representation.
The alternate flag, `#`, adds a `0b` in front of the output.
For more information on formatters, see [the module-level documentation](index).
Examples
--------
Basic usage with [`i32`](../primitive.i32 "i32"):
```
let x = 42; // 42 is '101010' in binary
assert_eq!(format!("{x:b}"), "101010");
assert_eq!(format!("{x:#b}"), "0b101010");
assert_eq!(format!("{:b}", -16), "11111111111111111111111111110000");
```
Implementing `Binary` on a type:
```
use std::fmt;
struct Length(i32);
impl fmt::Binary for Length {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let val = self.0;
fmt::Binary::fmt(&val, f) // delegate to i32's implementation
}
}
let l = Length(107);
assert_eq!(format!("l as binary is: {l:b}"), "l as binary is: 1101011");
assert_eq!(
format!("l as binary is: {l:#032b}"),
"l as binary is: 0b000000000000000000000001101011"
);
```
Required Methods
----------------
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#889)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter.
Implementors
------------
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#175)### impl Binary for i8
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#176)### impl Binary for i16
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#177)### impl Binary for i32
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#178)### impl Binary for i64
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#179)### impl Binary for i128
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#174)### impl Binary for isize
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#175)### impl Binary for u8
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#176)### impl Binary for u16
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#177)### impl Binary for u32
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#178)### impl Binary for u64
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#179)### impl Binary for u128
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#174)### impl Binary for usize
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.34.0 · ### impl Binary for NonZeroI8
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.34.0 · ### impl Binary for NonZeroI16
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.34.0 · ### impl Binary for NonZeroI32
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.34.0 · ### impl Binary for NonZeroI64
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.34.0 · ### impl Binary for NonZeroI128
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.34.0 · ### impl Binary for NonZeroIsize
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.28.0 · ### impl Binary for NonZeroU8
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.28.0 · ### impl Binary for NonZeroU16
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.28.0 · ### impl Binary for NonZeroU32
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.28.0 · ### impl Binary for NonZeroU64
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.28.0 · ### impl Binary for NonZeroU128
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.28.0 · ### impl Binary for NonZeroUsize
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#2376)### impl<T> Binary for &Twhere T: [Binary](trait.binary "trait std::fmt::Binary") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#2376)### impl<T> Binary for &mut Twhere T: [Binary](trait.binary "trait std::fmt::Binary") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/num/saturating.rs.html#55)### impl<T> Binary for Saturating<T>where T: [Binary](trait.binary "trait std::fmt::Binary"),
[source](https://doc.rust-lang.org/src/core/num/wrapping.rs.html#59)1.11.0 · ### impl<T> Binary for Wrapping<T>where T: [Binary](trait.binary "trait std::fmt::Binary"),
[source](https://doc.rust-lang.org/src/core/up/up/portable-simd/crates/core_simd/src/fmt.rs.html#31-39)### impl<T, const LANES: usize> Binary for Simd<T, LANES>where T: [SimdElement](../simd/trait.simdelement "trait std::simd::SimdElement") + [Binary](trait.binary "trait std::fmt::Binary"), [LaneCount](../simd/struct.lanecount "struct std::simd::LaneCount")<LANES>: [SupportedLaneCount](../simd/trait.supportedlanecount "trait std::simd::SupportedLaneCount"),
| programming_docs |
rust Function std::fmt::format Function std::fmt::format
=========================
```
pub fn format(args: Arguments<'_>) -> String
```
The `format` function takes an [`Arguments`](struct.arguments "Arguments") struct and returns the resulting formatted string.
The [`Arguments`](struct.arguments "Arguments") instance can be created with the [`format_args!`](../macro.format_args) macro.
Examples
--------
Basic usage:
```
use std::fmt;
let s = fmt::format(format_args!("Hello, {}!", "world"));
assert_eq!(s, "Hello, world!");
```
Please note that using [`format!`](../macro.format) might be preferable. Example:
```
let s = format!("Hello, {}!", "world");
assert_eq!(s, "Hello, world!");
```
rust Trait std::fmt::Debug Trait std::fmt::Debug
=====================
```
pub trait Debug {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>;
}
```
`?` formatting.
`Debug` should format the output in a programmer-facing, debugging context.
Generally speaking, you should just `derive` a `Debug` implementation.
When used with the alternate format specifier `#?`, the output is pretty-printed.
For more information on formatters, see [the module-level documentation](index).
This trait can be used with `#[derive]` if all fields implement `Debug`. When `derive`d for structs, it will use the name of the `struct`, then `{`, then a comma-separated list of each field’s name and `Debug` value, then `}`. For `enum`s, it will use the name of the variant and, if applicable, `(`, then the `Debug` values of the fields, then `)`.
Stability
---------
Derived `Debug` formats are not stable, and so may change with future Rust versions. Additionally, `Debug` implementations of types provided by the standard library (`libstd`, `libcore`, `liballoc`, etc.) are not stable, and may also change with future Rust versions.
Examples
--------
Deriving an implementation:
```
#[derive(Debug)]
struct Point {
x: i32,
y: i32,
}
let origin = Point { x: 0, y: 0 };
assert_eq!(format!("The origin is: {origin:?}"), "The origin is: Point { x: 0, y: 0 }");
```
Manually implementing:
```
use std::fmt;
struct Point {
x: i32,
y: i32,
}
impl fmt::Debug for Point {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("Point")
.field("x", &self.x)
.field("y", &self.y)
.finish()
}
}
let origin = Point { x: 0, y: 0 };
assert_eq!(format!("The origin is: {origin:?}"), "The origin is: Point { x: 0, y: 0 }");
```
There are a number of helper methods on the [`Formatter`](struct.formatter "Formatter") struct to help you with manual implementations, such as [`debug_struct`](struct.formatter#method.debug_struct).
Types that do not wish to use the standard suite of debug representations provided by the `Formatter` trait (`debug_struct`, `debug_tuple`, `debug_list`, `debug_set`, `debug_map`) can do something totally custom by manually writing an arbitrary representation to the `Formatter`.
```
impl fmt::Debug for Point {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "Point [{} {}]", self.x, self.y)
}
}
```
`Debug` implementations using either `derive` or the debug builder API on [`Formatter`](struct.formatter "Formatter") support pretty-printing using the alternate flag: `{:#?}`.
Pretty-printing with `#?`:
```
#[derive(Debug)]
struct Point {
x: i32,
y: i32,
}
let origin = Point { x: 0, y: 0 };
assert_eq!(format!("The origin is: {origin:#?}"),
"The origin is: Point {
x: 0,
y: 0,
}");
```
Required Methods
----------------
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#693)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter.
##### Examples
```
use std::fmt;
struct Position {
longitude: f32,
latitude: f32,
}
impl fmt::Debug for Position {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_tuple("")
.field(&self.longitude)
.field(&self.latitude)
.finish()
}
}
let position = Position { longitude: 1.987, latitude: 2.983 };
assert_eq!(format!("{position:?}"), "(1.987, 2.983)");
assert_eq!(format!("{position:#?}"), "(
1.987,
2.983,
)");
```
Implementors
------------
[source](https://doc.rust-lang.org/src/std/backtrace.rs.html#117)1.65.0 · ### impl Debug for BacktraceStatus
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#342)### impl Debug for std::cmp::Ordering
[source](https://doc.rust-lang.org/src/alloc/collections/mod.rs.html#80)### impl Debug for TryReserveErrorKind
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#708)1.34.0 · ### impl Debug for Infallible
[source](https://doc.rust-lang.org/src/std/env.rs.html#280)### impl Debug for VarError
[source](https://doc.rust-lang.org/src/core/ffi/mod.rs.html#221)1.16.0 · ### impl Debug for c\_void
[source](https://doc.rust-lang.org/src/std/io/error.rs.html#166)### impl Debug for ErrorKind
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1881)### impl Debug for SeekFrom
[source](https://doc.rust-lang.org/src/std/net/ip_addr.rs.html#940-944)1.7.0 · ### impl Debug for IpAddr
[source](https://doc.rust-lang.org/src/std/net/ip_addr.rs.html#200)### impl Debug for Ipv6MulticastScope
[source](https://doc.rust-lang.org/src/std/net/mod.rs.html#49)### impl Debug for Shutdown
[source](https://doc.rust-lang.org/src/std/net/socket_addr.rs.html#612-616)### impl Debug for std::net::SocketAddr
[source](https://doc.rust-lang.org/src/core/num/mod.rs.html#954)### impl Debug for FpCategory
[source](https://doc.rust-lang.org/src/core/num/error.rs.html#87)1.55.0 · ### impl Debug for IntErrorKind
[source](https://doc.rust-lang.org/src/std/os/unix/net/ancillary.rs.html#346)### impl Debug for AncillaryError
Available on **(Android or Linux) and Unix** only.[source](https://doc.rust-lang.org/src/std/panic.rs.html#208)### impl Debug for BacktraceStyle
[source](https://doc.rust-lang.org/src/core/up/up/portable-simd/crates/core_simd/src/swizzle.rs.html#76)### impl Debug for Which
[source](https://doc.rust-lang.org/src/core/str/pattern.rs.html#167)### impl Debug for SearchStep
[source](https://doc.rust-lang.org/src/core/sync/atomic.rs.html#212)### impl Debug for std::sync::atomic::Ordering
[source](https://doc.rust-lang.org/src/std/sync/mpsc/mod.rs.html#611)1.12.0 · ### impl Debug for RecvTimeoutError
[source](https://doc.rust-lang.org/src/std/sync/mpsc/mod.rs.html#592)### impl Debug for TryRecvError
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#25)1.28.0 · ### impl Debug for Alignment
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#2393)### impl Debug for bool
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#2440)### impl Debug for char
[source](https://doc.rust-lang.org/src/core/fmt/float.rs.html#225)### impl Debug for f32
[source](https://doc.rust-lang.org/src/core/fmt/float.rs.html#226)### impl Debug for f64
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#197-200)### impl Debug for i8
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#197-200)### impl Debug for i16
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#197-200)### impl Debug for i32
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#197-200)### impl Debug for i64
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#197-200)### impl Debug for i128
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#197-200)### impl Debug for isize
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#2379)### impl Debug for !
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#2408)### impl Debug for str
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#197-200)### impl Debug for u8
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#197-200)### impl Debug for u16
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#197-200)### impl Debug for u32
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#197-200)### impl Debug for u64
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#197-200)### impl Debug for u128
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#2597)### impl Debug for ()
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#197-200)### impl Debug for usize
[source](https://doc.rust-lang.org/src/core/up/up/stdarch/crates/core_arch/src/x86/cpuid.rs.html#11)1.27.0 · ### impl Debug for CpuidResult
[source](https://doc.rust-lang.org/src/core/up/up/stdarch/crates/core_arch/src/x86/mod.rs.html#8-330)1.27.0 · ### impl Debug for \_\_m128
[source](https://doc.rust-lang.org/src/core/up/up/stdarch/crates/core_arch/src/x86/mod.rs.html#8-330)### impl Debug for \_\_m128bh
[source](https://doc.rust-lang.org/src/core/up/up/stdarch/crates/core_arch/src/x86/mod.rs.html#8-330)1.27.0 · ### impl Debug for \_\_m128d
[source](https://doc.rust-lang.org/src/core/up/up/stdarch/crates/core_arch/src/x86/mod.rs.html#8-330)1.27.0 · ### impl Debug for \_\_m128i
[source](https://doc.rust-lang.org/src/core/up/up/stdarch/crates/core_arch/src/x86/mod.rs.html#8-330)1.27.0 · ### impl Debug for \_\_m256
[source](https://doc.rust-lang.org/src/core/up/up/stdarch/crates/core_arch/src/x86/mod.rs.html#8-330)### impl Debug for \_\_m256bh
[source](https://doc.rust-lang.org/src/core/up/up/stdarch/crates/core_arch/src/x86/mod.rs.html#8-330)1.27.0 · ### impl Debug for \_\_m256d
[source](https://doc.rust-lang.org/src/core/up/up/stdarch/crates/core_arch/src/x86/mod.rs.html#8-330)1.27.0 · ### impl Debug for \_\_m256i
[source](https://doc.rust-lang.org/src/core/up/up/stdarch/crates/core_arch/src/x86/mod.rs.html#8-330)### impl Debug for \_\_m512
[source](https://doc.rust-lang.org/src/core/up/up/stdarch/crates/core_arch/src/x86/mod.rs.html#8-330)### impl Debug for \_\_m512bh
[source](https://doc.rust-lang.org/src/core/up/up/stdarch/crates/core_arch/src/x86/mod.rs.html#8-330)### impl Debug for \_\_m512d
[source](https://doc.rust-lang.org/src/core/up/up/stdarch/crates/core_arch/src/x86/mod.rs.html#8-330)### impl Debug for \_\_m512i
[source](https://doc.rust-lang.org/src/core/ffi/c_str.rs.html#149)### impl Debug for FromBytesUntilNulError
[source](https://doc.rust-lang.org/src/core/alloc/mod.rs.html#34)### impl Debug for AllocError
[source](https://doc.rust-lang.org/src/alloc/alloc.rs.html#53)### impl Debug for Global
[source](https://doc.rust-lang.org/src/core/alloc/layout.rs.html#37)1.28.0 · ### impl Debug for Layout
[source](https://doc.rust-lang.org/src/core/alloc/layout.rs.html#463)1.50.0 · ### impl Debug for LayoutError
[source](https://doc.rust-lang.org/src/std/alloc.rs.html#130)1.28.0 · ### impl Debug for System
[source](https://doc.rust-lang.org/src/core/any.rs.html#665)### impl Debug for TypeId
[source](https://doc.rust-lang.org/src/core/array/mod.rs.html#113)1.34.0 · ### impl Debug for TryFromSliceError
[source](https://doc.rust-lang.org/src/core/ascii.rs.html#147)1.16.0 · ### impl Debug for std::ascii::EscapeDefault
[source](https://doc.rust-lang.org/src/std/backtrace.rs.html#177-201)1.65.0 · ### impl Debug for Backtrace
[source](https://doc.rust-lang.org/src/std/backtrace.rs.html#204-210)### impl Debug for BacktraceFrame
[source](https://doc.rust-lang.org/src/core/cell.rs.html#638)1.13.0 · ### impl Debug for BorrowError
[source](https://doc.rust-lang.org/src/core/cell.rs.html#665)1.13.0 · ### impl Debug for BorrowMutError
[source](https://doc.rust-lang.org/src/core/char/convert.rs.html#235)1.34.0 · ### impl Debug for CharTryFromError
[source](https://doc.rust-lang.org/src/core/char/decode.rs.html#29)1.9.0 · ### impl Debug for DecodeUtf16Error
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#378)1.20.0 · ### impl Debug for std::char::EscapeDebug
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#269)### impl Debug for std::char::EscapeDefault
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#148)### impl Debug for std::char::EscapeUnicode
[source](https://doc.rust-lang.org/src/core/char/convert.rs.html#149)1.20.0 · ### impl Debug for ParseCharError
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#412)### impl Debug for ToLowercase
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#446)### impl Debug for ToUppercase
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#580)1.59.0 · ### impl Debug for TryFromCharError
[source](https://doc.rust-lang.org/src/std/collections/hash/map.rs.html#3153)1.13.0 · ### impl Debug for DefaultHasher
[source](https://doc.rust-lang.org/src/std/collections/hash/map.rs.html#3214-3218)1.16.0 · ### impl Debug for RandomState
[source](https://doc.rust-lang.org/src/alloc/collections/mod.rs.html#59)1.57.0 · ### impl Debug for TryReserveError
[source](https://doc.rust-lang.org/src/std/env.rs.html#830-834)1.16.0 · ### impl Debug for Args
[source](https://doc.rust-lang.org/src/std/env.rs.html#871-875)1.16.0 · ### impl Debug for ArgsOs
[source](https://doc.rust-lang.org/src/std/env.rs.html#461)### impl Debug for JoinPathsError
[source](https://doc.rust-lang.org/src/std/env.rs.html#451-455)1.16.0 · ### impl Debug for SplitPaths<'\_>
[source](https://doc.rust-lang.org/src/std/env.rs.html#179-183)1.16.0 · ### impl Debug for Vars
[source](https://doc.rust-lang.org/src/std/env.rs.html#197-201)1.16.0 · ### impl Debug for VarsOs
[source](https://doc.rust-lang.org/src/core/ffi/c_str.rs.html#161)1.3.0 · ### impl Debug for CStr
[source](https://doc.rust-lang.org/src/alloc/ffi/c_str.rs.html#719)### impl Debug for CString
[source](https://doc.rust-lang.org/src/core/ffi/c_str.rs.html#110)1.64.0 · ### impl Debug for FromBytesWithNulError
[source](https://doc.rust-lang.org/src/alloc/ffi/c_str.rs.html#159)1.64.0 · ### impl Debug for FromVecWithNulError
[source](https://doc.rust-lang.org/src/alloc/ffi/c_str.rs.html#225)1.64.0 · ### impl Debug for IntoStringError
[source](https://doc.rust-lang.org/src/alloc/ffi/c_str.rs.html#134)1.64.0 · ### impl Debug for NulError
[source](https://doc.rust-lang.org/src/std/ffi/os_str.rs.html#1252-1256)### impl Debug for OsStr
[source](https://doc.rust-lang.org/src/std/ffi/os_str.rs.html#550-554)### impl Debug for OsString
[source](https://doc.rust-lang.org/src/std/fs.rs.html#216)1.6.0 · ### impl Debug for DirBuilder
[source](https://doc.rust-lang.org/src/std/fs.rs.html#1680-1684)1.13.0 · ### impl Debug for DirEntry
[source](https://doc.rust-lang.org/src/std/fs.rs.html#710-714)### impl Debug for File
[source](https://doc.rust-lang.org/src/std/fs.rs.html#188)### impl Debug for FileTimes
[source](https://doc.rust-lang.org/src/std/fs.rs.html#207)1.1.0 · ### impl Debug for FileType
[source](https://doc.rust-lang.org/src/std/fs.rs.html#1315-1327)1.16.0 · ### impl Debug for Metadata
[source](https://doc.rust-lang.org/src/std/fs.rs.html#183)### impl Debug for OpenOptions
[source](https://doc.rust-lang.org/src/std/fs.rs.html#200)### impl Debug for Permissions
[source](https://doc.rust-lang.org/src/std/fs.rs.html#127)### impl Debug for ReadDir
[source](https://doc.rust-lang.org/src/core/hash/sip.rs.html#48)### impl Debug for SipHasher
[source](https://doc.rust-lang.org/src/std/io/readbuf.rs.html#41-49)### impl Debug for BorrowedBuf<'\_>
[source](https://doc.rust-lang.org/src/std/io/util.rs.html#80-84)1.16.0 · ### impl Debug for std::io::Empty
[source](https://doc.rust-lang.org/src/std/io/error.rs.html#73-77)### impl Debug for std::io::Error
[source](https://doc.rust-lang.org/src/std/io/util.rs.html#177-181)1.16.0 · ### impl Debug for std::io::Repeat
[source](https://doc.rust-lang.org/src/std/io/util.rs.html#264-268)1.16.0 · ### impl Debug for Sink
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#880-884)1.16.0 · ### impl Debug for Stderr
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#962-966)1.16.0 · ### impl Debug for StderrLock<'\_>
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#410-414)1.16.0 · ### impl Debug for Stdin
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#495-499)1.16.0 · ### impl Debug for StdinLock<'\_>
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#661-665)1.16.0 · ### impl Debug for Stdout
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#743-747)1.16.0 · ### impl Debug for StdoutLock<'\_>
[source](https://doc.rust-lang.org/src/std/io/buffered/bufwriter.rs.html#505-511)1.56.0 · ### impl Debug for WriterPanicked
[source](https://doc.rust-lang.org/src/core/marker.rs.html#776)1.33.0 · ### impl Debug for PhantomPinned
[source](https://doc.rust-lang.org/src/core/mem/transmutability.rs.html#21)### impl Debug for Assume
[source](https://doc.rust-lang.org/src/std/net/parser.rs.html#476)### impl Debug for AddrParseError
[source](https://doc.rust-lang.org/src/std/net/tcp.rs.html#107)### impl Debug for IntoIncoming
[source](https://doc.rust-lang.org/src/std/net/ip_addr.rs.html#1012-1016)### impl Debug for Ipv4Addr
[source](https://doc.rust-lang.org/src/std/net/ip_addr.rs.html#1859-1863)### impl Debug for Ipv6Addr
[source](https://doc.rust-lang.org/src/std/net/socket_addr.rs.html#638-642)### impl Debug for SocketAddrV4
[source](https://doc.rust-lang.org/src/std/net/socket_addr.rs.html#672-676)### impl Debug for SocketAddrV6
[source](https://doc.rust-lang.org/src/std/net/tcp.rs.html#1046-1050)### impl Debug for TcpListener
[source](https://doc.rust-lang.org/src/std/net/tcp.rs.html#704-708)### impl Debug for TcpStream
[source](https://doc.rust-lang.org/src/std/net/udp.rs.html#809-813)### impl Debug for UdpSocket
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.34.0 · ### impl Debug for NonZeroI8
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.34.0 · ### impl Debug for NonZeroI16
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.34.0 · ### impl Debug for NonZeroI32
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.34.0 · ### impl Debug for NonZeroI64
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.34.0 · ### impl Debug for NonZeroI128
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.34.0 · ### impl Debug for NonZeroIsize
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.28.0 · ### impl Debug for NonZeroU8
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.28.0 · ### impl Debug for NonZeroU16
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.28.0 · ### impl Debug for NonZeroU32
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.28.0 · ### impl Debug for NonZeroU64
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.28.0 · ### impl Debug for NonZeroU128
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.28.0 · ### impl Debug for NonZeroUsize
[source](https://doc.rust-lang.org/src/core/num/dec2flt/mod.rs.html#173)### impl Debug for ParseFloatError
[source](https://doc.rust-lang.org/src/core/num/error.rs.html#69)### impl Debug for ParseIntError
[source](https://doc.rust-lang.org/src/core/num/error.rs.html#10)1.34.0 · ### impl Debug for TryFromIntError
[source](https://doc.rust-lang.org/src/core/ops/range.rs.html#46)### impl Debug for RangeFull
[source](https://doc.rust-lang.org/src/std/os/linux/process.rs.html#49)### impl Debug for PidFd
Available on **Linux** only.[source](https://doc.rust-lang.org/src/std/os/fd/owned.rs.html#182-186)1.63.0 · ### impl Debug for BorrowedFd<'\_>
[source](https://doc.rust-lang.org/src/std/os/fd/owned.rs.html#189-193)1.63.0 · ### impl Debug for OwnedFd
[source](https://doc.rust-lang.org/src/std/os/unix/net/addr.rs.html#330-338)1.10.0 · ### impl Debug for std::os::unix::net::SocketAddr
Available on **Unix** only.[source](https://doc.rust-lang.org/src/std/os/unix/net/datagram.rs.html#56-68)1.10.0 · ### impl Debug for UnixDatagram
Available on **Unix** only.[source](https://doc.rust-lang.org/src/std/os/unix/net/listener.rs.html#44-53)1.10.0 · ### impl Debug for UnixListener
Available on **Unix** only.[source](https://doc.rust-lang.org/src/std/os/unix/net/stream.rs.html#61-73)1.10.0 · ### impl Debug for UnixStream
Available on **Unix** only.[source](https://doc.rust-lang.org/src/std/os/unix/ucred.rs.html#13)### impl Debug for UCred
Available on **Unix** only.[source](https://doc.rust-lang.org/src/std/os/windows/io/handle.rs.html#374-378)1.63.0 · ### impl Debug for BorrowedHandle<'\_>
Available on **Windows** only.[source](https://doc.rust-lang.org/src/std/os/windows/io/socket.rs.html#212-216)1.63.0 · ### impl Debug for BorrowedSocket<'\_>
Available on **Windows** only.[source](https://doc.rust-lang.org/src/std/os/windows/io/handle.rs.html#112)1.63.0 · ### impl Debug for HandleOrInvalid
Available on **Windows** only.[source](https://doc.rust-lang.org/src/std/os/windows/io/handle.rs.html#93)1.63.0 · ### impl Debug for HandleOrNull
Available on **Windows** only.[source](https://doc.rust-lang.org/src/std/os/windows/io/handle.rs.html#270)1.63.0 · ### impl Debug for InvalidHandleError
Available on **Windows** only.[source](https://doc.rust-lang.org/src/std/os/windows/io/handle.rs.html#252)1.63.0 · ### impl Debug for NullHandleError
Available on **Windows** only.[source](https://doc.rust-lang.org/src/std/os/windows/io/handle.rs.html#381-385)1.63.0 · ### impl Debug for OwnedHandle
Available on **Windows** only.[source](https://doc.rust-lang.org/src/std/os/windows/io/socket.rs.html#219-223)1.63.0 · ### impl Debug for OwnedSocket
Available on **Windows** only.[source](https://doc.rust-lang.org/src/std/path.rs.html#633-645)1.13.0 · ### impl Debug for Components<'\_>
[source](https://doc.rust-lang.org/src/std/path.rs.html#2909-2913)### impl Debug for Display<'\_>
[source](https://doc.rust-lang.org/src/std/path.rs.html#814-826)1.13.0 · ### impl Debug for std::path::Iter<'\_>
[source](https://doc.rust-lang.org/src/std/path.rs.html#2877-2881)### impl Debug for Path
[source](https://doc.rust-lang.org/src/std/path.rs.html#1712-1716)### impl Debug for PathBuf
[source](https://doc.rust-lang.org/src/std/path.rs.html#1937)1.7.0 · ### impl Debug for StripPrefixError
[source](https://doc.rust-lang.org/src/std/process.rs.html#237-245)1.16.0 · ### impl Debug for Child
[source](https://doc.rust-lang.org/src/std/process.rs.html#447-451)1.16.0 · ### impl Debug for ChildStderr
[source](https://doc.rust-lang.org/src/std/process.rs.html#325-329)1.16.0 · ### impl Debug for ChildStdin
[source](https://doc.rust-lang.org/src/std/process.rs.html#386-390)1.16.0 · ### impl Debug for ChildStdout
[source](https://doc.rust-lang.org/src/std/process.rs.html#1035-1042)### impl Debug for Command
[source](https://doc.rust-lang.org/src/std/process.rs.html#1723)1.61.0 · ### impl Debug for ExitCode
[source](https://doc.rust-lang.org/src/std/process.rs.html#1452)### impl Debug for ExitStatus
[source](https://doc.rust-lang.org/src/std/process.rs.html#1585)### impl Debug for ExitStatusError
[source](https://doc.rust-lang.org/src/std/process.rs.html#1113-1133)1.7.0 · ### impl Debug for Output
[source](https://doc.rust-lang.org/src/std/process.rs.html#1301-1305)1.16.0 · ### impl Debug for Stdio
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#69)1.38.0 · ### impl Debug for Chars<'\_>
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#1395)1.17.0 · ### impl Debug for EncodeUtf16<'\_>
[source](https://doc.rust-lang.org/src/core/str/error.rs.html#139)### impl Debug for ParseBoolError
[source](https://doc.rust-lang.org/src/core/str/lossy.rs.html#266)### impl Debug for Utf8Chunks<'\_>
[source](https://doc.rust-lang.org/src/core/str/error.rs.html#46)### impl Debug for Utf8Error
[source](https://doc.rust-lang.org/src/alloc/string.rs.html#2869)1.17.0 · ### impl Debug for std::string::Drain<'\_>
[source](https://doc.rust-lang.org/src/alloc/string.rs.html#407)### impl Debug for FromUtf8Error
[source](https://doc.rust-lang.org/src/alloc/string.rs.html#430)### impl Debug for FromUtf16Error
[source](https://doc.rust-lang.org/src/alloc/string.rs.html#2254)### impl Debug for String
[source](https://doc.rust-lang.org/src/core/sync/atomic.rs.html#3398)1.3.0 · ### impl Debug for AtomicBool
[source](https://doc.rust-lang.org/src/core/sync/atomic.rs.html#2675-2693)1.34.0 · ### impl Debug for AtomicI8
[source](https://doc.rust-lang.org/src/core/sync/atomic.rs.html#2715-2733)1.34.0 · ### impl Debug for AtomicI16
[source](https://doc.rust-lang.org/src/core/sync/atomic.rs.html#2755-2773)1.34.0 · ### impl Debug for AtomicI32
[source](https://doc.rust-lang.org/src/core/sync/atomic.rs.html#2795-2813)1.34.0 · ### impl Debug for AtomicI64
[source](https://doc.rust-lang.org/src/core/sync/atomic.rs.html#2922-2926)1.3.0 · ### impl Debug for AtomicIsize
[source](https://doc.rust-lang.org/src/core/sync/atomic.rs.html#2695-2713)1.34.0 · ### impl Debug for AtomicU8
[source](https://doc.rust-lang.org/src/core/sync/atomic.rs.html#2735-2753)1.34.0 · ### impl Debug for AtomicU16
[source](https://doc.rust-lang.org/src/core/sync/atomic.rs.html#2775-2793)1.34.0 · ### impl Debug for AtomicU32
[source](https://doc.rust-lang.org/src/core/sync/atomic.rs.html#2815-2833)1.34.0 · ### impl Debug for AtomicU64
[source](https://doc.rust-lang.org/src/core/sync/atomic.rs.html#2922-2926)1.3.0 · ### impl Debug for AtomicUsize
[source](https://doc.rust-lang.org/src/std/sync/mpsc/mod.rs.html#583)### impl Debug for RecvError
[source](https://doc.rust-lang.org/src/std/sync/barrier.rs.html#61-65)1.16.0 · ### impl Debug for Barrier
[source](https://doc.rust-lang.org/src/std/sync/barrier.rs.html#147-151)1.16.0 · ### impl Debug for BarrierWaitResult
[source](https://doc.rust-lang.org/src/std/sync/condvar.rs.html#552-556)1.16.0 · ### impl Debug for Condvar
[source](https://doc.rust-lang.org/src/std/sync/once.rs.html#498-502)1.16.0 · ### impl Debug for std::sync::Once
[source](https://doc.rust-lang.org/src/std/sync/once.rs.html#139)1.51.0 · ### impl Debug for OnceState
[source](https://doc.rust-lang.org/src/std/sync/condvar.rs.html#15)1.5.0 · ### impl Debug for WaitTimeoutResult
[source](https://doc.rust-lang.org/src/core/task/wake.rs.html#205)1.36.0 · ### impl Debug for Context<'\_>
[source](https://doc.rust-lang.org/src/core/task/wake.rs.html#13)1.36.0 · ### impl Debug for RawWaker
[source](https://doc.rust-lang.org/src/core/task/wake.rs.html#81)1.36.0 · ### impl Debug for RawWakerVTable
[source](https://doc.rust-lang.org/src/core/task/wake.rs.html#352)1.36.0 · ### impl Debug for Waker
[source](https://doc.rust-lang.org/src/std/thread/local.rs.html#376-380)1.26.0 · ### impl Debug for AccessError
[source](https://doc.rust-lang.org/src/std/thread/mod.rs.html#274)### impl Debug for Builder
[source](https://doc.rust-lang.org/src/std/thread/scoped.rs.html#328-336)1.63.0 · ### impl Debug for Scope<'\_, '\_>
[source](https://doc.rust-lang.org/src/std/thread/mod.rs.html#1272-1279)### impl Debug for Thread
[source](https://doc.rust-lang.org/src/std/thread/mod.rs.html#1039)1.19.0 · ### impl Debug for ThreadId
[source](https://doc.rust-lang.org/src/core/time.rs.html#1023)1.27.0 · ### impl Debug for Duration
[source](https://doc.rust-lang.org/src/core/time.rs.html#1210)### impl Debug for FromFloatSecsError
[source](https://doc.rust-lang.org/src/std/time.rs.html#455-459)1.8.0 · ### impl Debug for Instant
[source](https://doc.rust-lang.org/src/std/time.rs.html#612-616)1.8.0 · ### impl Debug for SystemTime
[source](https://doc.rust-lang.org/src/std/time.rs.html#259)1.8.0 · ### impl Debug for SystemTimeError
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#526)### impl Debug for Arguments<'\_>
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#98)### impl Debug for std::fmt::Error
[source](https://doc.rust-lang.org/src/core/any.rs.html#211)### impl Debug for dyn Any + 'static
[source](https://doc.rust-lang.org/src/core/any.rs.html#221)### impl Debug for dyn Any + Send + 'static
[source](https://doc.rust-lang.org/src/core/any.rs.html#228)1.28.0 · ### impl Debug for dyn Any + Send + Sync + 'static
[source](https://doc.rust-lang.org/src/std/path.rs.html#505)### impl<'a> Debug for Component<'a>
[source](https://doc.rust-lang.org/src/std/path.rs.html#141)### impl<'a> Debug for Prefix<'a>
[source](https://doc.rust-lang.org/src/core/error.rs.html#419)### impl<'a> Debug for Source<'a>
[source](https://doc.rust-lang.org/src/core/any.rs.html#1164)### impl<'a> Debug for Demand<'a>
[source](https://doc.rust-lang.org/src/std/io/readbuf.rs.html#153)### impl<'a> Debug for BorrowedCursor<'a>
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1214-1218)1.36.0 · ### impl<'a> Debug for IoSlice<'a>
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1071-1075)1.36.0 · ### impl<'a> Debug for IoSliceMut<'a>
[source](https://doc.rust-lang.org/src/std/net/tcp.rs.html#96)### impl<'a> Debug for std::net::Incoming<'a>
[source](https://doc.rust-lang.org/src/std/os/unix/net/listener.rs.html#373)1.10.0 · ### impl<'a> Debug for std::os::unix::net::Incoming<'a>
Available on **Unix** only.[source](https://doc.rust-lang.org/src/std/os/unix/net/ancillary.rs.html#484)### impl<'a> Debug for SocketAncillary<'a>
Available on **(Android or Linux) and Unix** only.[source](https://doc.rust-lang.org/src/core/panic/location.rs.html#31)1.10.0 · ### impl<'a> Debug for Location<'a>
[source](https://doc.rust-lang.org/src/core/panic/panic_info.rs.html#29)1.10.0 · ### impl<'a> Debug for PanicInfo<'a>
[source](https://doc.rust-lang.org/src/std/path.rs.html#1086)1.28.0 · ### impl<'a> Debug for Ancestors<'a>
[source](https://doc.rust-lang.org/src/std/path.rs.html#422)### impl<'a> Debug for PrefixComponent<'a>
[source](https://doc.rust-lang.org/src/std/process.rs.html#1062)1.57.0 · ### impl<'a> Debug for CommandArgs<'a>
[source](https://doc.rust-lang.org/src/std/sys_common/process.rs.html#95)1.57.0 · ### impl<'a> Debug for CommandEnvs<'a>
[source](https://doc.rust-lang.org/src/core/slice/ascii.rs.html#226)1.60.0 · ### impl<'a> Debug for EscapeAscii<'a>
[source](https://doc.rust-lang.org/src/core/str/pattern.rs.html#351)### impl<'a> Debug for CharSearcher<'a>
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#228)### impl<'a> Debug for std::str::Bytes<'a>
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#125)### impl<'a> Debug for CharIndices<'a>
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#1438)1.34.0 · ### impl<'a> Debug for std::str::EscapeDebug<'a>
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#1448)1.34.0 · ### impl<'a> Debug for std::str::EscapeDefault<'a>
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#1455)1.34.0 · ### impl<'a> Debug for std::str::EscapeUnicode<'a>
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#1093)### impl<'a> Debug for std::str::Lines<'a>
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#1133)### impl<'a> Debug for LinesAny<'a>
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#1187)1.34.0 · ### impl<'a> Debug for SplitAsciiWhitespace<'a>
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#1174)1.1.0 · ### impl<'a> Debug for SplitWhitespace<'a>
[source](https://doc.rust-lang.org/src/core/str/lossy.rs.html#34)### impl<'a> Debug for Utf8Chunk<'a>
[source](https://doc.rust-lang.org/src/core/str/pattern.rs.html#835)### impl<'a, 'b> Debug for CharSliceSearcher<'a, 'b>
[source](https://doc.rust-lang.org/src/core/str/pattern.rs.html#983)### impl<'a, 'b> Debug for StrSearcher<'a, 'b>
[source](https://doc.rust-lang.org/src/core/str/pattern.rs.html#783)### impl<'a, 'b, const N: usize> Debug for CharArrayRefSearcher<'a, 'b, N>
[source](https://doc.rust-lang.org/src/core/ffi/mod.rs.html#343)### impl<'a, 'f> Debug for VaList<'a, 'f>where 'f: 'a,
[source](https://doc.rust-lang.org/src/core/option.rs.html#2082)### impl<'a, A> Debug for std::option::Iter<'a, A>where A: 'a + [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/option.rs.html#2132)### impl<'a, A> Debug for std::option::IterMut<'a, A>where A: 'a + [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/by_ref_sized.rs.html#8)### impl<'a, I> Debug for ByRefSized<'a, I>where I: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/alloc/vec/splice.rs.html#19)1.21.0 · ### impl<'a, I, A> Debug for Splice<'a, I, A>where I: 'a + [Debug](trait.debug "trait std::fmt::Debug") + [Iterator](../iter/trait.iterator "trait std::iter::Iterator"), A: 'a + [Debug](trait.debug "trait std::fmt::Debug") + [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator"), <I as [Iterator](../iter/trait.iterator "trait std::iter::Iterator")>::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/std/collections/hash/set.rs.html#1607-1614)### impl<'a, K, F> Debug for std::collections::hash\_set::DrainFilter<'a, K, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)K) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/std/collections/hash/map.rs.html#2505-2512)### impl<'a, K, V, F> Debug for std::collections::hash\_map::DrainFilter<'a, K, V, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)K, [&mut](../primitive.reference) V) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#1010-1026)1.5.0 · ### impl<'a, P> Debug for MatchIndices<'a, P>where P: [Pattern](../str/pattern/trait.pattern "trait std::str::pattern::Pattern")<'a>, <P as [Pattern](../str/pattern/trait.pattern "trait std::str::pattern::Pattern")<'a>>::[Searcher](../str/pattern/trait.pattern#associatedtype.Searcher "type std::str::pattern::Pattern::Searcher"): [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#1067-1083)1.2.0 · ### impl<'a, P> Debug for Matches<'a, P>where P: [Pattern](../str/pattern/trait.pattern "trait std::str::pattern::Pattern")<'a>, <P as [Pattern](../str/pattern/trait.pattern "trait std::str::pattern::Pattern")<'a>>::[Searcher](../str/pattern/trait.pattern#associatedtype.Searcher "type std::str::pattern::Pattern::Searcher"): [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#1010-1026)1.5.0 · ### impl<'a, P> Debug for RMatchIndices<'a, P>where P: [Pattern](../str/pattern/trait.pattern "trait std::str::pattern::Pattern")<'a>, <P as [Pattern](../str/pattern/trait.pattern "trait std::str::pattern::Pattern")<'a>>::[Searcher](../str/pattern/trait.pattern#associatedtype.Searcher "type std::str::pattern::Pattern::Searcher"): [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#1067-1083)1.2.0 · ### impl<'a, P> Debug for RMatches<'a, P>where P: [Pattern](../str/pattern/trait.pattern "trait std::str::pattern::Pattern")<'a>, <P as [Pattern](../str/pattern/trait.pattern "trait std::str::pattern::Pattern")<'a>>::[Searcher](../str/pattern/trait.pattern#associatedtype.Searcher "type std::str::pattern::Pattern::Searcher"): [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#730-746)### impl<'a, P> Debug for std::str::RSplit<'a, P>where P: [Pattern](../str/pattern/trait.pattern "trait std::str::pattern::Pattern")<'a>, <P as [Pattern](../str/pattern/trait.pattern "trait std::str::pattern::Pattern")<'a>>::[Searcher](../str/pattern/trait.pattern#associatedtype.Searcher "type std::str::pattern::Pattern::Searcher"): [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#913-929)### impl<'a, P> Debug for std::str::RSplitN<'a, P>where P: [Pattern](../str/pattern/trait.pattern "trait std::str::pattern::Pattern")<'a>, <P as [Pattern](../str/pattern/trait.pattern "trait std::str::pattern::Pattern")<'a>>::[Searcher](../str/pattern/trait.pattern#associatedtype.Searcher "type std::str::pattern::Pattern::Searcher"): [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#790-806)### impl<'a, P> Debug for RSplitTerminator<'a, P>where P: [Pattern](../str/pattern/trait.pattern "trait std::str::pattern::Pattern")<'a>, <P as [Pattern](../str/pattern/trait.pattern "trait std::str::pattern::Pattern")<'a>>::[Searcher](../str/pattern/trait.pattern#associatedtype.Searcher "type std::str::pattern::Pattern::Searcher"): [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#730-746)### impl<'a, P> Debug for std::str::Split<'a, P>where P: [Pattern](../str/pattern/trait.pattern "trait std::str::pattern::Pattern")<'a>, <P as [Pattern](../str/pattern/trait.pattern "trait std::str::pattern::Pattern")<'a>>::[Searcher](../str/pattern/trait.pattern#associatedtype.Searcher "type std::str::pattern::Pattern::Searcher"): [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#1333)1.51.0 · ### impl<'a, P> Debug for std::str::SplitInclusive<'a, P>where P: [Pattern](../str/pattern/trait.pattern "trait std::str::pattern::Pattern")<'a>, <P as [Pattern](../str/pattern/trait.pattern "trait std::str::pattern::Pattern")<'a>>::[Searcher](../str/pattern/trait.pattern#associatedtype.Searcher "type std::str::pattern::Pattern::Searcher"): [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#913-929)### impl<'a, P> Debug for std::str::SplitN<'a, P>where P: [Pattern](../str/pattern/trait.pattern "trait std::str::pattern::Pattern")<'a>, <P as [Pattern](../str/pattern/trait.pattern "trait std::str::pattern::Pattern")<'a>>::[Searcher](../str/pattern/trait.pattern#associatedtype.Searcher "type std::str::pattern::Pattern::Searcher"): [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#790-806)### impl<'a, P> Debug for SplitTerminator<'a, P>where P: [Pattern](../str/pattern/trait.pattern "trait std::str::pattern::Pattern")<'a>, <P as [Pattern](../str/pattern/trait.pattern "trait std::str::pattern::Pattern")<'a>>::[Searcher](../str/pattern/trait.pattern#associatedtype.Searcher "type std::str::pattern::Pattern::Searcher"): [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/alloc/collections/binary_heap.rs.html#1478)1.6.0 · ### impl<'a, T> Debug for std::collections::binary\_heap::Drain<'a, T>where T: 'a + [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/alloc/collections/binary_heap.rs.html#1523)### impl<'a, T> Debug for DrainSorted<'a, T>where T: [Debug](trait.debug "trait std::fmt::Debug") + [Ord](../cmp/trait.ord "trait std::cmp::Ord"),
[source](https://doc.rust-lang.org/src/alloc/collections/btree/set.rs.html#172)1.17.0 · ### impl<'a, T> Debug for std::collections::btree\_set::Range<'a, T>where T: 'a + [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/result.rs.html#1886)### impl<'a, T> Debug for std::result::Iter<'a, T>where T: 'a + [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/result.rs.html#1935)### impl<'a, T> Debug for std::result::IterMut<'a, T>where T: 'a + [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1444)### impl<'a, T> Debug for Chunks<'a, T>where T: 'a + [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1816)1.31.0 · ### impl<'a, T> Debug for ChunksExact<'a, T>where T: 'a + [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1975)1.31.0 · ### impl<'a, T> Debug for ChunksExactMut<'a, T>where T: 'a + [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1627)### impl<'a, T> Debug for ChunksMut<'a, T>where T: 'a + [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2508)1.31.0 · ### impl<'a, T> Debug for RChunks<'a, T>where T: 'a + [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2875)1.31.0 · ### impl<'a, T> Debug for RChunksExact<'a, T>where T: 'a + [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#3037)1.31.0 · ### impl<'a, T> Debug for RChunksExactMut<'a, T>where T: 'a + [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2681)1.31.0 · ### impl<'a, T> Debug for RChunksMut<'a, T>where T: 'a + [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1296)### impl<'a, T> Debug for Windows<'a, T>where T: 'a + [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/alloc/vec/drain_filter.rs.html#22)### impl<'a, T, F, A> Debug for std::vec::DrainFilter<'a, T, F, A>where T: [Debug](trait.debug "trait std::fmt::Debug"), F: [Debug](trait.debug "trait std::fmt::Debug") + [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) T) -> [bool](../primitive.bool), A: [Debug](trait.debug "trait std::fmt::Debug") + [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator"),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#3295)### impl<'a, T, P> Debug for GroupBy<'a, T, P>where T: 'a + [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#3384)### impl<'a, T, P> Debug for GroupByMut<'a, T, P>where T: 'a + [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2268)### impl<'a, T, const N: usize> Debug for std::slice::ArrayChunks<'a, T, N>where T: 'a + [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2394)### impl<'a, T, const N: usize> Debug for ArrayChunksMut<'a, T, N>where T: 'a + [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2145)### impl<'a, T, const N: usize> Debug for ArrayWindows<'a, T, N>where T: 'a + [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/std/sync/mpsc/mod.rs.html#383)### impl<'a, T: Debug + 'a> Debug for std::sync::mpsc::Iter<'a, T>
[source](https://doc.rust-lang.org/src/std/sync/mpsc/mod.rs.html#426)1.15.0 · ### impl<'a, T: Debug + 'a> Debug for TryIter<'a, T>
[source](https://doc.rust-lang.org/src/core/str/pattern.rs.html#777)### impl<'a, const N: usize> Debug for CharArraySearcher<'a, N>
[source](https://doc.rust-lang.org/src/core/ffi/mod.rs.html#325)### impl<'f> Debug for VaListImpl<'f>
[source](https://doc.rust-lang.org/src/std/thread/scoped.rs.html#339-343)1.63.0 · ### impl<'scope, T> Debug for ScopedJoinHandle<'scope, T>
[source](https://doc.rust-lang.org/src/core/iter/sources/repeat.rs.html#62)### impl<A> Debug for std::iter::Repeat<A>where A: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/option.rs.html#2172)### impl<A> Debug for std::option::IntoIter<A>where A: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/chain.rs.html#19)### impl<A, B> Debug for std::iter::Chain<A, B>where A: [Debug](trait.debug "trait std::fmt::Debug"), B: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/zip.rs.html#441)### impl<A, B> Debug for Zip<A, B>where A: [Debug](trait.debug "trait std::fmt::Debug"), B: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#385)### impl<B> Debug for Cow<'\_, B>where B: [Debug](trait.debug "trait std::fmt::Debug") + [ToOwned](../borrow/trait.toowned "trait std::borrow::ToOwned") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"), <B as [ToOwned](../borrow/trait.toowned "trait std::borrow::ToOwned")>::[Owned](../borrow/trait.toowned#associatedtype.Owned "type std::borrow::ToOwned::Owned"): [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/ops/control_flow.rs.html#82)1.55.0 · ### impl<B, C> Debug for ControlFlow<B, C>where B: [Debug](trait.debug "trait std::fmt::Debug"), C: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2807)### impl<B: Debug> Debug for std::io::Lines<B>
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2775)### impl<B: Debug> Debug for std::io::Split<B>
[source](https://doc.rust-lang.org/src/core/ptr/metadata.rs.html#225)### impl<Dyn> Debug for DynMetadata<Dyn>where Dyn: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/std/error.rs.html#1569-1576)### impl<E> Debug for Report<E>where [Report](../error/struct.report "struct std::error::Report")<E>: [Display](trait.display "trait std::fmt::Display"),
[source](https://doc.rust-lang.org/src/core/future/poll_fn.rs.html#49)1.64.0 · ### impl<F> Debug for PollFn<F>
[source](https://doc.rust-lang.org/src/core/iter/sources/from_fn.rs.html#74)1.34.0 · ### impl<F> Debug for FromFn<F>
[source](https://doc.rust-lang.org/src/core/iter/sources/once_with.rs.html#69)1.43.0 · ### impl<F> Debug for OnceWith<F>where F: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/iter/sources/repeat_with.rs.html#73)1.28.0 · ### impl<F> Debug for RepeatWith<F>where F: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/str/pattern.rs.html#870)### impl<F> Debug for CharPredicateSearcher<'\_, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([char](../primitive.char)) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#760)1.9.0 · ### impl<H> Debug for BuildHasherDefault<H>
[source](https://doc.rust-lang.org/src/core/async_iter/from_iter.rs.html#13)### impl<I> Debug for FromIter<I>where I: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/char/decode.rs.html#16)1.9.0 · ### impl<I> Debug for DecodeUtf16<I>where I: [Debug](trait.debug "trait std::fmt::Debug") + [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [u16](../primitive.u16)>,
[source](https://doc.rust-lang.org/src/core/iter/adapters/cloned.rs.html#16)1.1.0 · ### impl<I> Debug for Cloned<I>where I: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/copied.rs.html#16)1.36.0 · ### impl<I> Debug for Copied<I>where I: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/cycle.rs.html#10)### impl<I> Debug for Cycle<I>where I: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/enumerate.rs.html#14)### impl<I> Debug for Enumerate<I>where I: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/fuse.rs.html#14)### impl<I> Debug for Fuse<I>where I: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/intersperse.rs.html#8)### impl<I> Debug for Intersperse<I>where I: [Debug](trait.debug "trait std::fmt::Debug") + [Iterator](../iter/trait.iterator "trait std::iter::Iterator"), <I as [Iterator](../iter/trait.iterator "trait std::iter::Iterator")>::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [Clone](../clone/trait.clone "trait std::clone::Clone"), <I as [Iterator](../iter/trait.iterator "trait std::iter::Iterator")>::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/peekable.rs.html#12)### impl<I> Debug for Peekable<I>where I: [Debug](trait.debug "trait std::fmt::Debug") + [Iterator](../iter/trait.iterator "trait std::iter::Iterator"), <I as [Iterator](../iter/trait.iterator "trait std::iter::Iterator")>::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/skip.rs.html#12)### impl<I> Debug for Skip<I>where I: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/step_by.rs.html#12)1.28.0 · ### impl<I> Debug for StepBy<I>where I: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/take.rs.html#12)### impl<I> Debug for std::iter::Take<I>where I: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/filter_map.rs.html#26)1.9.0 · ### impl<I, F> Debug for FilterMap<I, F>where I: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/inspect.rs.html#27)1.9.0 · ### impl<I, F> Debug for Inspect<I, F>where I: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/map.rs.html#74)1.9.0 · ### impl<I, F> Debug for Map<I, F>where I: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/intersperse.rs.html#75)### impl<I, G> Debug for IntersperseWith<I, G>where I: [Iterator](../iter/trait.iterator "trait std::iter::Iterator") + [Debug](trait.debug "trait std::fmt::Debug"), G: [Debug](trait.debug "trait std::fmt::Debug"), <I as [Iterator](../iter/trait.iterator "trait std::iter::Iterator")>::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/filter.rs.html#27)1.9.0 · ### impl<I, P> Debug for Filter<I, P>where I: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/map_while.rs.html#27)1.57.0 · ### impl<I, P> Debug for MapWhile<I, P>where I: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/skip_while.rs.html#28)1.9.0 · ### impl<I, P> Debug for SkipWhile<I, P>where I: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/take_while.rs.html#28)1.9.0 · ### impl<I, P> Debug for TakeWhile<I, P>where I: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/scan.rs.html#28)1.9.0 · ### impl<I, St, F> Debug for Scan<I, St, F>where I: [Debug](trait.debug "trait std::fmt::Debug"), St: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/flatten.rs.html#181)1.29.0 · ### impl<I, U> Debug for Flatten<I>where I: [Debug](trait.debug "trait std::fmt::Debug") + [Iterator](../iter/trait.iterator "trait std::iter::Iterator"), U: [Debug](trait.debug "trait std::fmt::Debug") + [Iterator](../iter/trait.iterator "trait std::iter::Iterator"), <I as [Iterator](../iter/trait.iterator "trait std::iter::Iterator")>::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), <<I as [Iterator](../iter/trait.iterator "trait std::iter::Iterator")>::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item") as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[IntoIter](../iter/trait.intoiterator#associatedtype.IntoIter "type std::iter::IntoIterator::IntoIter") == U, <<I as [Iterator](../iter/trait.iterator "trait std::iter::Iterator")>::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item") as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item") == <U as [Iterator](../iter/trait.iterator "trait std::iter::Iterator")>::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/flatten.rs.html#33)1.9.0 · ### impl<I, U, F> Debug for FlatMap<I, U, F>where I: [Debug](trait.debug "trait std::fmt::Debug"), U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), <U as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[IntoIter](../iter/trait.intoiterator#associatedtype.IntoIter "type std::iter::IntoIterator::IntoIter"): [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/array_chunks.rs.html#12)### impl<I, const N: usize> Debug for std::iter::ArrayChunks<I, N>where I: [Debug](trait.debug "trait std::fmt::Debug") + [Iterator](../iter/trait.iterator "trait std::iter::Iterator"), <I as [Iterator](../iter/trait.iterator "trait std::iter::Iterator")>::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/ops/range.rs.html#90)### impl<Idx> Debug for std::ops::Range<Idx>where Idx: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/ops/range.rs.html#194)### impl<Idx> Debug for RangeFrom<Idx>where Idx: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/ops/range.rs.html#460)1.26.0 · ### impl<Idx> Debug for RangeInclusive<Idx>where Idx: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/ops/range.rs.html#275)### impl<Idx> Debug for RangeTo<Idx>where Idx: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/ops/range.rs.html#593)1.26.0 · ### impl<Idx> Debug for RangeToInclusive<Idx>where Idx: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/alloc/collections/btree/map.rs.html#359)1.17.0 · ### impl<K, V> Debug for std::collections::btree\_map::Iter<'\_, K, V>where K: [Debug](trait.debug "trait std::fmt::Debug"), V: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/alloc/collections/btree/map.rs.html#382)1.17.0 · ### impl<K, V> Debug for std::collections::btree\_map::IterMut<'\_, K, V>where K: [Debug](trait.debug "trait std::fmt::Debug"), V: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/alloc/collections/btree/map.rs.html#437)1.17.0 · ### impl<K, V> Debug for std::collections::btree\_map::Keys<'\_, K, V>where K: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/alloc/collections/btree/map.rs.html#536)1.17.0 · ### impl<K, V> Debug for std::collections::btree\_map::Range<'\_, K, V>where K: [Debug](trait.debug "trait std::fmt::Debug"), V: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/alloc/collections/btree/map.rs.html#558)1.17.0 · ### impl<K, V> Debug for RangeMut<'\_, K, V>where K: [Debug](trait.debug "trait std::fmt::Debug"), V: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/alloc/collections/btree/map.rs.html#456)1.17.0 · ### impl<K, V> Debug for std::collections::btree\_map::Values<'\_, K, V>where V: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/alloc/collections/btree/map.rs.html#475)1.10.0 · ### impl<K, V> Debug for std::collections::btree\_map::ValuesMut<'\_, K, V>where V: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/std/collections/hash/map.rs.html#2474-2482)1.16.0 · ### impl<K, V> Debug for std::collections::hash\_map::Drain<'\_, K, V>where K: [Debug](trait.debug "trait std::fmt::Debug"), V: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/std/collections/hash/map.rs.html#2274-2282)1.16.0 · ### impl<K, V> Debug for std::collections::hash\_map::IterMut<'\_, K, V>where K: [Debug](trait.debug "trait std::fmt::Debug"), V: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/alloc/collections/btree/map/entry.rs.html#36)1.12.0 · ### impl<K, V, A> Debug for std::collections::btree\_map::Entry<'\_, K, V, A>where K: [Debug](trait.debug "trait std::fmt::Debug") + [Ord](../cmp/trait.ord "trait std::cmp::Ord"), V: [Debug](trait.debug "trait std::fmt::Debug"), A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator") + [Clone](../clone/trait.clone "trait std::clone::Clone"),
[source](https://doc.rust-lang.org/src/alloc/collections/btree/map.rs.html#418)1.17.0 · ### impl<K, V, A> Debug for std::collections::btree\_map::IntoIter<K, V, A>where K: [Debug](trait.debug "trait std::fmt::Debug"), V: [Debug](trait.debug "trait std::fmt::Debug"), A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator") + [Clone](../clone/trait.clone "trait std::clone::Clone"),
[source](https://doc.rust-lang.org/src/alloc/collections/btree/map.rs.html#494)1.54.0 · ### impl<K, V, A> Debug for std::collections::btree\_map::IntoKeys<K, V, A>where K: [Debug](trait.debug "trait std::fmt::Debug"), A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator") + [Clone](../clone/trait.clone "trait std::clone::Clone"),
[source](https://doc.rust-lang.org/src/alloc/collections/btree/map.rs.html#517)1.54.0 · ### impl<K, V, A> Debug for std::collections::btree\_map::IntoValues<K, V, A>where V: [Debug](trait.debug "trait std::fmt::Debug"), A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator") + [Clone](../clone/trait.clone "trait std::clone::Clone"),
[source](https://doc.rust-lang.org/src/alloc/collections/btree/map/entry.rs.html#93)1.12.0 · ### impl<K, V, A> Debug for std::collections::btree\_map::OccupiedEntry<'\_, K, V, A>where K: [Debug](trait.debug "trait std::fmt::Debug") + [Ord](../cmp/trait.ord "trait std::cmp::Ord"), V: [Debug](trait.debug "trait std::fmt::Debug"), A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator") + [Clone](../clone/trait.clone "trait std::clone::Clone"),
[source](https://doc.rust-lang.org/src/alloc/collections/btree/map/entry.rs.html#111)### impl<K, V, A> Debug for std::collections::btree\_map::OccupiedError<'\_, K, V, A>where K: [Debug](trait.debug "trait std::fmt::Debug") + [Ord](../cmp/trait.ord "trait std::cmp::Ord"), V: [Debug](trait.debug "trait std::fmt::Debug"), A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator") + [Clone](../clone/trait.clone "trait std::clone::Clone"),
[source](https://doc.rust-lang.org/src/alloc/collections/btree/map/entry.rs.html#67)1.12.0 · ### impl<K, V, A> Debug for std::collections::btree\_map::VacantEntry<'\_, K, V, A>where K: [Debug](trait.debug "trait std::fmt::Debug") + [Ord](../cmp/trait.ord "trait std::cmp::Ord"), A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator") + [Clone](../clone/trait.clone "trait std::clone::Clone"),
[source](https://doc.rust-lang.org/src/alloc/collections/btree/map.rs.html#2198)### impl<K, V, A> Debug for BTreeMap<K, V, A>where K: [Debug](trait.debug "trait std::fmt::Debug"), V: [Debug](trait.debug "trait std::fmt::Debug"), A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator") + [Clone](../clone/trait.clone "trait std::clone::Clone"),
[source](https://doc.rust-lang.org/src/alloc/collections/btree/map.rs.html#1856)### impl<K, V, F> Debug for std::collections::btree\_map::DrainFilter<'\_, K, V, F, Global>where K: [Debug](trait.debug "trait std::fmt::Debug"), V: [Debug](trait.debug "trait std::fmt::Debug"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)K, [&mut](../primitive.reference) V) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/std/collections/hash/map.rs.html#1302-1310)### impl<K, V, S> Debug for HashMap<K, V, S>where K: [Debug](trait.debug "trait std::fmt::Debug"), V: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/std/collections/hash/map.rs.html#2064-2068)### impl<K, V, S> Debug for RawEntryBuilder<'\_, K, V, S>
[source](https://doc.rust-lang.org/src/std/collections/hash/map.rs.html#2030-2034)### impl<K, V, S> Debug for RawEntryBuilderMut<'\_, K, V, S>
[source](https://doc.rust-lang.org/src/std/collections/hash/map.rs.html#2057-2061)### impl<K, V, S> Debug for RawVacantEntryMut<'\_, K, V, S>
[source](https://doc.rust-lang.org/src/std/collections/hash/map.rs.html#2444-2448)1.54.0 · ### impl<K, V: Debug> Debug for std::collections::hash\_map::IntoValues<K, V>
[source](https://doc.rust-lang.org/src/std/collections/hash/map.rs.html#1544-1548)1.16.0 · ### impl<K, V: Debug> Debug for std::collections::hash\_map::Values<'\_, K, V>
[source](https://doc.rust-lang.org/src/std/collections/hash/map.rs.html#2384-2388)1.16.0 · ### impl<K, V: Debug> Debug for std::collections::hash\_map::ValuesMut<'\_, K, V>
[source](https://doc.rust-lang.org/src/std/collections/hash/set.rs.html#1580-1584)1.16.0 · ### impl<K: Debug> Debug for std::collections::hash\_set::Drain<'\_, K>
[source](https://doc.rust-lang.org/src/std/collections/hash/set.rs.html#1550-1554)1.16.0 · ### impl<K: Debug> Debug for std::collections::hash\_set::IntoIter<K>
[source](https://doc.rust-lang.org/src/std/collections/hash/set.rs.html#1520-1524)1.16.0 · ### impl<K: Debug> Debug for std::collections::hash\_set::Iter<'\_, K>
[source](https://doc.rust-lang.org/src/std/collections/hash/map.rs.html#2414-2418)1.54.0 · ### impl<K: Debug, V> Debug for std::collections::hash\_map::IntoKeys<K, V>
[source](https://doc.rust-lang.org/src/std/collections/hash/map.rs.html#1506-1510)1.16.0 · ### impl<K: Debug, V> Debug for std::collections::hash\_map::Keys<'\_, K, V>
[source](https://doc.rust-lang.org/src/std/collections/hash/map.rs.html#2122-2126)1.12.0 · ### impl<K: Debug, V> Debug for std::collections::hash\_map::VacantEntry<'\_, K, V>
[source](https://doc.rust-lang.org/src/std/collections/hash/map.rs.html#2088-2095)1.12.0 · ### impl<K: Debug, V: Debug> Debug for std::collections::hash\_map::Entry<'\_, K, V>
[source](https://doc.rust-lang.org/src/std/collections/hash/map.rs.html#2308-2312)1.16.0 · ### impl<K: Debug, V: Debug> Debug for std::collections::hash\_map::IntoIter<K, V>
[source](https://doc.rust-lang.org/src/std/collections/hash/map.rs.html#1407-1411)1.16.0 · ### impl<K: Debug, V: Debug> Debug for std::collections::hash\_map::Iter<'\_, K, V>
[source](https://doc.rust-lang.org/src/std/collections/hash/map.rs.html#2105-2112)1.12.0 · ### impl<K: Debug, V: Debug> Debug for std::collections::hash\_map::OccupiedEntry<'\_, K, V>
[source](https://doc.rust-lang.org/src/std/collections/hash/map.rs.html#2140-2148)### impl<K: Debug, V: Debug> Debug for std::collections::hash\_map::OccupiedError<'\_, K, V>
[source](https://doc.rust-lang.org/src/std/collections/hash/map.rs.html#2037-2044)### impl<K: Debug, V: Debug, S> Debug for RawEntryMut<'\_, K, V, S>
[source](https://doc.rust-lang.org/src/std/collections/hash/map.rs.html#2047-2054)### impl<K: Debug, V: Debug, S> Debug for RawOccupiedEntryMut<'\_, K, V, S>
[source](https://doc.rust-lang.org/src/core/pin.rs.html#889)1.33.0 · ### impl<P> Debug for Pin<P>where P: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/std/io/buffered/bufreader.rs.html#385-398)### impl<R> Debug for BufReader<R>where R: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2683)### impl<R: Debug> Debug for std::io::Bytes<R>
[source](https://doc.rust-lang.org/src/core/ptr/mod.rs.html#1949)1.4.0 · ### impl<Ret, T> Debug for fn (T₁, T₂, …, Tₙ) -> Ret
This trait is implemented for function pointers with up to twelve arguments.
[source](https://doc.rust-lang.org/src/core/ptr/mod.rs.html#1949)1.4.0 · ### impl<Ret, T> Debug for extern "C" fn (T₁, T₂, …, Tₙ) -> Ret
This trait is implemented for function pointers with up to twelve arguments.
[source](https://doc.rust-lang.org/src/core/ptr/mod.rs.html#1949)1.4.0 · ### impl<Ret, T> Debug for extern "C" fn (T₁, T₂, …, Tₙ, ...) -> Ret
This trait is implemented for function pointers with up to twelve arguments.
[source](https://doc.rust-lang.org/src/core/ptr/mod.rs.html#1949)1.4.0 · ### impl<Ret, T> Debug for unsafe fn (T₁, T₂, …, Tₙ) -> Ret
This trait is implemented for function pointers with up to twelve arguments.
[source](https://doc.rust-lang.org/src/core/ptr/mod.rs.html#1949)1.4.0 · ### impl<Ret, T> Debug for unsafe extern "C" fn (T₁, T₂, …, Tₙ) -> Ret
This trait is implemented for function pointers with up to twelve arguments.
[source](https://doc.rust-lang.org/src/core/ptr/mod.rs.html#1949)1.4.0 · ### impl<Ret, T> Debug for unsafe extern "C" fn (T₁, T₂, …, Tₙ, ...) -> Ret
This trait is implemented for function pointers with up to twelve arguments.
[source](https://doc.rust-lang.org/src/core/ops/range.rs.html#664)1.17.0 · ### impl<T> Debug for Bound<T>where T: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/option.rs.html#515)### impl<T> Debug for Option<T>where T: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/std/sync/poison.rs.html#225-232)### impl<T> Debug for TryLockError<T>
[source](https://doc.rust-lang.org/src/std/sync/mpsc/mod.rs.html#1542-1549)### impl<T> Debug for TrySendError<T>
[source](https://doc.rust-lang.org/src/core/task/poll.rs.html#11)1.36.0 · ### impl<T> Debug for Poll<T>where T: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#2529)### impl<T> Debug for \*const Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#2535)### impl<T> Debug for \*mut Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#2376)### impl<T> Debug for &Twhere T: [Debug](trait.debug "trait std::fmt::Debug") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#2376)### impl<T> Debug for &mut Twhere T: [Debug](trait.debug "trait std::fmt::Debug") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#2590)### impl<T> Debug for [T]where T: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#2587)### impl<T> Debug for (T₁, T₂, …, Tₙ)where T: [Debug](trait.debug "trait std::fmt::Debug") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
This trait is implemented for tuples up to twelve items long.
[source](https://doc.rust-lang.org/src/alloc/boxed/thin.rs.html#96)### impl<T> Debug for ThinBox<T>where T: [Debug](trait.debug "trait std::fmt::Debug") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#2611)### impl<T> Debug for Cell<T>where T: [Copy](../marker/trait.copy "trait std::marker::Copy") + [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/cell/once.rs.html#244)### impl<T> Debug for OnceCell<T>where T: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#2640)### impl<T> Debug for Ref<'\_, T>where T: [Debug](trait.debug "trait std::fmt::Debug") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#2618)### impl<T> Debug for RefCell<T>where T: [Debug](trait.debug "trait std::fmt::Debug") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#2647)### impl<T> Debug for RefMut<'\_, T>where T: [Debug](trait.debug "trait std::fmt::Debug") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#2661)### impl<T> Debug for SyncUnsafeCell<T>where T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#2654)1.9.0 · ### impl<T> Debug for UnsafeCell<T>where T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#606)1.19.0 · ### impl<T> Debug for Reverse<T>where T: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/alloc/collections/binary_heap.rs.html#1375)1.17.0 · ### impl<T> Debug for std::collections::binary\_heap::IntoIter<T>where T: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/alloc/collections/binary_heap.rs.html#1441)### impl<T> Debug for IntoIterSorted<T>where T: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/alloc/collections/binary_heap.rs.html#1309)1.17.0 · ### impl<T> Debug for std::collections::binary\_heap::Iter<'\_, T>where T: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/alloc/collections/binary_heap.rs.html#286)1.17.0 · ### impl<T> Debug for PeekMut<'\_, T>where T: [Ord](../cmp/trait.ord "trait std::cmp::Ord") + [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/alloc/collections/btree/set.rs.html#143)1.17.0 · ### impl<T> Debug for std::collections::btree\_set::Iter<'\_, T>where T: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/alloc/collections/btree/set.rs.html#246)1.17.0 · ### impl<T> Debug for std::collections::btree\_set::SymmetricDifference<'\_, T>where T: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/alloc/collections/btree/set.rs.html#318)1.17.0 · ### impl<T> Debug for std::collections::btree\_set::Union<'\_, T>where T: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/alloc/collections/linked_list.rs.html#1157)### impl<T> Debug for std::collections::linked\_list::Cursor<'\_, T>where T: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/alloc/collections/linked_list.rs.html#1181)### impl<T> Debug for CursorMut<'\_, T>where T: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/alloc/collections/linked_list.rs.html#141)1.17.0 · ### impl<T> Debug for std::collections::linked\_list::IntoIter<T>where T: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/alloc/collections/linked_list.rs.html#77)1.17.0 · ### impl<T> Debug for std::collections::linked\_list::Iter<'\_, T>where T: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/alloc/collections/linked_list.rs.html#113)1.17.0 · ### impl<T> Debug for std::collections::linked\_list::IterMut<'\_, T>where T: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/alloc/collections/binary_heap.rs.html#353)1.4.0 · ### impl<T> Debug for BinaryHeap<T>where T: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/alloc/collections/linked_list.rs.html#1938)### impl<T> Debug for LinkedList<T>where T: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/alloc/collections/vec_deque/iter.rs.html#28)1.17.0 · ### impl<T> Debug for std::collections::vec\_deque::Iter<'\_, T>where T: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/alloc/collections/vec_deque/iter_mut.rs.html#41)1.17.0 · ### impl<T> Debug for std::collections::vec\_deque::IterMut<'\_, T>where T: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/future/pending.rs.html#47)1.48.0 · ### impl<T> Debug for Pending<T>
[source](https://doc.rust-lang.org/src/core/future/ready.rs.html#10)1.48.0 · ### impl<T> Debug for std::future::Ready<T>where T: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/iter/sources/empty.rs.html#38)1.9.0 · ### impl<T> Debug for std::iter::Empty<T>
[source](https://doc.rust-lang.org/src/core/iter/sources/once.rs.html#62)1.2.0 · ### impl<T> Debug for std::iter::Once<T>where T: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/iter/adapters/rev.rs.html#11)### impl<T> Debug for Rev<T>where T: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#2604)### impl<T> Debug for PhantomData<T>where T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/mem/mod.rs.html#1108)1.21.0 · ### impl<T> Debug for Discriminant<T>
[source](https://doc.rust-lang.org/src/core/mem/manually_drop.rs.html#48)1.20.0 · ### impl<T> Debug for ManuallyDrop<T>where T: [Debug](trait.debug "trait std::fmt::Debug") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/num/saturating.rs.html#41)### impl<T> Debug for Saturating<T>where T: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/num/wrapping.rs.html#45)### impl<T> Debug for Wrapping<T>where T: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/ops/try_trait.rs.html#497)### impl<T> Debug for Yeet<T>where T: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/panic/unwind_safe.rs.html#276)1.16.0 · ### impl<T> Debug for AssertUnwindSafe<T>where T: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/ptr/non_null.rs.html#718)1.25.0 · ### impl<T> Debug for NonNull<T>where T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/alloc/rc.rs.html#1844)### impl<T> Debug for Rc<T>where T: [Debug](trait.debug "trait std::fmt::Debug") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/alloc/rc.rs.html#2532)1.4.0 · ### impl<T> Debug for std::rc::Weak<T>where T: [Debug](trait.debug "trait std::fmt::Debug") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/result.rs.html#1981)### impl<T> Debug for std::result::IntoIter<T>where T: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#75)1.9.0 · ### impl<T> Debug for std::slice::Iter<'\_, T>where T: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#196)1.9.0 · ### impl<T> Debug for std::slice::IterMut<'\_, T>where T: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/sync/atomic.rs.html#3406)1.3.0 · ### impl<T> Debug for AtomicPtr<T>
[source](https://doc.rust-lang.org/src/std/sync/mpsc/mod.rs.html#1513-1517)1.8.0 · ### impl<T> Debug for Receiver<T>
[source](https://doc.rust-lang.org/src/std/sync/mpsc/mod.rs.html#1520-1524)### impl<T> Debug for SendError<T>
[source](https://doc.rust-lang.org/src/std/sync/mpsc/mod.rs.html#905-909)1.8.0 · ### impl<T> Debug for Sender<T>
[source](https://doc.rust-lang.org/src/std/sync/mpsc/mod.rs.html#1032-1036)1.8.0 · ### impl<T> Debug for SyncSender<T>
[source](https://doc.rust-lang.org/src/alloc/sync.rs.html#2422)### impl<T> Debug for Arc<T>where T: [Debug](trait.debug "trait std::fmt::Debug") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/sync/exclusive.rs.html#93)### impl<T> Debug for Exclusive<T>where T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/std/sync/poison.rs.html#142-146)### impl<T> Debug for PoisonError<T>
[source](https://doc.rust-lang.org/src/alloc/sync.rs.html#306)1.4.0 · ### impl<T> Debug for std::sync::Weak<T>where T: [Debug](trait.debug "trait std::fmt::Debug") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/task/ready.rs.html#110)### impl<T> Debug for std::task::Ready<T>
[source](https://doc.rust-lang.org/src/std/thread/mod.rs.html#1555-1559)1.16.0 · ### impl<T> Debug for JoinHandle<T>
[source](https://doc.rust-lang.org/src/core/mem/maybe_uninit.rs.html#265)1.41.0 · ### impl<T> Debug for MaybeUninit<T>
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#1833)### impl<T, A> Debug for Box<T, A>where T: [Debug](trait.debug "trait std::fmt::Debug") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"), A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator"),
[source](https://doc.rust-lang.org/src/alloc/collections/btree/set.rs.html#228)1.17.0 · ### impl<T, A> Debug for std::collections::btree\_set::Difference<'\_, T, A>where T: [Debug](trait.debug "trait std::fmt::Debug"), A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator") + [Clone](../clone/trait.clone "trait std::clone::Clone"),
[source](https://doc.rust-lang.org/src/alloc/collections/btree/set.rs.html#300)1.17.0 · ### impl<T, A> Debug for std::collections::btree\_set::Intersection<'\_, T, A>where T: [Debug](trait.debug "trait std::fmt::Debug"), A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator") + [Clone](../clone/trait.clone "trait std::clone::Clone"),
[source](https://doc.rust-lang.org/src/alloc/collections/btree/set.rs.html#157)### impl<T, A> Debug for std::collections::btree\_set::IntoIter<T, A>where T: [Debug](trait.debug "trait std::fmt::Debug"), A: [Debug](trait.debug "trait std::fmt::Debug") + [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator") + [Clone](../clone/trait.clone "trait std::clone::Clone"),
[source](https://doc.rust-lang.org/src/alloc/collections/btree/set.rs.html#1479)### impl<T, A> Debug for BTreeSet<T, A>where T: [Debug](trait.debug "trait std::fmt::Debug"), A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator") + [Clone](../clone/trait.clone "trait std::clone::Clone"),
[source](https://doc.rust-lang.org/src/alloc/collections/vec_deque/mod.rs.html#3023)### impl<T, A> Debug for VecDeque<T, A>where T: [Debug](trait.debug "trait std::fmt::Debug"), A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator"),
[source](https://doc.rust-lang.org/src/alloc/collections/vec_deque/drain.rs.html#47)1.17.0 · ### impl<T, A> Debug for std::collections::vec\_deque::Drain<'\_, T, A>where T: [Debug](trait.debug "trait std::fmt::Debug"), A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator"),
[source](https://doc.rust-lang.org/src/alloc/collections/vec_deque/into_iter.rs.html#31)1.17.0 · ### impl<T, A> Debug for std::collections::vec\_deque::IntoIter<T, A>where T: [Debug](trait.debug "trait std::fmt::Debug"), A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator"),
[source](https://doc.rust-lang.org/src/alloc/vec/drain.rs.html#37)1.17.0 · ### impl<T, A> Debug for std::vec::Drain<'\_, T, A>where T: [Debug](trait.debug "trait std::fmt::Debug"), A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator"),
[source](https://doc.rust-lang.org/src/alloc/vec/into_iter.rs.html#45)1.13.0 · ### impl<T, A> Debug for std::vec::IntoIter<T, A>where T: [Debug](trait.debug "trait std::fmt::Debug"), A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator"),
[source](https://doc.rust-lang.org/src/alloc/vec/mod.rs.html#2939)### impl<T, A> Debug for Vec<T, A>where T: [Debug](trait.debug "trait std::fmt::Debug"), A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator"),
[source](https://doc.rust-lang.org/src/core/result.rs.html#500)### impl<T, E> Debug for Result<T, E>where T: [Debug](trait.debug "trait std::fmt::Debug"), E: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/cell/lazy.rs.html#100)### impl<T, F> Debug for LazyCell<T, F>where T: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/alloc/collections/linked_list.rs.html#1773)### impl<T, F> Debug for std::collections::linked\_list::DrainFilter<'\_, T, F>where T: [Debug](trait.debug "trait std::fmt::Debug"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) T) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/iter/sources/successors.rs.html#62)1.34.0 · ### impl<T, F> Debug for Successors<T, F>where T: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/alloc/collections/btree/set.rs.html#1309)### impl<T, F, A> Debug for std::collections::btree\_set::DrainFilter<'\_, T, F, A>where A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator") + [Clone](../clone/trait.clone "trait std::clone::Clone"), T: [Debug](trait.debug "trait std::fmt::Debug"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#927)1.27.0 · ### impl<T, P> Debug for std::slice::RSplit<'\_, T, P>where T: [Debug](trait.debug "trait std::fmt::Debug"), P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1024)1.27.0 · ### impl<T, P> Debug for RSplitMut<'\_, T, P>where T: [Debug](trait.debug "trait std::fmt::Debug"), P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1188)1.9.0 · ### impl<T, P> Debug for std::slice::RSplitN<'\_, T, P>where T: [Debug](trait.debug "trait std::fmt::Debug"), P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1269)1.9.0 · ### impl<T, P> Debug for RSplitNMut<'\_, T, P>where T: [Debug](trait.debug "trait std::fmt::Debug"), P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#426)1.9.0 · ### impl<T, P> Debug for std::slice::Split<'\_, T, P>where T: [Debug](trait.debug "trait std::fmt::Debug"), P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#556)1.51.0 · ### impl<T, P> Debug for std::slice::SplitInclusive<'\_, T, P>where T: [Debug](trait.debug "trait std::fmt::Debug"), P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#806)1.51.0 · ### impl<T, P> Debug for SplitInclusiveMut<'\_, T, P>where T: [Debug](trait.debug "trait std::fmt::Debug"), P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#676)1.9.0 · ### impl<T, P> Debug for SplitMut<'\_, T, P>where T: [Debug](trait.debug "trait std::fmt::Debug"), P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1147)1.9.0 · ### impl<T, P> Debug for std::slice::SplitN<'\_, T, P>where T: [Debug](trait.debug "trait std::fmt::Debug"), P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1228)1.9.0 · ### impl<T, P> Debug for SplitNMut<'\_, T, P>where T: [Debug](trait.debug "trait std::fmt::Debug"), P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/std/collections/hash/set.rs.html#1710-1718)1.16.0 · ### impl<T, S> Debug for std::collections::hash\_set::Difference<'\_, T, S>where T: [Debug](trait.debug "trait std::fmt::Debug") + [Eq](../cmp/trait.eq "trait std::cmp::Eq") + [Hash](../hash/trait.hash "trait std::hash::Hash"), S: [BuildHasher](../hash/trait.buildhasher "trait std::hash::BuildHasher"),
[source](https://doc.rust-lang.org/src/std/collections/hash/set.rs.html#1012-1019)### impl<T, S> Debug for HashSet<T, S>where T: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/std/collections/hash/set.rs.html#1650-1658)1.16.0 · ### impl<T, S> Debug for std::collections::hash\_set::Intersection<'\_, T, S>where T: [Debug](trait.debug "trait std::fmt::Debug") + [Eq](../cmp/trait.eq "trait std::cmp::Eq") + [Hash](../hash/trait.hash "trait std::hash::Hash"), S: [BuildHasher](../hash/trait.buildhasher "trait std::hash::BuildHasher"),
[source](https://doc.rust-lang.org/src/std/collections/hash/set.rs.html#1755-1763)1.16.0 · ### impl<T, S> Debug for std::collections::hash\_set::SymmetricDifference<'\_, T, S>where T: [Debug](trait.debug "trait std::fmt::Debug") + [Eq](../cmp/trait.eq "trait std::cmp::Eq") + [Hash](../hash/trait.hash "trait std::hash::Hash"), S: [BuildHasher](../hash/trait.buildhasher "trait std::hash::BuildHasher"),
[source](https://doc.rust-lang.org/src/std/collections/hash/set.rs.html#1782-1790)1.16.0 · ### impl<T, S> Debug for std::collections::hash\_set::Union<'\_, T, S>where T: [Debug](trait.debug "trait std::fmt::Debug") + [Eq](../cmp/trait.eq "trait std::cmp::Eq") + [Hash](../hash/trait.hash "trait std::hash::Hash"), S: [BuildHasher](../hash/trait.buildhasher "trait std::hash::BuildHasher"),
[source](https://doc.rust-lang.org/src/core/up/up/portable-simd/crates/core_simd/src/masks.rs.html#315)### impl<T, const LANES: usize> Debug for Mask<T, LANES>where T: [MaskElement](../simd/trait.maskelement "trait std::simd::MaskElement") + [Debug](trait.debug "trait std::fmt::Debug"), [LaneCount](../simd/struct.lanecount "struct std::simd::LaneCount")<LANES>: [SupportedLaneCount](../simd/trait.supportedlanecount "trait std::simd::SupportedLaneCount"),
[source](https://doc.rust-lang.org/src/core/up/up/portable-simd/crates/core_simd/src/fmt.rs.html#31-39)### impl<T, const LANES: usize> Debug for Simd<T, LANES>where T: [SimdElement](../simd/trait.simdelement "trait std::simd::SimdElement") + [Debug](trait.debug "trait std::fmt::Debug"), [LaneCount](../simd/struct.lanecount "struct std::simd::LaneCount")<LANES>: [SupportedLaneCount](../simd/trait.supportedlanecount "trait std::simd::SupportedLaneCount"),
[source](https://doc.rust-lang.org/src/core/array/mod.rs.html#261)### impl<T, const N: usize> Debug for [T; N]where T: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/array/iter.rs.html#414)1.40.0 · ### impl<T, const N: usize> Debug for std::array::IntoIter<T, N>where T: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/std/thread/local.rs.html#118-122)1.16.0 · ### impl<T: 'static> Debug for LocalKey<T>
[source](https://doc.rust-lang.org/src/std/io/cursor.rs.html#73)### impl<T: Debug> Debug for std::io::Cursor<T>
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2432)### impl<T: Debug> Debug for std::io::Take<T>
[source](https://doc.rust-lang.org/src/std/sync/mpsc/mod.rs.html#460)1.1.0 · ### impl<T: Debug> Debug for std::sync::mpsc::IntoIter<T>
[source](https://doc.rust-lang.org/src/std/sync/once_lock.rs.html#367-374)### impl<T: Debug> Debug for OnceLock<T>
[source](https://doc.rust-lang.org/src/std/sync/rwlock.rs.html#543-547)1.16.0 · ### impl<T: Debug> Debug for RwLockReadGuard<'\_, T>
[source](https://doc.rust-lang.org/src/std/sync/rwlock.rs.html#557-561)1.16.0 · ### impl<T: Debug> Debug for RwLockWriteGuard<'\_, T>
[source](https://doc.rust-lang.org/src/std/sync/lazy_lock.rs.html#100-104)### impl<T: Debug, F> Debug for LazyLock<T, F>
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2286)### impl<T: Debug, U: Debug> Debug for std::io::Chain<T, U>
[source](https://doc.rust-lang.org/src/std/sync/mutex.rs.html#476-499)### impl<T: ?Sized + Debug> Debug for Mutex<T>
[source](https://doc.rust-lang.org/src/std/sync/mutex.rs.html#535-539)1.16.0 · ### impl<T: ?Sized + Debug> Debug for MutexGuard<'\_, T>
[source](https://doc.rust-lang.org/src/std/sync/rwlock.rs.html#479-502)### impl<T: ?Sized + Debug> Debug for RwLock<T>
[source](https://doc.rust-lang.org/src/std/io/buffered/bufwriter.rs.html#643-653)### impl<W: Write> Debug for BufWriter<W>where W: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/std/io/buffered/linewriter.rs.html#219-232)### impl<W: Write> Debug for LineWriter<W>where W: [Debug](trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/std/io/buffered/mod.rs.html#46)### impl<W: Debug> Debug for IntoInnerError<W>
[source](https://doc.rust-lang.org/src/core/ops/generator.rs.html#9)### impl<Y, R> Debug for GeneratorState<Y, R>where Y: [Debug](trait.debug "trait std::fmt::Debug"), R: [Debug](trait.debug "trait std::fmt::Debug"),
| programming_docs |
rust Macro std::fmt::Debug Macro std::fmt::Debug
=====================
```
pub macro Debug($item:item) {
...
}
```
Derive macro generating an impl of the trait `Debug`.
rust Trait std::fmt::Display Trait std::fmt::Display
=======================
```
pub trait Display {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>;
}
```
Format trait for an empty format, `{}`.
`Display` is similar to [`Debug`](trait.debug "Debug"), but `Display` is for user-facing output, and so cannot be derived.
For more information on formatters, see [the module-level documentation](index).
Examples
--------
Implementing `Display` on a type:
```
use std::fmt;
struct Point {
x: i32,
y: i32,
}
impl fmt::Display for Point {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "({}, {})", self.x, self.y)
}
}
let origin = Point { x: 0, y: 0 };
assert_eq!(format!("The origin is: {origin}"), "The origin is: (0, 0)");
```
Required Methods
----------------
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#778)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter.
##### Examples
```
use std::fmt;
struct Position {
longitude: f32,
latitude: f32,
}
impl fmt::Display for Position {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "({}, {})", self.longitude, self.latitude)
}
}
assert_eq!("(1.987, 2.983)",
format!("{}", Position { longitude: 1.987, latitude: 2.983, }));
```
Implementors
------------
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#715)1.34.0 · ### impl Display for Infallible
[source](https://doc.rust-lang.org/src/std/env.rs.html#296-305)### impl Display for VarError
[source](https://doc.rust-lang.org/src/std/io/error.rs.html#439-452)1.60.0 · ### impl Display for ErrorKind
[source](https://doc.rust-lang.org/src/std/net/ip_addr.rs.html#930-937)1.7.0 · ### impl Display for IpAddr
[source](https://doc.rust-lang.org/src/std/net/socket_addr.rs.html#602-609)### impl Display for SocketAddr
[source](https://doc.rust-lang.org/src/std/sync/mpsc/mod.rs.html#1637-1644)1.15.0 · ### impl Display for RecvTimeoutError
[source](https://doc.rust-lang.org/src/std/sync/mpsc/mod.rs.html#1602-1609)### impl Display for TryRecvError
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#2401)### impl Display for bool
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#2455)### impl Display for char
[source](https://doc.rust-lang.org/src/core/fmt/float.rs.html#225)### impl Display for f32
[source](https://doc.rust-lang.org/src/core/fmt/float.rs.html#226)### impl Display for f64
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#461-464)### impl Display for i8
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#461-464)### impl Display for i16
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#461-464)### impl Display for i32
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#461-464)### impl Display for i64
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#576)### impl Display for i128
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#461-464)### impl Display for isize
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#2386)### impl Display for !
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#2433)### impl Display for str
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#461-464)### impl Display for u8
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#461-464)### impl Display for u16
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#461-464)### impl Display for u32
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#461-464)### impl Display for u64
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#569)### impl Display for u128
[source](https://doc.rust-lang.org/src/core/fmt/num.rs.html#461-464)### impl Display for usize
[source](https://doc.rust-lang.org/src/core/ffi/c_str.rs.html#154)### impl Display for FromBytesUntilNulError
[source](https://doc.rust-lang.org/src/core/alloc/mod.rs.html#47)### impl Display for AllocError
[source](https://doc.rust-lang.org/src/core/alloc/layout.rs.html#472)1.28.0 · ### impl Display for LayoutError
[source](https://doc.rust-lang.org/src/core/array/mod.rs.html#117)1.36.0 · ### impl Display for TryFromSliceError
[source](https://doc.rust-lang.org/src/core/ascii.rs.html#137)1.39.0 · ### impl Display for std::ascii::EscapeDefault
[source](https://doc.rust-lang.org/src/std/backtrace.rs.html#385-432)1.65.0 · ### impl Display for Backtrace
[source](https://doc.rust-lang.org/src/core/cell.rs.html#650)1.13.0 · ### impl Display for BorrowError
[source](https://doc.rust-lang.org/src/core/cell.rs.html#677)1.13.0 · ### impl Display for BorrowMutError
[source](https://doc.rust-lang.org/src/core/char/convert.rs.html#239)1.34.0 · ### impl Display for CharTryFromError
[source](https://doc.rust-lang.org/src/core/char/decode.rs.html#121)1.9.0 · ### impl Display for DecodeUtf16Error
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#399)1.20.0 · ### impl Display for std::char::EscapeDebug
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#362)1.16.0 · ### impl Display for std::char::EscapeDefault
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#254)1.16.0 · ### impl Display for std::char::EscapeUnicode
[source](https://doc.rust-lang.org/src/core/char/convert.rs.html#176)1.20.0 · ### impl Display for ParseCharError
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#565)1.16.0 · ### impl Display for ToLowercase
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#572)1.16.0 · ### impl Display for ToUppercase
[source](https://doc.rust-lang.org/src/core/char/mod.rs.html#584)1.59.0 · ### impl Display for TryFromCharError
[source](https://doc.rust-lang.org/src/alloc/collections/mod.rs.html#131)1.57.0 · ### impl Display for TryReserveError
[source](https://doc.rust-lang.org/src/std/env.rs.html#538-542)### impl Display for JoinPathsError
[source](https://doc.rust-lang.org/src/core/ffi/c_str.rs.html#177)1.17.0 · ### impl Display for FromBytesWithNulError
[source](https://doc.rust-lang.org/src/alloc/ffi/c_str.rs.html#966)1.58.0 · ### impl Display for FromVecWithNulError
[source](https://doc.rust-lang.org/src/alloc/ffi/c_str.rs.html#1009)1.7.0 · ### impl Display for IntoStringError
[source](https://doc.rust-lang.org/src/alloc/ffi/c_str.rs.html#959)### impl Display for NulError
[source](https://doc.rust-lang.org/src/std/io/error.rs.html#923-935)### impl Display for std::io::Error
[source](https://doc.rust-lang.org/src/std/io/buffered/bufwriter.rs.html#498-502)1.56.0 · ### impl Display for WriterPanicked
[source](https://doc.rust-lang.org/src/std/net/parser.rs.html#480-485)1.4.0 · ### impl Display for AddrParseError
[source](https://doc.rust-lang.org/src/std/net/ip_addr.rs.html#991-1009)### impl Display for Ipv4Addr
[source](https://doc.rust-lang.org/src/std/net/ip_addr.rs.html#1773-1856)### impl Display for Ipv6Addr
Write an Ipv6Addr, conforming to the canonical style described by [RFC 5952](https://tools.ietf.org/html/rfc5952).
[source](https://doc.rust-lang.org/src/std/net/socket_addr.rs.html#619-635)### impl Display for SocketAddrV4
[source](https://doc.rust-lang.org/src/std/net/socket_addr.rs.html#645-669)### impl Display for SocketAddrV6
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.34.0 · ### impl Display for NonZeroI8
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.34.0 · ### impl Display for NonZeroI16
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.34.0 · ### impl Display for NonZeroI32
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.34.0 · ### impl Display for NonZeroI64
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.34.0 · ### impl Display for NonZeroI128
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.34.0 · ### impl Display for NonZeroIsize
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.28.0 · ### impl Display for NonZeroU8
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.28.0 · ### impl Display for NonZeroU16
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.28.0 · ### impl Display for NonZeroU32
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.28.0 · ### impl Display for NonZeroU64
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.28.0 · ### impl Display for NonZeroU128
[source](https://doc.rust-lang.org/src/core/num/nonzero.rs.html#161-174)1.28.0 · ### impl Display for NonZeroUsize
[source](https://doc.rust-lang.org/src/core/num/dec2flt/mod.rs.html#202)### impl Display for ParseFloatError
[source](https://doc.rust-lang.org/src/core/num/error.rs.html#144)### impl Display for ParseIntError
[source](https://doc.rust-lang.org/src/core/num/error.rs.html#27)1.34.0 · ### impl Display for TryFromIntError
[source](https://doc.rust-lang.org/src/std/os/windows/io/handle.rs.html#274-279)1.63.0 · ### impl Display for InvalidHandleError
Available on **Windows** only.[source](https://doc.rust-lang.org/src/std/os/windows/io/handle.rs.html#256-260)1.63.0 · ### impl Display for NullHandleError
Available on **Windows** only.[source](https://doc.rust-lang.org/src/core/panic/location.rs.html#193)1.26.0 · ### impl Display for Location<'\_>
[source](https://doc.rust-lang.org/src/core/panic/panic_info.rs.html#151)1.26.0 · ### impl Display for PanicInfo<'\_>
[source](https://doc.rust-lang.org/src/std/path.rs.html#2916-2920)### impl Display for Display<'\_>
[source](https://doc.rust-lang.org/src/std/path.rs.html#3170-3175)1.7.0 · ### impl Display for StripPrefixError
[source](https://doc.rust-lang.org/src/std/process.rs.html#1555-1559)### impl Display for ExitStatus
[source](https://doc.rust-lang.org/src/std/process.rs.html#1668-1672)### impl Display for ExitStatusError
[source](https://doc.rust-lang.org/src/core/str/error.rs.html#145)### impl Display for ParseBoolError
[source](https://doc.rust-lang.org/src/core/str/error.rs.html#113)### impl Display for Utf8Error
[source](https://doc.rust-lang.org/src/alloc/string.rs.html#1931)### impl Display for FromUtf8Error
[source](https://doc.rust-lang.org/src/alloc/string.rs.html#1938)### impl Display for FromUtf16Error
[source](https://doc.rust-lang.org/src/alloc/string.rs.html#2246)### impl Display for String
[source](https://doc.rust-lang.org/src/std/sync/mpsc/mod.rs.html#1587-1591)### impl Display for RecvError
[source](https://doc.rust-lang.org/src/std/thread/local.rs.html#383-387)1.26.0 · ### impl Display for AccessError
[source](https://doc.rust-lang.org/src/core/time.rs.html#1230)### impl Display for FromFloatSecsError
[source](https://doc.rust-lang.org/src/std/time.rs.html#678-682)1.8.0 · ### impl Display for SystemTimeError
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#533)### impl Display for Arguments<'\_>
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#2353)### impl Display for std::fmt::Error
[source](https://doc.rust-lang.org/src/core/slice/ascii.rs.html#220)1.60.0 · ### impl<'a> Display for EscapeAscii<'a>
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#1499)1.34.0 · ### impl<'a> Display for std::str::EscapeDebug<'a>
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#1499)1.34.0 · ### impl<'a> Display for std::str::EscapeDefault<'a>
[source](https://doc.rust-lang.org/src/core/str/iter.rs.html#1499)1.34.0 · ### impl<'a> Display for std::str::EscapeUnicode<'a>
[source](https://doc.rust-lang.org/src/alloc/collections/btree/map/entry.rs.html#122-123)### impl<'a, K, V, A> Display for std::collections::btree\_map::OccupiedError<'a, K, V, A>where K: [Debug](trait.debug "trait std::fmt::Debug") + [Ord](../cmp/trait.ord "trait std::cmp::Ord"), V: [Debug](trait.debug "trait std::fmt::Debug"), A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator") + [Clone](../clone/trait.clone "trait std::clone::Clone"),
[source](https://doc.rust-lang.org/src/std/collections/hash/map.rs.html#2151-2161)### impl<'a, K: Debug, V: Debug> Display for std::collections::hash\_map::OccupiedError<'a, K, V>
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#398)### impl<B> Display for Cow<'\_, B>where B: [Display](trait.display "trait std::fmt::Display") + [ToOwned](../borrow/trait.toowned "trait std::borrow::ToOwned") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"), <B as [ToOwned](../borrow/trait.toowned "trait std::borrow::ToOwned")>::[Owned](../borrow/trait.toowned#associatedtype.Owned "type std::borrow::ToOwned::Owned"): [Display](trait.display "trait std::fmt::Display"),
[source](https://doc.rust-lang.org/src/std/error.rs.html#1557-1564)### impl<E> Display for Report<E>where E: [Error](../error/trait.error "trait std::error::Error"),
[source](https://doc.rust-lang.org/src/core/pin.rs.html#896)1.33.0 · ### impl<P> Display for Pin<P>where P: [Display](trait.display "trait std::fmt::Display"),
[source](https://doc.rust-lang.org/src/std/sync/poison.rs.html#235-243)### impl<T> Display for TryLockError<T>
[source](https://doc.rust-lang.org/src/std/sync/mpsc/mod.rs.html#1552-1559)### impl<T> Display for TrySendError<T>
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#2376)### impl<T> Display for &Twhere T: [Display](trait.display "trait std::fmt::Display") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#2376)### impl<T> Display for &mut Twhere T: [Display](trait.display "trait std::fmt::Display") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/alloc/boxed/thin.rs.html#103)### impl<T> Display for ThinBox<T>where T: [Display](trait.display "trait std::fmt::Display") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/cell.rs.html#1494)1.20.0 · ### impl<T> Display for Ref<'\_, T>where T: [Display](trait.display "trait std::fmt::Display") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/cell.rs.html#1740)1.20.0 · ### impl<T> Display for RefMut<'\_, T>where T: [Display](trait.display "trait std::fmt::Display") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/num/saturating.rs.html#48)### impl<T> Display for Saturating<T>where T: [Display](trait.display "trait std::fmt::Display"),
[source](https://doc.rust-lang.org/src/core/num/wrapping.rs.html#52)1.10.0 · ### impl<T> Display for Wrapping<T>where T: [Display](trait.display "trait std::fmt::Display"),
[source](https://doc.rust-lang.org/src/alloc/rc.rs.html#1837)### impl<T> Display for Rc<T>where T: [Display](trait.display "trait std::fmt::Display") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/std/sync/mpsc/mod.rs.html#1527-1531)### impl<T> Display for SendError<T>
[source](https://doc.rust-lang.org/src/alloc/sync.rs.html#2415)### impl<T> Display for Arc<T>where T: [Display](trait.display "trait std::fmt::Display") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/std/sync/poison.rs.html#149-153)### impl<T> Display for PoisonError<T>
[source](https://doc.rust-lang.org/src/alloc/boxed.rs.html#1826)### impl<T, A> Display for Box<T, A>where T: [Display](trait.display "trait std::fmt::Display") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"), A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator"),
[source](https://doc.rust-lang.org/src/std/sync/mutex.rs.html#542-546)1.20.0 · ### impl<T: ?Sized + Display> Display for MutexGuard<'\_, T>
[source](https://doc.rust-lang.org/src/std/sync/rwlock.rs.html#550-554)1.20.0 · ### impl<T: ?Sized + Display> Display for RwLockReadGuard<'\_, T>
[source](https://doc.rust-lang.org/src/std/sync/rwlock.rs.html#564-568)1.20.0 · ### impl<T: ?Sized + Display> Display for RwLockWriteGuard<'\_, T>
[source](https://doc.rust-lang.org/src/std/io/buffered/mod.rs.html#192-196)### impl<W> Display for IntoInnerError<W>
rust Type Definition std::fmt::Result Type Definition std::fmt::Result
================================
```
pub type Result = Result<(), Error>;
```
The type returned by formatter methods.
Examples
--------
```
use std::fmt;
#[derive(Debug)]
struct Triangle {
a: f32,
b: f32,
c: f32
}
impl fmt::Display for Triangle {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "({}, {}, {})", self.a, self.b, self.c)
}
}
let pythagorean_triple = Triangle { a: 3.0, b: 4.0, c: 5.0 };
assert_eq!(format!("{pythagorean_triple}"), "(3, 4, 5)");
```
rust Struct std::fmt::Arguments Struct std::fmt::Arguments
==========================
```
pub struct Arguments<'a> { /* private fields */ }
```
This structure represents a safely precompiled version of a format string and its arguments. This cannot be generated at runtime because it cannot safely be done, so no constructors are given and the fields are private to prevent modification.
The [`format_args!`](../macro.format_args "format_args!") macro will safely create an instance of this structure. The macro validates the format string at compile-time so usage of the [`write()`](fn.write "write()") and [`format()`](fn.format) functions can be safely performed.
You can use the `Arguments<'a>` that [`format_args!`](../macro.format_args "format_args!") returns in `Debug` and `Display` contexts as seen below. The example also shows that `Debug` and `Display` format to the same thing: the interpolated format string in `format_args!`.
```
let debug = format!("{:?}", format_args!("{} foo {:?}", 1, 2));
let display = format!("{}", format_args!("{} foo {:?}", 1, 2));
assert_eq!("1 foo 2", display);
assert_eq!(display, debug);
```
Implementations
---------------
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#486)### impl<'a> Arguments<'a>
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#516)1.52.0 (const: unstable) · #### pub fn as\_str(&self) -> Option<&'static str>
Get the formatted string, if it has no arguments to be formatted.
This can be used to avoid allocations in the most trivial case.
##### Examples
```
use std::fmt::Arguments;
fn write_str(_: &str) { /* ... */ }
fn write_fmt(args: &Arguments) {
if let Some(s) = args.as_str() {
write_str(s)
} else {
write_str(&args.to_string());
}
}
```
```
assert_eq!(format_args!("hello").as_str(), Some("hello"));
assert_eq!(format_args!("").as_str(), Some(""));
assert_eq!(format_args!("{}", 1).as_str(), None);
```
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#473)### impl<'a> Clone for Arguments<'a>
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#473)#### fn clone(&self) -> Arguments<'a>
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)#### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#526)### impl Debug for Arguments<'\_>
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#527)#### fn fmt(&self, fmt: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#533)### impl Display for Arguments<'\_>
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#534)#### fn fmt(&self, fmt: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](trait.display#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/fmt/mod.rs.html#473)### impl<'a> Copy for Arguments<'a>
Auto Trait Implementations
--------------------------
### impl<'a> !RefUnwindSafe for Arguments<'a>
### impl<'a> !Send for Arguments<'a>
### impl<'a> !Sync for Arguments<'a>
### impl<'a> Unpin for Arguments<'a>
### impl<'a> !UnwindSafe for Arguments<'a>
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/alloc/string.rs.html#2500)### impl<T> ToString for Twhere T: [Display](trait.display "trait std::fmt::Display") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/alloc/string.rs.html#2506)#### default fn to\_string(&self) -> String
Converts the given value to a `String`. [Read more](../string/trait.tostring#tymethod.to_string)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Struct std::fmt::DebugMap Struct std::fmt::DebugMap
=========================
```
pub struct DebugMap<'a, 'b>where 'b: 'a,{ /* private fields */ }
```
A struct to help with [`fmt::Debug`](trait.debug) implementations.
This is useful when you wish to output a formatted map as a part of your [`Debug::fmt`](trait.debug#tymethod.fmt "Debug::fmt") implementation.
This can be constructed by the [`Formatter::debug_map`](struct.formatter#method.debug_map "Formatter::debug_map") method.
Examples
--------
```
use std::fmt;
struct Foo(Vec<(String, i32)>);
impl fmt::Debug for Foo {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fmt.debug_map().entries(self.0.iter().map(|&(ref k, ref v)| (k, v))).finish()
}
}
assert_eq!(
format!("{:?}", Foo(vec![("A".to_string(), 10), ("B".to_string(), 11)])),
"{\"A\": 10, \"B\": 11}",
);
```
Implementations
---------------
[source](https://doc.rust-lang.org/src/core/fmt/builders.rs.html#708)### impl<'a, 'b> DebugMap<'a, 'b>where 'b: 'a,
[source](https://doc.rust-lang.org/src/core/fmt/builders.rs.html#732)#### pub fn entry( &mut self, key: &dyn Debug, value: &dyn Debug) -> &mut DebugMap<'a, 'b>
Adds a new entry to the map output.
##### Examples
```
use std::fmt;
struct Foo(Vec<(String, i32)>);
impl fmt::Debug for Foo {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt.debug_map()
.entry(&"whole", &self.0) // We add the "whole" entry.
.finish()
}
}
assert_eq!(
format!("{:?}", Foo(vec![("A".to_string(), 10), ("B".to_string(), 11)])),
"{\"whole\": [(\"A\", 10), (\"B\", 11)]}",
);
```
[source](https://doc.rust-lang.org/src/core/fmt/builders.rs.html#768)1.42.0 · #### pub fn key(&mut self, key: &dyn Debug) -> &mut DebugMap<'a, 'b>
Adds the key part of a new entry to the map output.
This method, together with `value`, is an alternative to `entry` that can be used when the complete entry isn’t known upfront. Prefer the `entry` method when it’s possible to use.
##### Panics
`key` must be called before `value` and each call to `key` must be followed by a corresponding call to `value`. Otherwise this method will panic.
##### Examples
```
use std::fmt;
struct Foo(Vec<(String, i32)>);
impl fmt::Debug for Foo {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt.debug_map()
.key(&"whole").value(&self.0) // We add the "whole" entry.
.finish()
}
}
assert_eq!(
format!("{:?}", Foo(vec![("A".to_string(), 10), ("B".to_string(), 11)])),
"{\"whole\": [(\"A\", 10), (\"B\", 11)]}",
);
```
[source](https://doc.rust-lang.org/src/core/fmt/builders.rs.html#832)1.42.0 · #### pub fn value(&mut self, value: &dyn Debug) -> &mut DebugMap<'a, 'b>
Adds the value part of a new entry to the map output.
This method, together with `key`, is an alternative to `entry` that can be used when the complete entry isn’t known upfront. Prefer the `entry` method when it’s possible to use.
##### Panics
`key` must be called before `value` and each call to `key` must be followed by a corresponding call to `value`. Otherwise this method will panic.
##### Examples
```
use std::fmt;
struct Foo(Vec<(String, i32)>);
impl fmt::Debug for Foo {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt.debug_map()
.key(&"whole").value(&self.0) // We add the "whole" entry.
.finish()
}
}
assert_eq!(
format!("{:?}", Foo(vec![("A".to_string(), 10), ("B".to_string(), 11)])),
"{\"whole\": [(\"A\", 10), (\"B\", 11)]}",
);
```
[source](https://doc.rust-lang.org/src/core/fmt/builders.rs.html#878-882)#### pub fn entries<K, V, I>(&mut self, entries: I) -> &mut DebugMap<'a, 'b>where K: [Debug](trait.debug "trait std::fmt::Debug"), V: [Debug](trait.debug "trait std::fmt::Debug"), I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")<Item = [(K, V)](../primitive.tuple)>,
Adds the contents of an iterator of entries to the map output.
##### Examples
```
use std::fmt;
struct Foo(Vec<(String, i32)>);
impl fmt::Debug for Foo {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt.debug_map()
// We map our vec so each entries' first field will become
// the "key".
.entries(self.0.iter().map(|&(ref k, ref v)| (k, v)))
.finish()
}
}
assert_eq!(
format!("{:?}", Foo(vec![("A".to_string(), 10), ("B".to_string(), 11)])),
"{\"A\": 10, \"B\": 11}",
);
```
[source](https://doc.rust-lang.org/src/core/fmt/builders.rs.html#918)#### pub fn finish(&mut self) -> Result<(), Error>
Finishes output and returns any error encountered.
##### Panics
`key` must be called before `value` and each call to `key` must be followed by a corresponding call to `value`. Otherwise this method will panic.
##### Examples
```
use std::fmt;
struct Foo(Vec<(String, i32)>);
impl fmt::Debug for Foo {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt.debug_map()
.entries(self.0.iter().map(|&(ref k, ref v)| (k, v)))
.finish() // Ends the struct formatting.
}
}
assert_eq!(
format!("{:?}", Foo(vec![("A".to_string(), 10), ("B".to_string(), 11)])),
"{\"A\": 10, \"B\": 11}",
);
```
Auto Trait Implementations
--------------------------
### impl<'a, 'b> !RefUnwindSafe for DebugMap<'a, 'b>
### impl<'a, 'b> !Send for DebugMap<'a, 'b>
### impl<'a, 'b> !Sync for DebugMap<'a, 'b>
### impl<'a, 'b> Unpin for DebugMap<'a, 'b>where 'b: 'a,
### impl<'a, 'b> !UnwindSafe for DebugMap<'a, 'b>
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
rust Module std::backtrace Module std::backtrace
=====================
Support for capturing a stack backtrace of an OS thread
This module contains the support necessary to capture a stack backtrace of a running OS thread from the OS thread itself. The `Backtrace` type supports capturing a stack trace via the `Backtrace::capture` and `Backtrace::force_capture` functions.
A backtrace is typically quite handy to attach to errors (e.g. types implementing `std::error::Error`) to get a causal chain of where an error was generated.
### Accuracy
Backtraces are attempted to be as accurate as possible, but no guarantees are provided about the exact accuracy of a backtrace. Instruction pointers, symbol names, filenames, line numbers, etc, may all be incorrect when reported. Accuracy is attempted on a best-effort basis, however, and bugs are always welcome to indicate areas of improvement!
For most platforms a backtrace with a filename/line number requires that programs be compiled with debug information. Without debug information filenames/line numbers will not be reported.
### Platform support
Not all platforms that libstd compiles for support capturing backtraces. Some platforms simply do nothing when capturing a backtrace. To check whether the platform supports capturing backtraces you can consult the `BacktraceStatus` enum as a result of `Backtrace::status`.
Like above with accuracy platform support is done on a best effort basis. Sometimes libraries might not be available at runtime or something may go wrong which would cause a backtrace to not be captured. Please feel free to report issues with platforms where a backtrace cannot be captured though!
### Environment Variables
The `Backtrace::capture` function might not actually capture a backtrace by default. Its behavior is governed by two environment variables:
* `RUST_LIB_BACKTRACE` - if this is set to `0` then `Backtrace::capture` will never capture a backtrace. Any other value this is set to will enable `Backtrace::capture`.
* `RUST_BACKTRACE` - if `RUST_LIB_BACKTRACE` is not set, then this variable is consulted with the same rules of `RUST_LIB_BACKTRACE`.
* If neither of the above env vars are set, then `Backtrace::capture` will be disabled.
Capturing a backtrace can be a quite expensive runtime operation, so the environment variables allow either forcibly disabling this runtime performance hit or allow selectively enabling it in some programs.
Note that the `Backtrace::force_capture` function can be used to ignore these environment variables. Also note that the state of environment variables is cached once the first backtrace is created, so altering `RUST_LIB_BACKTRACE` or `RUST_BACKTRACE` at runtime might not actually change how backtraces are captured.
Structs
-------
[BacktraceFrame](struct.backtraceframe "std::backtrace::BacktraceFrame struct")Experimental
A single frame of a backtrace.
[Backtrace](struct.backtrace "std::backtrace::Backtrace struct")
A captured OS thread stack backtrace.
Enums
-----
[BacktraceStatus](enum.backtracestatus "std::backtrace::BacktraceStatus enum")
The current status of a backtrace, indicating whether it was captured or whether it is empty for some other reason.
rust Struct std::backtrace::Backtrace Struct std::backtrace::Backtrace
================================
```
pub struct Backtrace { /* private fields */ }
```
A captured OS thread stack backtrace.
This type represents a stack backtrace for an OS thread captured at a previous point in time. In some instances the `Backtrace` type may internally be empty due to configuration. For more information see `Backtrace::capture`.
Implementations
---------------
[source](https://doc.rust-lang.org/src/std/backtrace.rs.html#252-373)### impl Backtrace
[source](https://doc.rust-lang.org/src/std/backtrace.rs.html#294-299)#### pub fn capture() -> Backtrace
Capture a stack backtrace of the current thread.
This function will capture a stack backtrace of the current OS thread of execution, returning a `Backtrace` type which can be later used to print the entire stack trace or render it to a string.
This function will be a noop if the `RUST_BACKTRACE` or `RUST_LIB_BACKTRACE` backtrace variables are both not set. If either environment variable is set and enabled then this function will actually capture a backtrace. Capturing a backtrace can be both memory intensive and slow, so these environment variables allow liberally using `Backtrace::capture` and only incurring a slowdown when the environment variables are set.
To forcibly capture a backtrace regardless of environment variables, use the `Backtrace::force_capture` function.
[source](https://doc.rust-lang.org/src/std/backtrace.rs.html#313-315)#### pub fn force\_capture() -> Backtrace
Forcibly captures a full backtrace, regardless of environment variable configuration.
This function behaves the same as `capture` except that it ignores the values of the `RUST_BACKTRACE` and `RUST_LIB_BACKTRACE` environment variables, always capturing a backtrace.
Note that capturing a backtrace can be an expensive operation on some platforms, so this should be used with caution in performance-sensitive parts of code.
[source](https://doc.rust-lang.org/src/std/backtrace.rs.html#321-323)const: 1.65.0 · #### pub const fn disabled() -> Backtrace
Forcibly captures a disabled backtrace, regardless of environment variable configuration.
[source](https://doc.rust-lang.org/src/std/backtrace.rs.html#366-372)#### pub fn status(&self) -> BacktraceStatus
Returns the status of this backtrace, indicating whether this backtrace request was unsupported, disabled, or a stack trace was actually captured.
[source](https://doc.rust-lang.org/src/std/backtrace.rs.html#375-382)### impl<'a> Backtrace
[source](https://doc.rust-lang.org/src/std/backtrace.rs.html#379-381)#### pub fn frames(&'a self) -> &'a [BacktraceFrame]
🔬This is a nightly-only experimental API. (`backtrace_frames` [#79676](https://github.com/rust-lang/rust/issues/79676))
Returns an iterator over the backtrace frames.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/std/backtrace.rs.html#177-201)### impl Debug for Backtrace
[source](https://doc.rust-lang.org/src/std/backtrace.rs.html#178-200)#### fn fmt(&self, fmt: &mut Formatter<'\_>) -> Result
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/std/backtrace.rs.html#385-432)### impl Display for Backtrace
[source](https://doc.rust-lang.org/src/std/backtrace.rs.html#386-431)#### fn fmt(&self, fmt: &mut Formatter<'\_>) -> Result
Formats the value using the given formatter. [Read more](../fmt/trait.display#tymethod.fmt)
Auto Trait Implementations
--------------------------
### impl !RefUnwindSafe for Backtrace
### impl Send for Backtrace
### impl Sync for Backtrace
### impl Unpin for Backtrace
### impl UnwindSafe for Backtrace
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/alloc/string.rs.html#2500)### impl<T> ToString for Twhere T: [Display](../fmt/trait.display "trait std::fmt::Display") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/alloc/string.rs.html#2506)#### default fn to\_string(&self) -> String
Converts the given value to a `String`. [Read more](../string/trait.tostring#tymethod.to_string)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
rust Enum std::backtrace::BacktraceStatus Enum std::backtrace::BacktraceStatus
====================================
```
#[non_exhaustive]
pub enum BacktraceStatus {
Unsupported,
Disabled,
Captured,
}
```
The current status of a backtrace, indicating whether it was captured or whether it is empty for some other reason.
Variants (Non-exhaustive)
-------------------------
This enum is marked as non-exhaustiveNon-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.### `Unsupported`
Capturing a backtrace is not supported, likely because it’s not implemented for the current platform.
### `Disabled`
Capturing a backtrace has been disabled through either the `RUST_LIB_BACKTRACE` or `RUST_BACKTRACE` environment variables.
### `Captured`
A backtrace has been captured and the `Backtrace` should print reasonable information when rendered.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/std/backtrace.rs.html#117)### impl Debug for BacktraceStatus
[source](https://doc.rust-lang.org/src/std/backtrace.rs.html#117)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/std/backtrace.rs.html#117)### impl PartialEq<BacktraceStatus> for BacktraceStatus
[source](https://doc.rust-lang.org/src/std/backtrace.rs.html#117)#### fn eq(&self, other: &BacktraceStatus) -> bool
This method tests for `self` and `other` values to be equal, and is used by `==`. [Read more](../cmp/trait.partialeq#tymethod.eq)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#236)1.0.0 · #### fn ne(&self, other: &Rhs) -> bool
This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. [Read more](../cmp/trait.partialeq#method.ne)
[source](https://doc.rust-lang.org/src/std/backtrace.rs.html#117)### impl Eq for BacktraceStatus
[source](https://doc.rust-lang.org/src/std/backtrace.rs.html#117)### impl StructuralEq for BacktraceStatus
[source](https://doc.rust-lang.org/src/std/backtrace.rs.html#117)### impl StructuralPartialEq for BacktraceStatus
Auto Trait Implementations
--------------------------
### impl RefUnwindSafe for BacktraceStatus
### impl Send for BacktraceStatus
### impl Sync for BacktraceStatus
### impl Unpin for BacktraceStatus
### impl UnwindSafe for BacktraceStatus
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Struct std::backtrace::BacktraceFrame Struct std::backtrace::BacktraceFrame
=====================================
```
pub struct BacktraceFrame { /* private fields */ }
```
🔬This is a nightly-only experimental API. (`backtrace_frames` [#79676](https://github.com/rust-lang/rust/issues/79676))
A single frame of a backtrace.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/std/backtrace.rs.html#204-210)### impl Debug for BacktraceFrame
[source](https://doc.rust-lang.org/src/std/backtrace.rs.html#205-209)#### fn fmt(&self, fmt: &mut Formatter<'\_>) -> Result
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
Auto Trait Implementations
--------------------------
### impl RefUnwindSafe for BacktraceFrame
### impl Send for BacktraceFrame
### impl Sync for BacktraceFrame
### impl Unpin for BacktraceFrame
### impl UnwindSafe for BacktraceFrame
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
rust Struct std::slice::Chunks Struct std::slice::Chunks
=========================
```
pub struct Chunks<'a, T>where T: 'a,{ /* private fields */ }
```
An iterator over a slice in (non-overlapping) chunks (`chunk_size` elements at a time), starting at the beginning of the slice.
When the slice len is not evenly divided by the chunk size, the last slice of the iteration will be the remainder.
This struct is created by the [`chunks`](../primitive.slice#method.chunks) method on [slices](../primitive.slice).
Example
-------
```
let slice = ['l', 'o', 'r', 'e', 'm'];
let iter = slice.chunks(2);
```
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1461)### impl<T> Clone for Chunks<'\_, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1462)#### fn clone(&self) -> Chunks<'\_, T>
Notable traits for [Chunks](struct.chunks "struct std::slice::Chunks")<'a, T>
```
impl<'a, T> Iterator for Chunks<'a, T>
type Item = &'a [T];
```
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)#### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1444)### impl<'a, T> Debug for Chunks<'a, T>where T: 'a + [Debug](../fmt/trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1444)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1544)### impl<'a, T> DoubleEndedIterator for Chunks<'a, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1546)#### fn next\_back(&mut self) -> Option<&'a [T]>
Removes and returns an element from the end of the iterator. [Read more](../iter/trait.doubleendediterator#tymethod.next_back)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1573)#### fn nth\_back(&mut self, n: usize) -> Option<<Chunks<'a, T> as Iterator>::Item>
Returns the `n`th element from the end of the iterator. [Read more](../iter/trait.doubleendediterator#method.nth_back)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#134)#### fn advance\_back\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator from the back by `n` elements. [Read more](../iter/trait.doubleendediterator#method.advance_back_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#221-225)1.27.0 · #### fn try\_rfold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
This is the reverse version of [`Iterator::try_fold()`](../iter/trait.iterator#method.try_fold "Iterator::try_fold()"): it takes elements starting from the back of the iterator. [Read more](../iter/trait.doubleendediterator#method.try_rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#292-295)1.27.0 · #### fn rfold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
An iterator method that reduces the iterator’s elements to a single, final value, starting from the back. [Read more](../iter/trait.doubleendediterator#method.rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#347-350)1.27.0 · #### fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator from the back that satisfies a predicate. [Read more](../iter/trait.doubleendediterator#method.rfind)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1592)### impl<T> ExactSizeIterator for Chunks<'\_, T>
[source](https://doc.rust-lang.org/src/core/iter/traits/exact_size.rs.html#106)#### fn len(&self) -> usize
Returns the exact remaining length of the iterator. [Read more](../iter/trait.exactsizeiterator#method.len)
[source](https://doc.rust-lang.org/src/core/iter/traits/exact_size.rs.html#138)#### fn is\_empty(&self) -> bool
🔬This is a nightly-only experimental API. (`exact_size_is_empty` [#35428](https://github.com/rust-lang/rust/issues/35428))
Returns `true` if the iterator is empty. [Read more](../iter/trait.exactsizeiterator#method.is_empty)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1468)### impl<'a, T> Iterator for Chunks<'a, T>
#### type Item = &'a [T]
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1472)#### fn next(&mut self) -> Option<&'a [T]>
Advances the iterator and returns the next value. [Read more](../iter/trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1484)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](../iter/trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1496)#### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](../iter/trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1501)#### fn nth(&mut self, n: usize) -> Option<<Chunks<'a, T> as Iterator>::Item>
Returns the `n`th element of the iterator. [Read more](../iter/trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1518)#### fn last(self) -> Option<<Chunks<'a, T> as Iterator>::Item>
Consumes the iterator, returning the last element. [Read more](../iter/trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](../iter/trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#328)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](../iter/trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](../iter/struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](../iter/trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)#### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](../iter/struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](../iter/trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)#### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](../iter/struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](../iter/trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](../iter/struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](../iter/trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)#### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](../iter/struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](../iter/trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](../iter/trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)#### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](../iter/struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](../iter/trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)#### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](../iter/struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](../iter/trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)#### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](../iter/struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](../iter/trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)#### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](../iter/struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](../iter/struct.peekable#method.peek) and [`peek_mut`](../iter/struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](../iter/trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)#### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](../iter/struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](../iter/trait.iterator#method.skip)s elements based on a predicate. [Read more](../iter/trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)#### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](../iter/struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](../iter/trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](../iter/struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](../iter/trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)#### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](../iter/struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](../iter/trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)#### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](../iter/struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](../iter/trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)#### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](../iter/struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](../iter/trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](../iter/trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)#### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](../iter/struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](../iter/trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)#### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](../iter/struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](../iter/trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)#### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](../iter/struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](../iter/trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)#### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](../iter/trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)#### fn collect<B>(self) -> Bwhere B: [FromIterator](../iter/trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](../iter/trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](../iter/trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)#### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](../iter/trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2079-2082)#### fn partition\_in\_place<'a, T, P>(self, predicate: P) -> usizewhere T: 'a, Self: [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator")<Item = [&'a mut](../primitive.reference) T>, P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_partition_in_place` [#62543](https://github.com/rust-lang/rust/issues/62543))
Reorders the elements of this iterator *in-place* according to the given predicate, such that all those that return `true` precede all those that return `false`. Returns the number of `true` elements found. [Read more](../iter/trait.iterator#method.partition_in_place)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](../iter/trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2230-2234)1.27.0 · #### fn try\_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](../iter/trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](../iter/trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2407-2410)#### fn fold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](../iter/trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](../iter/trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](../iter/trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)#### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)#### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)#### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](../iter/trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](../iter/trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](../iter/trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)#### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](../iter/trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2920-2923)#### fn rposition<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool), Self: [ExactSizeIterator](../iter/trait.exactsizeiterator "trait std::iter::ExactSizeIterator") + [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
Searches for an element in an iterator from the right, returning its index. [Read more](../iter/trait.iterator#method.rposition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](../iter/trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](../iter/trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3161-3163)#### fn rev(self) -> Rev<Self>where Self: [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
Notable traits for [Rev](../iter/struct.rev "struct std::iter::Rev")<I>
```
impl<I> Iterator for Rev<I>where
I: DoubleEndedIterator,
type Item = <I as Iterator>::Item;
```
Reverses an iterator’s direction. [Read more](../iter/trait.iterator#method.rev)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)#### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](../iter/trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](../iter/struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](../iter/trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)#### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](../iter/struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](../iter/trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3312-3314)#### fn cycle(self) -> Cycle<Self>where Self: [Clone](../clone/trait.clone "trait std::clone::Clone"),
Notable traits for [Cycle](../iter/struct.cycle "struct std::iter::Cycle")<I>
```
impl<I> Iterator for Cycle<I>where
I: Clone + Iterator,
type Item = <I as Iterator>::Item;
```
Repeats an iterator endlessly. [Read more](../iter/trait.iterator#method.cycle)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](../iter/struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](../iter/trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](../iter/trait.sum "trait std::iter::Sum")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](../iter/trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](../iter/trait.product "trait std::iter::Product")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](../iter/trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another. [Read more](../iter/trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another. [Read more](../iter/trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](../iter/trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are unequal to those of another. [Read more](../iter/trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](../iter/trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](../iter/trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](../iter/trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](../iter/trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](../iter/trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](../iter/trait.iterator#method.is_sorted_by_key)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1598)1.26.0 · ### impl<T> FusedIterator for Chunks<'\_, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1595)### impl<T> TrustedLen for Chunks<'\_, T>
Auto Trait Implementations
--------------------------
### impl<'a, T> RefUnwindSafe for Chunks<'a, T>where T: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<'a, T> Send for Chunks<'a, T>where T: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<'a, T> Sync for Chunks<'a, T>where T: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<'a, T> Unpin for Chunks<'a, T>
### impl<'a, T> UnwindSafe for Chunks<'a, T>where T: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](../iter/trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](../iter/trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Struct std::slice::RChunksExactMut Struct std::slice::RChunksExactMut
==================================
```
pub struct RChunksExactMut<'a, T>where T: 'a,{ /* private fields */ }
```
An iterator over a slice in (non-overlapping) mutable chunks (`chunk_size` elements at a time), starting at the end of the slice.
When the slice len is not evenly divided by the chunk size, the last up to `chunk_size-1` elements will be omitted but can be retrieved from the [`into_remainder`](struct.chunksexactmut#method.into_remainder) function from the iterator.
This struct is created by the [`rchunks_exact_mut`](../primitive.slice#method.rchunks_exact_mut) method on [slices](../primitive.slice).
Example
-------
```
let mut slice = ['l', 'o', 'r', 'e', 'm'];
let iter = slice.rchunks_exact_mut(2);
```
Implementations
---------------
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#3052)### impl<'a, T> RChunksExactMut<'a, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#3066)#### pub fn into\_remainder(self) -> &'a mut [T]
Notable traits for &[[u8](../primitive.u8)]
```
impl Read for &[u8]
impl Write for &mut [u8]
```
Returns the remainder of the original slice that is not going to be returned by the iterator. The returned slice has at most `chunk_size-1` elements.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#3037)### impl<'a, T> Debug for RChunksExactMut<'a, T>where T: 'a + [Debug](../fmt/trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#3037)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#3129)### impl<'a, T> DoubleEndedIterator for RChunksExactMut<'a, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#3131)#### fn next\_back(&mut self) -> Option<&'a mut [T]>
Removes and returns an element from the end of the iterator. [Read more](../iter/trait.doubleendediterator#tymethod.next_back)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#3144)#### fn nth\_back( &mut self, n: usize) -> Option<<RChunksExactMut<'a, T> as Iterator>::Item>
Returns the `n`th element from the end of the iterator. [Read more](../iter/trait.doubleendediterator#method.nth_back)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#134)#### fn advance\_back\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator from the back by `n` elements. [Read more](../iter/trait.doubleendediterator#method.advance_back_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#221-225)1.27.0 · #### fn try\_rfold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
This is the reverse version of [`Iterator::try_fold()`](../iter/trait.iterator#method.try_fold "Iterator::try_fold()"): it takes elements starting from the back of the iterator. [Read more](../iter/trait.doubleendediterator#method.try_rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#292-295)1.27.0 · #### fn rfold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
An iterator method that reduces the iterator’s elements to a single, final value, starting from the back. [Read more](../iter/trait.doubleendediterator#method.rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#347-350)1.27.0 · #### fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator from the back that satisfies a predicate. [Read more](../iter/trait.doubleendediterator#method.rfind)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#3167)### impl<T> ExactSizeIterator for RChunksExactMut<'\_, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#3168)#### fn is\_empty(&self) -> bool
🔬This is a nightly-only experimental API. (`exact_size_is_empty` [#35428](https://github.com/rust-lang/rust/issues/35428))
Returns `true` if the iterator is empty. [Read more](../iter/trait.exactsizeiterator#method.is_empty)
[source](https://doc.rust-lang.org/src/core/iter/traits/exact_size.rs.html#106)1.0.0 · #### fn len(&self) -> usize
Returns the exact remaining length of the iterator. [Read more](../iter/trait.exactsizeiterator#method.len)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#3072)### impl<'a, T> Iterator for RChunksExactMut<'a, T>
#### type Item = &'a mut [T]
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#3076)#### fn next(&mut self) -> Option<&'a mut [T]>
Advances the iterator and returns the next value. [Read more](../iter/trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#3090)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](../iter/trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#3096)#### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](../iter/trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#3101)#### fn nth(&mut self, n: usize) -> Option<&'a mut [T]>
Returns the `n`th element of the iterator. [Read more](../iter/trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#3116)#### fn last(self) -> Option<<RChunksExactMut<'a, T> as Iterator>::Item>
Consumes the iterator, returning the last element. [Read more](../iter/trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](../iter/trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#328)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](../iter/trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](../iter/struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](../iter/trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)1.0.0 · #### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](../iter/struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](../iter/trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)1.0.0 · #### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](../iter/struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](../iter/trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](../iter/struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](../iter/trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)1.0.0 · #### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](../iter/struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](../iter/trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](../iter/trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)1.0.0 · #### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](../iter/struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](../iter/trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)1.0.0 · #### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](../iter/struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](../iter/trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)1.0.0 · #### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](../iter/struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](../iter/trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)1.0.0 · #### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](../iter/struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](../iter/struct.peekable#method.peek) and [`peek_mut`](../iter/struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](../iter/trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)1.0.0 · #### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](../iter/struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](../iter/trait.iterator#method.skip)s elements based on a predicate. [Read more](../iter/trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)1.0.0 · #### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](../iter/struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](../iter/trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](../iter/struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](../iter/trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)1.0.0 · #### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](../iter/struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](../iter/trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)1.0.0 · #### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](../iter/struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](../iter/trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)1.0.0 · #### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](../iter/struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](../iter/trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](../iter/trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)1.0.0 · #### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](../iter/struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](../iter/trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)1.0.0 · #### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](../iter/struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](../iter/trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)1.0.0 · #### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](../iter/struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](../iter/trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)1.0.0 · #### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](../iter/trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)1.0.0 · #### fn collect<B>(self) -> Bwhere B: [FromIterator](../iter/trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](../iter/trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](../iter/trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)1.0.0 · #### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](../iter/trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2079-2082)#### fn partition\_in\_place<'a, T, P>(self, predicate: P) -> usizewhere T: 'a, Self: [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator")<Item = [&'a mut](../primitive.reference) T>, P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_partition_in_place` [#62543](https://github.com/rust-lang/rust/issues/62543))
Reorders the elements of this iterator *in-place* according to the given predicate, such that all those that return `true` precede all those that return `false`. Returns the number of `true` elements found. [Read more](../iter/trait.iterator#method.partition_in_place)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](../iter/trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2230-2234)1.27.0 · #### fn try\_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](../iter/trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](../iter/trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2407-2410)1.0.0 · #### fn fold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](../iter/trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](../iter/trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](../iter/trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)1.0.0 · #### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)1.0.0 · #### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)1.0.0 · #### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](../iter/trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](../iter/trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](../iter/trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)1.0.0 · #### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](../iter/trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2920-2923)1.0.0 · #### fn rposition<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool), Self: [ExactSizeIterator](../iter/trait.exactsizeiterator "trait std::iter::ExactSizeIterator") + [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
Searches for an element in an iterator from the right, returning its index. [Read more](../iter/trait.iterator#method.rposition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](../iter/trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](../iter/trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3161-3163)1.0.0 · #### fn rev(self) -> Rev<Self>where Self: [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
Notable traits for [Rev](../iter/struct.rev "struct std::iter::Rev")<I>
```
impl<I> Iterator for Rev<I>where
I: DoubleEndedIterator,
type Item = <I as Iterator>::Item;
```
Reverses an iterator’s direction. [Read more](../iter/trait.iterator#method.rev)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)1.0.0 · #### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](../iter/trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](../iter/struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](../iter/trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)1.0.0 · #### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](../iter/struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](../iter/trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](../iter/struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](../iter/trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](../iter/trait.sum "trait std::iter::Sum")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](../iter/trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](../iter/trait.product "trait std::iter::Product")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](../iter/trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another. [Read more](../iter/trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another. [Read more](../iter/trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](../iter/trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are unequal to those of another. [Read more](../iter/trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](../iter/trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](../iter/trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](../iter/trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](../iter/trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](../iter/trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](../iter/trait.iterator#method.is_sorted_by_key)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#3177)### impl<T> FusedIterator for RChunksExactMut<'\_, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#3190)### impl<T> Send for RChunksExactMut<'\_, T>where T: [Send](../marker/trait.send "trait std::marker::Send"),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#3193)### impl<T> Sync for RChunksExactMut<'\_, T>where T: [Sync](../marker/trait.sync "trait std::marker::Sync"),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#3174)### impl<T> TrustedLen for RChunksExactMut<'\_, T>
Auto Trait Implementations
--------------------------
### impl<'a, T> RefUnwindSafe for RChunksExactMut<'a, T>where T: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<'a, T> Unpin for RChunksExactMut<'a, T>
### impl<'a, T> !UnwindSafe for RChunksExactMut<'a, T>
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](../iter/trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](../iter/trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Struct std::slice::GroupByMut Struct std::slice::GroupByMut
=============================
```
pub struct GroupByMut<'a, T, P>where T: 'a,{ /* private fields */ }
```
🔬This is a nightly-only experimental API. (`slice_group_by` [#80552](https://github.com/rust-lang/rust/issues/80552))
An iterator over slice in (non-overlapping) mutable chunks separated by a predicate.
This struct is created by the [`group_by_mut`](../primitive.slice#method.group_by_mut) method on [slices](../primitive.slice).
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#3384)### impl<'a, T, P> Debug for GroupByMut<'a, T, P>where T: 'a + [Debug](../fmt/trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#3385)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#3358)### impl<'a, T, P> DoubleEndedIterator for GroupByMut<'a, T, P>where T: 'a, P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T, [&](../primitive.reference)T) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#3363)#### fn next\_back(&mut self) -> Option<<GroupByMut<'a, T, P> as Iterator>::Item>
Removes and returns an element from the end of the iterator. [Read more](../iter/trait.doubleendediterator#tymethod.next_back)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#134)#### fn advance\_back\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator from the back by `n` elements. [Read more](../iter/trait.doubleendediterator#method.advance_back_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#184)1.37.0 · #### fn nth\_back(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element from the end of the iterator. [Read more](../iter/trait.doubleendediterator#method.nth_back)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#221-225)1.27.0 · #### fn try\_rfold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
This is the reverse version of [`Iterator::try_fold()`](../iter/trait.iterator#method.try_fold "Iterator::try_fold()"): it takes elements starting from the back of the iterator. [Read more](../iter/trait.doubleendediterator#method.try_rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#292-295)1.27.0 · #### fn rfold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
An iterator method that reduces the iterator’s elements to a single, final value, starting from the back. [Read more](../iter/trait.doubleendediterator#method.rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#347-350)1.27.0 · #### fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator from the back that satisfies a predicate. [Read more](../iter/trait.doubleendediterator#method.rfind)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#3323)### impl<'a, T, P> Iterator for GroupByMut<'a, T, P>where T: 'a, P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T, [&](../primitive.reference)T) -> [bool](../primitive.bool),
#### type Item = &'a mut [T]
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#3330)#### fn next(&mut self) -> Option<<GroupByMut<'a, T, P> as Iterator>::Item>
Advances the iterator and returns the next value. [Read more](../iter/trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#3347)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](../iter/trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#3352)#### fn last(self) -> Option<<GroupByMut<'a, T, P> as Iterator>::Item>
Consumes the iterator, returning the last element. [Read more](../iter/trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](../iter/trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#252-254)1.0.0 · #### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](../iter/trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#328)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](../iter/trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#376)1.0.0 · #### fn nth(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element of the iterator. [Read more](../iter/trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](../iter/struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](../iter/trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)1.0.0 · #### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](../iter/struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](../iter/trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)1.0.0 · #### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](../iter/struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](../iter/trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](../iter/struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](../iter/trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)1.0.0 · #### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](../iter/struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](../iter/trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](../iter/trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)1.0.0 · #### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](../iter/struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](../iter/trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)1.0.0 · #### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](../iter/struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](../iter/trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)1.0.0 · #### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](../iter/struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](../iter/trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)1.0.0 · #### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](../iter/struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](../iter/struct.peekable#method.peek) and [`peek_mut`](../iter/struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](../iter/trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)1.0.0 · #### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](../iter/struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](../iter/trait.iterator#method.skip)s elements based on a predicate. [Read more](../iter/trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)1.0.0 · #### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](../iter/struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](../iter/trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](../iter/struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](../iter/trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)1.0.0 · #### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](../iter/struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](../iter/trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)1.0.0 · #### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](../iter/struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](../iter/trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)1.0.0 · #### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](../iter/struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](../iter/trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](../iter/trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)1.0.0 · #### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](../iter/struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](../iter/trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)1.0.0 · #### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](../iter/struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](../iter/trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)1.0.0 · #### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](../iter/struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](../iter/trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)1.0.0 · #### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](../iter/trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)1.0.0 · #### fn collect<B>(self) -> Bwhere B: [FromIterator](../iter/trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](../iter/trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](../iter/trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)1.0.0 · #### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](../iter/trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2079-2082)#### fn partition\_in\_place<'a, T, P>(self, predicate: P) -> usizewhere T: 'a, Self: [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator")<Item = [&'a mut](../primitive.reference) T>, P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_partition_in_place` [#62543](https://github.com/rust-lang/rust/issues/62543))
Reorders the elements of this iterator *in-place* according to the given predicate, such that all those that return `true` precede all those that return `false`. Returns the number of `true` elements found. [Read more](../iter/trait.iterator#method.partition_in_place)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](../iter/trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2230-2234)1.27.0 · #### fn try\_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](../iter/trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](../iter/trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2407-2410)1.0.0 · #### fn fold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](../iter/trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](../iter/trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](../iter/trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)1.0.0 · #### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)1.0.0 · #### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)1.0.0 · #### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](../iter/trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](../iter/trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](../iter/trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)1.0.0 · #### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](../iter/trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](../iter/trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](../iter/trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3161-3163)1.0.0 · #### fn rev(self) -> Rev<Self>where Self: [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
Notable traits for [Rev](../iter/struct.rev "struct std::iter::Rev")<I>
```
impl<I> Iterator for Rev<I>where
I: DoubleEndedIterator,
type Item = <I as Iterator>::Item;
```
Reverses an iterator’s direction. [Read more](../iter/trait.iterator#method.rev)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)1.0.0 · #### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](../iter/trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](../iter/struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](../iter/trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)1.0.0 · #### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](../iter/struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](../iter/trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](../iter/struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](../iter/trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](../iter/trait.sum "trait std::iter::Sum")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](../iter/trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](../iter/trait.product "trait std::iter::Product")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](../iter/trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another. [Read more](../iter/trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another. [Read more](../iter/trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](../iter/trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are unequal to those of another. [Read more](../iter/trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](../iter/trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](../iter/trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](../iter/trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](../iter/trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](../iter/trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](../iter/trait.iterator#method.is_sorted_by_key)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#3381)### impl<'a, T, P> FusedIterator for GroupByMut<'a, T, P>where T: 'a, P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T, [&](../primitive.reference)T) -> [bool](../primitive.bool),
Auto Trait Implementations
--------------------------
### impl<'a, T, P> RefUnwindSafe for GroupByMut<'a, T, P>where P: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"), T: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<'a, T, P> Send for GroupByMut<'a, T, P>where P: [Send](../marker/trait.send "trait std::marker::Send"), T: [Send](../marker/trait.send "trait std::marker::Send"),
### impl<'a, T, P> Sync for GroupByMut<'a, T, P>where P: [Sync](../marker/trait.sync "trait std::marker::Sync"), T: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<'a, T, P> Unpin for GroupByMut<'a, T, P>where P: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"),
### impl<'a, T, P> !UnwindSafe for GroupByMut<'a, T, P>
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](../iter/trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](../iter/trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Struct std::slice::GroupBy Struct std::slice::GroupBy
==========================
```
pub struct GroupBy<'a, T, P>where T: 'a,{ /* private fields */ }
```
🔬This is a nightly-only experimental API. (`slice_group_by` [#80552](https://github.com/rust-lang/rust/issues/80552))
An iterator over slice in (non-overlapping) chunks separated by a predicate.
This struct is created by the [`group_by`](../primitive.slice#method.group_by) method on [slices](../primitive.slice).
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#3295)### impl<'a, T, P> Debug for GroupBy<'a, T, P>where T: 'a + [Debug](../fmt/trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#3296)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#3270)### impl<'a, T, P> DoubleEndedIterator for GroupBy<'a, T, P>where T: 'a, P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T, [&](../primitive.reference)T) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#3275)#### fn next\_back(&mut self) -> Option<<GroupBy<'a, T, P> as Iterator>::Item>
Removes and returns an element from the end of the iterator. [Read more](../iter/trait.doubleendediterator#tymethod.next_back)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#134)#### fn advance\_back\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator from the back by `n` elements. [Read more](../iter/trait.doubleendediterator#method.advance_back_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#184)1.37.0 · #### fn nth\_back(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element from the end of the iterator. [Read more](../iter/trait.doubleendediterator#method.nth_back)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#221-225)1.27.0 · #### fn try\_rfold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
This is the reverse version of [`Iterator::try_fold()`](../iter/trait.iterator#method.try_fold "Iterator::try_fold()"): it takes elements starting from the back of the iterator. [Read more](../iter/trait.doubleendediterator#method.try_rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#292-295)1.27.0 · #### fn rfold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
An iterator method that reduces the iterator’s elements to a single, final value, starting from the back. [Read more](../iter/trait.doubleendediterator#method.rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#347-350)1.27.0 · #### fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator from the back that satisfies a predicate. [Read more](../iter/trait.doubleendediterator#method.rfind)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#3236)### impl<'a, T, P> Iterator for GroupBy<'a, T, P>where T: 'a, P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T, [&](../primitive.reference)T) -> [bool](../primitive.bool),
#### type Item = &'a [T]
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#3243)#### fn next(&mut self) -> Option<<GroupBy<'a, T, P> as Iterator>::Item>
Advances the iterator and returns the next value. [Read more](../iter/trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#3259)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](../iter/trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#3264)#### fn last(self) -> Option<<GroupBy<'a, T, P> as Iterator>::Item>
Consumes the iterator, returning the last element. [Read more](../iter/trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](../iter/trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#252-254)1.0.0 · #### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](../iter/trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#328)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](../iter/trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#376)1.0.0 · #### fn nth(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element of the iterator. [Read more](../iter/trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](../iter/struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](../iter/trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)1.0.0 · #### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](../iter/struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](../iter/trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)1.0.0 · #### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](../iter/struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](../iter/trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](../iter/struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](../iter/trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)1.0.0 · #### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](../iter/struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](../iter/trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](../iter/trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)1.0.0 · #### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](../iter/struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](../iter/trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)1.0.0 · #### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](../iter/struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](../iter/trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)1.0.0 · #### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](../iter/struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](../iter/trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)1.0.0 · #### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](../iter/struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](../iter/struct.peekable#method.peek) and [`peek_mut`](../iter/struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](../iter/trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)1.0.0 · #### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](../iter/struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](../iter/trait.iterator#method.skip)s elements based on a predicate. [Read more](../iter/trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)1.0.0 · #### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](../iter/struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](../iter/trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](../iter/struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](../iter/trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)1.0.0 · #### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](../iter/struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](../iter/trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)1.0.0 · #### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](../iter/struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](../iter/trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)1.0.0 · #### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](../iter/struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](../iter/trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](../iter/trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)1.0.0 · #### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](../iter/struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](../iter/trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)1.0.0 · #### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](../iter/struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](../iter/trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)1.0.0 · #### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](../iter/struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](../iter/trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)1.0.0 · #### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](../iter/trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)1.0.0 · #### fn collect<B>(self) -> Bwhere B: [FromIterator](../iter/trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](../iter/trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](../iter/trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)1.0.0 · #### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](../iter/trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2079-2082)#### fn partition\_in\_place<'a, T, P>(self, predicate: P) -> usizewhere T: 'a, Self: [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator")<Item = [&'a mut](../primitive.reference) T>, P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_partition_in_place` [#62543](https://github.com/rust-lang/rust/issues/62543))
Reorders the elements of this iterator *in-place* according to the given predicate, such that all those that return `true` precede all those that return `false`. Returns the number of `true` elements found. [Read more](../iter/trait.iterator#method.partition_in_place)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](../iter/trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2230-2234)1.27.0 · #### fn try\_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](../iter/trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](../iter/trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2407-2410)1.0.0 · #### fn fold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](../iter/trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](../iter/trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](../iter/trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)1.0.0 · #### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)1.0.0 · #### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)1.0.0 · #### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](../iter/trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](../iter/trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](../iter/trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)1.0.0 · #### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](../iter/trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](../iter/trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](../iter/trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3161-3163)1.0.0 · #### fn rev(self) -> Rev<Self>where Self: [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
Notable traits for [Rev](../iter/struct.rev "struct std::iter::Rev")<I>
```
impl<I> Iterator for Rev<I>where
I: DoubleEndedIterator,
type Item = <I as Iterator>::Item;
```
Reverses an iterator’s direction. [Read more](../iter/trait.iterator#method.rev)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)1.0.0 · #### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](../iter/trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](../iter/struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](../iter/trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)1.0.0 · #### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](../iter/struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](../iter/trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](../iter/struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](../iter/trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](../iter/trait.sum "trait std::iter::Sum")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](../iter/trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](../iter/trait.product "trait std::iter::Product")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](../iter/trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another. [Read more](../iter/trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another. [Read more](../iter/trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](../iter/trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are unequal to those of another. [Read more](../iter/trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](../iter/trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](../iter/trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](../iter/trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](../iter/trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](../iter/trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](../iter/trait.iterator#method.is_sorted_by_key)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#3292)### impl<'a, T, P> FusedIterator for GroupBy<'a, T, P>where T: 'a, P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T, [&](../primitive.reference)T) -> [bool](../primitive.bool),
Auto Trait Implementations
--------------------------
### impl<'a, T, P> RefUnwindSafe for GroupBy<'a, T, P>where P: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"), T: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<'a, T, P> Send for GroupBy<'a, T, P>where P: [Send](../marker/trait.send "trait std::marker::Send"), T: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<'a, T, P> Sync for GroupBy<'a, T, P>where P: [Sync](../marker/trait.sync "trait std::marker::Sync"), T: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<'a, T, P> Unpin for GroupBy<'a, T, P>where P: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"),
### impl<'a, T, P> UnwindSafe for GroupBy<'a, T, P>where P: [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"), T: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](../iter/trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](../iter/trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Function std::slice::from_raw_parts_mut Function std::slice::from\_raw\_parts\_mut
==========================================
```
pub unsafe fn from_raw_parts_mut<'a, T>(data: *mut T, len: usize) -> &'a mut [T]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
```
Performs the same functionality as [`from_raw_parts`](fn.from_raw_parts "from_raw_parts"), except that a mutable slice is returned.
Safety
------
Behavior is undefined if any of the following conditions are violated:
* `data` must be [valid](../ptr/index#safety) for both reads and writes for `len * mem::size_of::<T>()` many bytes, and it must be properly aligned. This means in particular:
+ The entire memory range of this slice must be contained within a single allocated object! Slices can never span across multiple allocated objects.
+ `data` must be non-null and aligned even for zero-length slices. One reason for this is that enum layout optimizations may rely on references (including slices of any length) being aligned and non-null to distinguish them from other data. You can obtain a pointer that is usable as `data` for zero-length slices using [`NonNull::dangling()`](../ptr/struct.nonnull#method.dangling).
* `data` must point to `len` consecutive properly initialized values of type `T`.
* The memory referenced by the returned slice must not be accessed through any other pointer (not derived from the return value) for the duration of lifetime `'a`. Both read and write accesses are forbidden.
* The total size `len * mem::size_of::<T>()` of the slice must be no larger than `isize::MAX`. See the safety documentation of [`pointer::offset`](../primitive.pointer#method.offset "pointer::offset").
rust Struct std::slice::SplitN Struct std::slice::SplitN
=========================
```
pub struct SplitN<'a, T, P>where T: 'a, P: FnMut(&T) -> bool,{ /* private fields */ }
```
An iterator over subslices separated by elements that match a predicate function, limited to a given number of splits.
This struct is created by the [`splitn`](../primitive.slice#method.splitn) method on [slices](../primitive.slice).
Example
-------
```
let slice = [10, 40, 30, 20, 60, 50];
let iter = slice.splitn(2, |num| *num % 3 == 0);
```
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1147)1.9.0 · ### impl<T, P> Debug for SplitN<'\_, T, P>where T: [Debug](../fmt/trait.debug "trait std::fmt::Debug"), P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1151)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1278)### impl<'a, T, P> Iterator for SplitN<'a, T, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
#### type Item = &'a [T]
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1278)#### fn next(&mut self) -> Option<&'a [T]>
Advances the iterator and returns the next value. [Read more](../iter/trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1278)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](../iter/trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](../iter/trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#252-254)#### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](../iter/trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#282-284)#### fn last(self) -> Option<Self::Item>
Consumes the iterator, returning the last element. [Read more](../iter/trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#328)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](../iter/trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#376)#### fn nth(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element of the iterator. [Read more](../iter/trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](../iter/struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](../iter/trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)#### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](../iter/struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](../iter/trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)#### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](../iter/struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](../iter/trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](../iter/struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](../iter/trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)#### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](../iter/struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](../iter/trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](../iter/trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)#### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](../iter/struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](../iter/trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)#### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](../iter/struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](../iter/trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)#### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](../iter/struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](../iter/trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)#### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](../iter/struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](../iter/struct.peekable#method.peek) and [`peek_mut`](../iter/struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](../iter/trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)#### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](../iter/struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](../iter/trait.iterator#method.skip)s elements based on a predicate. [Read more](../iter/trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)#### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](../iter/struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](../iter/trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](../iter/struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](../iter/trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)#### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](../iter/struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](../iter/trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)#### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](../iter/struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](../iter/trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)#### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](../iter/struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](../iter/trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](../iter/trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)#### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](../iter/struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](../iter/trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)#### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](../iter/struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](../iter/trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)#### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](../iter/struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](../iter/trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)#### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](../iter/trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)#### fn collect<B>(self) -> Bwhere B: [FromIterator](../iter/trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](../iter/trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](../iter/trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)#### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](../iter/trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](../iter/trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2230-2234)1.27.0 · #### fn try\_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](../iter/trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](../iter/trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2407-2410)#### fn fold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](../iter/trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](../iter/trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](../iter/trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)#### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)#### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)#### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](../iter/trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](../iter/trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](../iter/trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)#### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](../iter/trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](../iter/trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](../iter/trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)#### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](../iter/trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](../iter/struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](../iter/trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)#### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](../iter/struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](../iter/trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](../iter/struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](../iter/trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](../iter/trait.sum "trait std::iter::Sum")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](../iter/trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](../iter/trait.product "trait std::iter::Product")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](../iter/trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another. [Read more](../iter/trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another. [Read more](../iter/trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](../iter/trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are unequal to those of another. [Read more](../iter/trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](../iter/trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](../iter/trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](../iter/trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](../iter/trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](../iter/trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](../iter/trait.iterator#method.is_sorted_by_key)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1278)1.26.0 · ### impl<'a, T, P> FusedIterator for SplitN<'a, T, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
Auto Trait Implementations
--------------------------
### impl<'a, T, P> RefUnwindSafe for SplitN<'a, T, P>where P: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"), T: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<'a, T, P> Send for SplitN<'a, T, P>where P: [Send](../marker/trait.send "trait std::marker::Send"), T: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<'a, T, P> Sync for SplitN<'a, T, P>where P: [Sync](../marker/trait.sync "trait std::marker::Sync"), T: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<'a, T, P> Unpin for SplitN<'a, T, P>where P: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"),
### impl<'a, T, P> UnwindSafe for SplitN<'a, T, P>where P: [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"), T: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](../iter/trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](../iter/trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Struct std::slice::ChunksExact Struct std::slice::ChunksExact
==============================
```
pub struct ChunksExact<'a, T>where T: 'a,{ /* private fields */ }
```
An iterator over a slice in (non-overlapping) chunks (`chunk_size` elements at a time), starting at the beginning of the slice.
When the slice len is not evenly divided by the chunk size, the last up to `chunk_size-1` elements will be omitted but can be retrieved from the [`remainder`](struct.chunksexact#method.remainder) function from the iterator.
This struct is created by the [`chunks_exact`](../primitive.slice#method.chunks_exact) method on [slices](../primitive.slice).
Example
-------
```
let slice = ['l', 'o', 'r', 'e', 'm'];
let iter = slice.chunks_exact(2);
```
Implementations
---------------
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1825)### impl<'a, T> ChunksExact<'a, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1840)#### pub fn remainder(&self) -> &'a [T]
Notable traits for &[[u8](../primitive.u8)]
```
impl Read for &[u8]
impl Write for &mut [u8]
```
Returns the remainder of the original slice that is not going to be returned by the iterator. The returned slice has at most `chunk_size-1` elements.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1847)### impl<T> Clone for ChunksExact<'\_, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1848)#### fn clone(&self) -> ChunksExact<'\_, T>
Notable traits for [ChunksExact](struct.chunksexact "struct std::slice::ChunksExact")<'a, T>
```
impl<'a, T> Iterator for ChunksExact<'a, T>
type Item = &'a [T];
```
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)1.0.0 · #### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1816)### impl<'a, T> Debug for ChunksExact<'a, T>where T: 'a + [Debug](../fmt/trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1816)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1905)### impl<'a, T> DoubleEndedIterator for ChunksExact<'a, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1907)#### fn next\_back(&mut self) -> Option<&'a [T]>
Removes and returns an element from the end of the iterator. [Read more](../iter/trait.doubleendediterator#tymethod.next_back)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1918)#### fn nth\_back( &mut self, n: usize) -> Option<<ChunksExact<'a, T> as Iterator>::Item>
Returns the `n`th element from the end of the iterator. [Read more](../iter/trait.doubleendediterator#method.nth_back)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#134)#### fn advance\_back\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator from the back by `n` elements. [Read more](../iter/trait.doubleendediterator#method.advance_back_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#221-225)1.27.0 · #### fn try\_rfold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
This is the reverse version of [`Iterator::try_fold()`](../iter/trait.iterator#method.try_fold "Iterator::try_fold()"): it takes elements starting from the back of the iterator. [Read more](../iter/trait.doubleendediterator#method.try_rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#292-295)1.27.0 · #### fn rfold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
An iterator method that reduces the iterator’s elements to a single, final value, starting from the back. [Read more](../iter/trait.doubleendediterator#method.rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#347-350)1.27.0 · #### fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator from the back that satisfies a predicate. [Read more](../iter/trait.doubleendediterator#method.rfind)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1934)### impl<T> ExactSizeIterator for ChunksExact<'\_, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1935)#### fn is\_empty(&self) -> bool
🔬This is a nightly-only experimental API. (`exact_size_is_empty` [#35428](https://github.com/rust-lang/rust/issues/35428))
Returns `true` if the iterator is empty. [Read more](../iter/trait.exactsizeiterator#method.is_empty)
[source](https://doc.rust-lang.org/src/core/iter/traits/exact_size.rs.html#106)1.0.0 · #### fn len(&self) -> usize
Returns the exact remaining length of the iterator. [Read more](../iter/trait.exactsizeiterator#method.len)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1854)### impl<'a, T> Iterator for ChunksExact<'a, T>
#### type Item = &'a [T]
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1858)#### fn next(&mut self) -> Option<&'a [T]>
Advances the iterator and returns the next value. [Read more](../iter/trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1869)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](../iter/trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1875)#### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](../iter/trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1880)#### fn nth(&mut self, n: usize) -> Option<<ChunksExact<'a, T> as Iterator>::Item>
Returns the `n`th element of the iterator. [Read more](../iter/trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1893)#### fn last(self) -> Option<<ChunksExact<'a, T> as Iterator>::Item>
Consumes the iterator, returning the last element. [Read more](../iter/trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](../iter/trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#328)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](../iter/trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](../iter/struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](../iter/trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)1.0.0 · #### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](../iter/struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](../iter/trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)1.0.0 · #### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](../iter/struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](../iter/trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](../iter/struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](../iter/trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)1.0.0 · #### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](../iter/struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](../iter/trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](../iter/trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)1.0.0 · #### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](../iter/struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](../iter/trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)1.0.0 · #### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](../iter/struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](../iter/trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)1.0.0 · #### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](../iter/struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](../iter/trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)1.0.0 · #### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](../iter/struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](../iter/struct.peekable#method.peek) and [`peek_mut`](../iter/struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](../iter/trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)1.0.0 · #### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](../iter/struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](../iter/trait.iterator#method.skip)s elements based on a predicate. [Read more](../iter/trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)1.0.0 · #### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](../iter/struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](../iter/trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](../iter/struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](../iter/trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)1.0.0 · #### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](../iter/struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](../iter/trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)1.0.0 · #### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](../iter/struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](../iter/trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)1.0.0 · #### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](../iter/struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](../iter/trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](../iter/trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)1.0.0 · #### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](../iter/struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](../iter/trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)1.0.0 · #### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](../iter/struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](../iter/trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)1.0.0 · #### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](../iter/struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](../iter/trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)1.0.0 · #### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](../iter/trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)1.0.0 · #### fn collect<B>(self) -> Bwhere B: [FromIterator](../iter/trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](../iter/trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](../iter/trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)1.0.0 · #### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](../iter/trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2079-2082)#### fn partition\_in\_place<'a, T, P>(self, predicate: P) -> usizewhere T: 'a, Self: [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator")<Item = [&'a mut](../primitive.reference) T>, P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_partition_in_place` [#62543](https://github.com/rust-lang/rust/issues/62543))
Reorders the elements of this iterator *in-place* according to the given predicate, such that all those that return `true` precede all those that return `false`. Returns the number of `true` elements found. [Read more](../iter/trait.iterator#method.partition_in_place)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](../iter/trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2230-2234)1.27.0 · #### fn try\_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](../iter/trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](../iter/trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2407-2410)1.0.0 · #### fn fold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](../iter/trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](../iter/trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](../iter/trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)1.0.0 · #### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)1.0.0 · #### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)1.0.0 · #### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](../iter/trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](../iter/trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](../iter/trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)1.0.0 · #### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](../iter/trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2920-2923)1.0.0 · #### fn rposition<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool), Self: [ExactSizeIterator](../iter/trait.exactsizeiterator "trait std::iter::ExactSizeIterator") + [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
Searches for an element in an iterator from the right, returning its index. [Read more](../iter/trait.iterator#method.rposition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](../iter/trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](../iter/trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3161-3163)1.0.0 · #### fn rev(self) -> Rev<Self>where Self: [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
Notable traits for [Rev](../iter/struct.rev "struct std::iter::Rev")<I>
```
impl<I> Iterator for Rev<I>where
I: DoubleEndedIterator,
type Item = <I as Iterator>::Item;
```
Reverses an iterator’s direction. [Read more](../iter/trait.iterator#method.rev)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)1.0.0 · #### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](../iter/trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](../iter/struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](../iter/trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)1.0.0 · #### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](../iter/struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](../iter/trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3312-3314)1.0.0 · #### fn cycle(self) -> Cycle<Self>where Self: [Clone](../clone/trait.clone "trait std::clone::Clone"),
Notable traits for [Cycle](../iter/struct.cycle "struct std::iter::Cycle")<I>
```
impl<I> Iterator for Cycle<I>where
I: Clone + Iterator,
type Item = <I as Iterator>::Item;
```
Repeats an iterator endlessly. [Read more](../iter/trait.iterator#method.cycle)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](../iter/struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](../iter/trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](../iter/trait.sum "trait std::iter::Sum")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](../iter/trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](../iter/trait.product "trait std::iter::Product")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](../iter/trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another. [Read more](../iter/trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another. [Read more](../iter/trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](../iter/trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are unequal to those of another. [Read more](../iter/trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](../iter/trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](../iter/trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](../iter/trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](../iter/trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](../iter/trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](../iter/trait.iterator#method.is_sorted_by_key)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1944)### impl<T> FusedIterator for ChunksExact<'\_, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1941)### impl<T> TrustedLen for ChunksExact<'\_, T>
Auto Trait Implementations
--------------------------
### impl<'a, T> RefUnwindSafe for ChunksExact<'a, T>where T: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<'a, T> Send for ChunksExact<'a, T>where T: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<'a, T> Sync for ChunksExact<'a, T>where T: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<'a, T> Unpin for ChunksExact<'a, T>
### impl<'a, T> UnwindSafe for ChunksExact<'a, T>where T: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](../iter/trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](../iter/trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Module std::slice Module std::slice
=================
Utilities for the slice primitive type.
*[See also the slice primitive type](../primitive.slice).*
Most of the structs in this module are iterator types which can only be created using a certain function. For example, `slice.iter()` yields an [`Iter`](struct.iter "Iter").
A few functions are provided to create a slice from a value reference or from a raw pointer.
Structs
-------
[ArrayChunks](struct.arraychunks "std::slice::ArrayChunks struct")Experimental
An iterator over a slice in (non-overlapping) chunks (`N` elements at a time), starting at the beginning of the slice.
[ArrayChunksMut](struct.arraychunksmut "std::slice::ArrayChunksMut struct")Experimental
An iterator over a slice in (non-overlapping) mutable chunks (`N` elements at a time), starting at the beginning of the slice.
[ArrayWindows](struct.arraywindows "std::slice::ArrayWindows struct")Experimental
A windowed iterator over a slice in overlapping chunks (`N` elements at a time), starting at the beginning of the slice
[GroupBy](struct.groupby "std::slice::GroupBy struct")Experimental
An iterator over slice in (non-overlapping) chunks separated by a predicate.
[GroupByMut](struct.groupbymut "std::slice::GroupByMut struct")Experimental
An iterator over slice in (non-overlapping) mutable chunks separated by a predicate.
[Chunks](struct.chunks "std::slice::Chunks struct")
An iterator over a slice in (non-overlapping) chunks (`chunk_size` elements at a time), starting at the beginning of the slice.
[ChunksExact](struct.chunksexact "std::slice::ChunksExact struct")
An iterator over a slice in (non-overlapping) chunks (`chunk_size` elements at a time), starting at the beginning of the slice.
[ChunksExactMut](struct.chunksexactmut "std::slice::ChunksExactMut struct")
An iterator over a slice in (non-overlapping) mutable chunks (`chunk_size` elements at a time), starting at the beginning of the slice.
[ChunksMut](struct.chunksmut "std::slice::ChunksMut struct")
An iterator over a slice in (non-overlapping) mutable chunks (`chunk_size` elements at a time), starting at the beginning of the slice.
[EscapeAscii](struct.escapeascii "std::slice::EscapeAscii struct")
An iterator over the escaped version of a byte slice.
[Iter](struct.iter "std::slice::Iter struct")
Immutable slice iterator
[IterMut](struct.itermut "std::slice::IterMut struct")
Mutable slice iterator.
[RChunks](struct.rchunks "std::slice::RChunks struct")
An iterator over a slice in (non-overlapping) chunks (`chunk_size` elements at a time), starting at the end of the slice.
[RChunksExact](struct.rchunksexact "std::slice::RChunksExact struct")
An iterator over a slice in (non-overlapping) chunks (`chunk_size` elements at a time), starting at the end of the slice.
[RChunksExactMut](struct.rchunksexactmut "std::slice::RChunksExactMut struct")
An iterator over a slice in (non-overlapping) mutable chunks (`chunk_size` elements at a time), starting at the end of the slice.
[RChunksMut](struct.rchunksmut "std::slice::RChunksMut struct")
An iterator over a slice in (non-overlapping) mutable chunks (`chunk_size` elements at a time), starting at the end of the slice.
[RSplit](struct.rsplit "std::slice::RSplit struct")
An iterator over subslices separated by elements that match a predicate function, starting from the end of the slice.
[RSplitMut](struct.rsplitmut "std::slice::RSplitMut struct")
An iterator over the subslices of the vector which are separated by elements that match `pred`, starting from the end of the slice.
[RSplitN](struct.rsplitn "std::slice::RSplitN struct")
An iterator over subslices separated by elements that match a predicate function, limited to a given number of splits, starting from the end of the slice.
[RSplitNMut](struct.rsplitnmut "std::slice::RSplitNMut struct")
An iterator over subslices separated by elements that match a predicate function, limited to a given number of splits, starting from the end of the slice.
[Split](struct.split "std::slice::Split struct")
An iterator over subslices separated by elements that match a predicate function.
[SplitInclusive](struct.splitinclusive "std::slice::SplitInclusive struct")
An iterator over subslices separated by elements that match a predicate function. Unlike `Split`, it contains the matched part as a terminator of the subslice.
[SplitInclusiveMut](struct.splitinclusivemut "std::slice::SplitInclusiveMut struct")
An iterator over the mutable subslices of the vector which are separated by elements that match `pred`. Unlike `SplitMut`, it contains the matched parts in the ends of the subslices.
[SplitMut](struct.splitmut "std::slice::SplitMut struct")
An iterator over the mutable subslices of the vector which are separated by elements that match `pred`.
[SplitN](struct.splitn "std::slice::SplitN struct")
An iterator over subslices separated by elements that match a predicate function, limited to a given number of splits.
[SplitNMut](struct.splitnmut "std::slice::SplitNMut struct")
An iterator over subslices separated by elements that match a predicate function, limited to a given number of splits.
[Windows](struct.windows "std::slice::Windows struct")
An iterator over overlapping subslices of length `size`.
Traits
------
[Concat](trait.concat "std::slice::Concat trait")Experimental
Helper trait for [`[T]::concat`](../primitive.slice#method.concat).
[Join](trait.join "std::slice::Join trait")Experimental
Helper trait for [`[T]::join`](../primitive.slice#method.join)
[SliceIndex](trait.sliceindex "std::slice::SliceIndex trait")
A helper trait used for indexing operations.
Functions
---------
[from\_mut\_ptr\_range](fn.from_mut_ptr_range "std::slice::from_mut_ptr_range fn")[⚠](# "unsafe function")Experimental
Performs the same functionality as [`from_ptr_range`](fn.from_ptr_range "from_ptr_range"), except that a mutable slice is returned.
[from\_ptr\_range](fn.from_ptr_range "std::slice::from_ptr_range fn")[⚠](# "unsafe function")Experimental
Forms a slice from a pointer range.
[range](fn.range "std::slice::range fn")Experimental
Performs bounds-checking of a range.
[from\_mut](fn.from_mut "std::slice::from_mut fn")
Converts a reference to T into a slice of length 1 (without copying).
[from\_raw\_parts](fn.from_raw_parts "std::slice::from_raw_parts fn")[⚠](# "unsafe function")
Forms a slice from a pointer and a length.
[from\_raw\_parts\_mut](fn.from_raw_parts_mut "std::slice::from_raw_parts_mut fn")[⚠](# "unsafe function")
Performs the same functionality as [`from_raw_parts`](fn.from_raw_parts "from_raw_parts"), except that a mutable slice is returned.
[from\_ref](fn.from_ref "std::slice::from_ref fn")
Converts a reference to T into a slice of length 1 (without copying).
rust Struct std::slice::ArrayWindows Struct std::slice::ArrayWindows
===============================
```
pub struct ArrayWindows<'a, T, const N: usize>where T: 'a,{ /* private fields */ }
```
🔬This is a nightly-only experimental API. (`array_windows` [#75027](https://github.com/rust-lang/rust/issues/75027))
A windowed iterator over a slice in overlapping chunks (`N` elements at a time), starting at the beginning of the slice
This struct is created by the [`array_windows`](../primitive.slice#method.array_windows) method on [slices](../primitive.slice).
Example
-------
```
#![feature(array_windows)]
let slice = [0, 1, 2, 3];
let iter = slice.array_windows::<2>();
```
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2145)### impl<'a, T, const N: usize> Clone for ArrayWindows<'a, T, N>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2145)#### fn clone(&self) -> ArrayWindows<'a, T, N>
Notable traits for [ArrayWindows](struct.arraywindows "struct std::slice::ArrayWindows")<'a, T, N>
```
impl<'a, T, const N: usize> Iterator for ArrayWindows<'a, T, N>
type Item = &'a [T; N];
```
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)1.0.0 · #### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2145)### impl<'a, T, const N: usize> Debug for ArrayWindows<'a, T, N>where T: 'a + [Debug](../fmt/trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2145)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2215)### impl<'a, T, const N: usize> DoubleEndedIterator for ArrayWindows<'a, T, N>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2217)#### fn next\_back(&mut self) -> Option<&'a [T; N]>
Removes and returns an element from the end of the iterator. [Read more](../iter/trait.doubleendediterator#tymethod.next_back)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2228)#### fn nth\_back(&mut self, n: usize) -> Option<&'a [T; N]>
Returns the `n`th element from the end of the iterator. [Read more](../iter/trait.doubleendediterator#method.nth_back)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#134)#### fn advance\_back\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator from the back by `n` elements. [Read more](../iter/trait.doubleendediterator#method.advance_back_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#221-225)1.27.0 · #### fn try\_rfold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
This is the reverse version of [`Iterator::try_fold()`](../iter/trait.iterator#method.try_fold "Iterator::try_fold()"): it takes elements starting from the back of the iterator. [Read more](../iter/trait.doubleendediterator#method.try_rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#292-295)1.27.0 · #### fn rfold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
An iterator method that reduces the iterator’s elements to a single, final value, starting from the back. [Read more](../iter/trait.doubleendediterator#method.rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#347-350)1.27.0 · #### fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator from the back that satisfies a predicate. [Read more](../iter/trait.doubleendediterator#method.rfind)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2241)### impl<T, const N: usize> ExactSizeIterator for ArrayWindows<'\_, T, N>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2242)#### fn is\_empty(&self) -> bool
🔬This is a nightly-only experimental API. (`exact_size_is_empty` [#35428](https://github.com/rust-lang/rust/issues/35428))
Returns `true` if the iterator is empty. [Read more](../iter/trait.exactsizeiterator#method.is_empty)
[source](https://doc.rust-lang.org/src/core/iter/traits/exact_size.rs.html#106)1.0.0 · #### fn len(&self) -> usize
Returns the exact remaining length of the iterator. [Read more](../iter/trait.exactsizeiterator#method.len)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2163)### impl<'a, T, const N: usize> Iterator for ArrayWindows<'a, T, N>
#### type Item = &'a [T; N]
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2167)#### fn next(&mut self) -> Option<<ArrayWindows<'a, T, N> as Iterator>::Item>
Advances the iterator and returns the next value. [Read more](../iter/trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2183)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](../iter/trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2188)#### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](../iter/trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2193)#### fn nth(&mut self, n: usize) -> Option<<ArrayWindows<'a, T, N> as Iterator>::Item>
Returns the `n`th element of the iterator. [Read more](../iter/trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2209)#### fn last(self) -> Option<<ArrayWindows<'a, T, N> as Iterator>::Item>
Consumes the iterator, returning the last element. [Read more](../iter/trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](../iter/trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#328)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](../iter/trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](../iter/struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](../iter/trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)1.0.0 · #### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](../iter/struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](../iter/trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)1.0.0 · #### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](../iter/struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](../iter/trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](../iter/struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](../iter/trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)1.0.0 · #### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](../iter/struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](../iter/trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](../iter/trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)1.0.0 · #### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](../iter/struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](../iter/trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)1.0.0 · #### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](../iter/struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](../iter/trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)1.0.0 · #### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](../iter/struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](../iter/trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)1.0.0 · #### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](../iter/struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](../iter/struct.peekable#method.peek) and [`peek_mut`](../iter/struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](../iter/trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)1.0.0 · #### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](../iter/struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](../iter/trait.iterator#method.skip)s elements based on a predicate. [Read more](../iter/trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)1.0.0 · #### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](../iter/struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](../iter/trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](../iter/struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](../iter/trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)1.0.0 · #### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](../iter/struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](../iter/trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)1.0.0 · #### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](../iter/struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](../iter/trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)1.0.0 · #### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](../iter/struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](../iter/trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](../iter/trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)1.0.0 · #### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](../iter/struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](../iter/trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)1.0.0 · #### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](../iter/struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](../iter/trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)1.0.0 · #### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](../iter/struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](../iter/trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)1.0.0 · #### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](../iter/trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)1.0.0 · #### fn collect<B>(self) -> Bwhere B: [FromIterator](../iter/trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](../iter/trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](../iter/trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)1.0.0 · #### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](../iter/trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2079-2082)#### fn partition\_in\_place<'a, T, P>(self, predicate: P) -> usizewhere T: 'a, Self: [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator")<Item = [&'a mut](../primitive.reference) T>, P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_partition_in_place` [#62543](https://github.com/rust-lang/rust/issues/62543))
Reorders the elements of this iterator *in-place* according to the given predicate, such that all those that return `true` precede all those that return `false`. Returns the number of `true` elements found. [Read more](../iter/trait.iterator#method.partition_in_place)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](../iter/trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2230-2234)1.27.0 · #### fn try\_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](../iter/trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](../iter/trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2407-2410)1.0.0 · #### fn fold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](../iter/trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](../iter/trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](../iter/trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)1.0.0 · #### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)1.0.0 · #### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)1.0.0 · #### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](../iter/trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](../iter/trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](../iter/trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)1.0.0 · #### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](../iter/trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2920-2923)1.0.0 · #### fn rposition<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool), Self: [ExactSizeIterator](../iter/trait.exactsizeiterator "trait std::iter::ExactSizeIterator") + [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
Searches for an element in an iterator from the right, returning its index. [Read more](../iter/trait.iterator#method.rposition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](../iter/trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](../iter/trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3161-3163)1.0.0 · #### fn rev(self) -> Rev<Self>where Self: [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
Notable traits for [Rev](../iter/struct.rev "struct std::iter::Rev")<I>
```
impl<I> Iterator for Rev<I>where
I: DoubleEndedIterator,
type Item = <I as Iterator>::Item;
```
Reverses an iterator’s direction. [Read more](../iter/trait.iterator#method.rev)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)1.0.0 · #### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](../iter/trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](../iter/struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](../iter/trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)1.0.0 · #### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](../iter/struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](../iter/trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](../iter/struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](../iter/trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](../iter/trait.sum "trait std::iter::Sum")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](../iter/trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](../iter/trait.product "trait std::iter::Product")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](../iter/trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another. [Read more](../iter/trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another. [Read more](../iter/trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](../iter/trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are unequal to those of another. [Read more](../iter/trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](../iter/trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](../iter/trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](../iter/trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](../iter/trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](../iter/trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](../iter/trait.iterator#method.is_sorted_by_key)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2145)### impl<'a, T, const N: usize> Copy for ArrayWindows<'a, T, N>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"),
Auto Trait Implementations
--------------------------
### impl<'a, T, const N: usize> RefUnwindSafe for ArrayWindows<'a, T, N>where T: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<'a, T, const N: usize> !Send for ArrayWindows<'a, T, N>
### impl<'a, T, const N: usize> !Sync for ArrayWindows<'a, T, N>
### impl<'a, T, const N: usize> Unpin for ArrayWindows<'a, T, N>
### impl<'a, T, const N: usize> UnwindSafe for ArrayWindows<'a, T, N>where T: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](../iter/trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](../iter/trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Struct std::slice::Split Struct std::slice::Split
========================
```
pub struct Split<'a, T, P>where T: 'a, P: FnMut(&T) -> bool,{ /* private fields */ }
```
An iterator over subslices separated by elements that match a predicate function.
This struct is created by the [`split`](../primitive.slice#method.split) method on [slices](../primitive.slice).
Example
-------
```
let slice = [10, 40, 33, 20];
let mut iter = slice.split(|num| num % 3 == 0);
```
Implementations
---------------
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#404)### impl<'a, T, P> Split<'a, T, P>where T: 'a, P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#420)#### pub fn as\_slice(&self) -> &'a [T]
Notable traits for &[[u8](../primitive.u8)]
```
impl Read for &[u8]
impl Write for &mut [u8]
```
🔬This is a nightly-only experimental API. (`split_as_slice` [#96137](https://github.com/rust-lang/rust/issues/96137))
Returns a slice which contains items not yet handled by split.
##### Example
```
#![feature(split_as_slice)]
let slice = [1,2,3,4,5];
let mut split = slice.split(|v| v % 2 == 0);
assert!(split.next().is_some());
assert_eq!(split.as_slice(), &[3,4,5]);
```
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#437)### impl<T, P> Clone for Split<'\_, T, P>where P: [Clone](../clone/trait.clone "trait std::clone::Clone") + [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#441)#### fn clone(&self) -> Split<'\_, T, P>
Notable traits for [Split](struct.split "struct std::slice::Split")<'a, T, P>
```
impl<'a, T, P> Iterator for Split<'a, T, P>where
P: FnMut(&T) -> bool,
type Item = &'a [T];
```
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)#### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#426)1.9.0 · ### impl<T, P> Debug for Split<'\_, T, P>where T: [Debug](../fmt/trait.debug "trait std::fmt::Debug"), P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#430)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#482)### impl<'a, T, P> DoubleEndedIterator for Split<'a, T, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#487)#### fn next\_back(&mut self) -> Option<&'a [T]>
Removes and returns an element from the end of the iterator. [Read more](../iter/trait.doubleendediterator#tymethod.next_back)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#134)#### fn advance\_back\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator from the back by `n` elements. [Read more](../iter/trait.doubleendediterator#method.advance_back_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#184)1.37.0 · #### fn nth\_back(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element from the end of the iterator. [Read more](../iter/trait.doubleendediterator#method.nth_back)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#221-225)1.27.0 · #### fn try\_rfold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
This is the reverse version of [`Iterator::try_fold()`](../iter/trait.iterator#method.try_fold "Iterator::try_fold()"): it takes elements starting from the back of the iterator. [Read more](../iter/trait.doubleendediterator#method.try_rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#292-295)1.27.0 · #### fn rfold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
An iterator method that reduces the iterator’s elements to a single, final value, starting from the back. [Read more](../iter/trait.doubleendediterator#method.rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#347-350)1.27.0 · #### fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator from the back that satisfies a predicate. [Read more](../iter/trait.doubleendediterator#method.rfind)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#447)### impl<'a, T, P> Iterator for Split<'a, T, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
#### type Item = &'a [T]
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#454)#### fn next(&mut self) -> Option<&'a [T]>
Advances the iterator and returns the next value. [Read more](../iter/trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#470)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](../iter/trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](../iter/trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#252-254)#### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](../iter/trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#282-284)#### fn last(self) -> Option<Self::Item>
Consumes the iterator, returning the last element. [Read more](../iter/trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#328)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](../iter/trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#376)#### fn nth(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element of the iterator. [Read more](../iter/trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](../iter/struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](../iter/trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)#### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](../iter/struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](../iter/trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)#### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](../iter/struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](../iter/trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](../iter/struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](../iter/trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)#### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](../iter/struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](../iter/trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](../iter/trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)#### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](../iter/struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](../iter/trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)#### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](../iter/struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](../iter/trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)#### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](../iter/struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](../iter/trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)#### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](../iter/struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](../iter/struct.peekable#method.peek) and [`peek_mut`](../iter/struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](../iter/trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)#### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](../iter/struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](../iter/trait.iterator#method.skip)s elements based on a predicate. [Read more](../iter/trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)#### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](../iter/struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](../iter/trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](../iter/struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](../iter/trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)#### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](../iter/struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](../iter/trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)#### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](../iter/struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](../iter/trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)#### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](../iter/struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](../iter/trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](../iter/trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)#### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](../iter/struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](../iter/trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)#### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](../iter/struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](../iter/trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)#### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](../iter/struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](../iter/trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)#### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](../iter/trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)#### fn collect<B>(self) -> Bwhere B: [FromIterator](../iter/trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](../iter/trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](../iter/trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)#### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](../iter/trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2079-2082)#### fn partition\_in\_place<'a, T, P>(self, predicate: P) -> usizewhere T: 'a, Self: [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator")<Item = [&'a mut](../primitive.reference) T>, P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_partition_in_place` [#62543](https://github.com/rust-lang/rust/issues/62543))
Reorders the elements of this iterator *in-place* according to the given predicate, such that all those that return `true` precede all those that return `false`. Returns the number of `true` elements found. [Read more](../iter/trait.iterator#method.partition_in_place)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](../iter/trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2230-2234)1.27.0 · #### fn try\_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](../iter/trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](../iter/trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2407-2410)#### fn fold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](../iter/trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](../iter/trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](../iter/trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)#### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)#### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)#### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](../iter/trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](../iter/trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](../iter/trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)#### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](../iter/trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](../iter/trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](../iter/trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3161-3163)#### fn rev(self) -> Rev<Self>where Self: [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
Notable traits for [Rev](../iter/struct.rev "struct std::iter::Rev")<I>
```
impl<I> Iterator for Rev<I>where
I: DoubleEndedIterator,
type Item = <I as Iterator>::Item;
```
Reverses an iterator’s direction. [Read more](../iter/trait.iterator#method.rev)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)#### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](../iter/trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](../iter/struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](../iter/trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)#### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](../iter/struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](../iter/trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](../iter/struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](../iter/trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](../iter/trait.sum "trait std::iter::Sum")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](../iter/trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](../iter/trait.product "trait std::iter::Product")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](../iter/trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another. [Read more](../iter/trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another. [Read more](../iter/trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](../iter/trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are unequal to those of another. [Read more](../iter/trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](../iter/trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](../iter/trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](../iter/trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](../iter/trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](../iter/trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](../iter/trait.iterator#method.is_sorted_by_key)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#519)1.26.0 · ### impl<T, P> FusedIterator for Split<'\_, T, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
Auto Trait Implementations
--------------------------
### impl<'a, T, P> RefUnwindSafe for Split<'a, T, P>where P: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"), T: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<'a, T, P> Send for Split<'a, T, P>where P: [Send](../marker/trait.send "trait std::marker::Send"), T: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<'a, T, P> Sync for Split<'a, T, P>where P: [Sync](../marker/trait.sync "trait std::marker::Sync"), T: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<'a, T, P> Unpin for Split<'a, T, P>where P: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"),
### impl<'a, T, P> UnwindSafe for Split<'a, T, P>where P: [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"), T: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](../iter/trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](../iter/trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Trait std::slice::Concat Trait std::slice::Concat
========================
```
pub trait Concat<Item>where Item: ?Sized,{
type Output;
fn concat(slice: &Self) -> Self::Output;
}
```
🔬This is a nightly-only experimental API. (`slice_concat_trait` [#27747](https://github.com/rust-lang/rust/issues/27747))
Helper trait for [`[T]::concat`](../primitive.slice#method.concat).
Note: the `Item` type parameter is not used in this trait, but it allows impls to be more generic. Without it, we get this error:
```
error[E0207]: the type parameter `T` is not constrained by the impl trait, self type, or predica
--> src/liballoc/slice.rs:608:6
|
608 | impl<T: Clone, V: Borrow<[T]>> Concat for [V] {
| ^ unconstrained type parameter
```
This is because there could exist `V` types with multiple `Borrow<[_]>` impls, such that multiple `T` types would apply:
```
pub struct Foo(Vec<u32>, Vec<String>);
impl std::borrow::Borrow<[u32]> for Foo {
fn borrow(&self) -> &[u32] { &self.0 }
}
impl std::borrow::Borrow<[String]> for Foo {
fn borrow(&self) -> &[String] { &self.1 }
}
```
Required Associated Types
-------------------------
[source](https://doc.rust-lang.org/src/alloc/slice.rs.html#683)#### type Output
🔬This is a nightly-only experimental API. (`slice_concat_trait` [#27747](https://github.com/rust-lang/rust/issues/27747))
The resulting type after concatenation
Required Methods
----------------
[source](https://doc.rust-lang.org/src/alloc/slice.rs.html#687)#### fn concat(slice: &Self) -> Self::Output
🔬This is a nightly-only experimental API. (`slice_concat_trait` [#27747](https://github.com/rust-lang/rust/issues/27747))
Implementation of [`[T]::concat`](../primitive.slice#method.concat)
Implementors
------------
[source](https://doc.rust-lang.org/src/alloc/str.rs.html#61)### impl<S> Concat<str> for [S]where S: [Borrow](../borrow/trait.borrow "trait std::borrow::Borrow")<[str](../primitive.str)>,
Note: `str` in `Concat<str>` is not meaningful here. This type parameter of the trait only exists to enable another impl.
#### type Output = String
[source](https://doc.rust-lang.org/src/alloc/slice.rs.html#704)### impl<T, V> Concat<T> for [V]where T: [Clone](../clone/trait.clone "trait std::clone::Clone"), V: [Borrow](../borrow/trait.borrow "trait std::borrow::Borrow")<[[T]](../primitive.slice)>,
#### type Output = Vec<T, Global>
rust Struct std::slice::RSplitMut Struct std::slice::RSplitMut
============================
```
pub struct RSplitMut<'a, T, P>where T: 'a, P: FnMut(&T) -> bool,{ /* private fields */ }
```
An iterator over the subslices of the vector which are separated by elements that match `pred`, starting from the end of the slice.
This struct is created by the [`rsplit_mut`](../primitive.slice#method.rsplit_mut) method on [slices](../primitive.slice).
Example
-------
```
let mut slice = [11, 22, 33, 0, 44, 55];
let iter = slice.rsplit_mut(|num| *num == 0);
```
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1024)### impl<T, P> Debug for RSplitMut<'\_, T, P>where T: [Debug](../fmt/trait.debug "trait std::fmt::Debug"), P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1028)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1066)### impl<'a, T, P> DoubleEndedIterator for RSplitMut<'a, T, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1071)#### fn next\_back(&mut self) -> Option<&'a mut [T]>
Removes and returns an element from the end of the iterator. [Read more](../iter/trait.doubleendediterator#tymethod.next_back)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#134)#### fn advance\_back\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator from the back by `n` elements. [Read more](../iter/trait.doubleendediterator#method.advance_back_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#184)1.37.0 · #### fn nth\_back(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element from the end of the iterator. [Read more](../iter/trait.doubleendediterator#method.nth_back)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#221-225)#### fn try\_rfold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
This is the reverse version of [`Iterator::try_fold()`](../iter/trait.iterator#method.try_fold "Iterator::try_fold()"): it takes elements starting from the back of the iterator. [Read more](../iter/trait.doubleendediterator#method.try_rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#292-295)#### fn rfold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
An iterator method that reduces the iterator’s elements to a single, final value, starting from the back. [Read more](../iter/trait.doubleendediterator#method.rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#347-350)#### fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator from the back that satisfies a predicate. [Read more](../iter/trait.doubleendediterator#method.rfind)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1048)### impl<'a, T, P> Iterator for RSplitMut<'a, T, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
#### type Item = &'a mut [T]
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1055)#### fn next(&mut self) -> Option<&'a mut [T]>
Advances the iterator and returns the next value. [Read more](../iter/trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1060)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](../iter/trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](../iter/trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#252-254)1.0.0 · #### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](../iter/trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#282-284)1.0.0 · #### fn last(self) -> Option<Self::Item>
Consumes the iterator, returning the last element. [Read more](../iter/trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#328)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](../iter/trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#376)1.0.0 · #### fn nth(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element of the iterator. [Read more](../iter/trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](../iter/struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](../iter/trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)1.0.0 · #### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](../iter/struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](../iter/trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)1.0.0 · #### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](../iter/struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](../iter/trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](../iter/struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](../iter/trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)1.0.0 · #### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](../iter/struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](../iter/trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](../iter/trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)1.0.0 · #### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](../iter/struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](../iter/trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)1.0.0 · #### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](../iter/struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](../iter/trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)1.0.0 · #### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](../iter/struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](../iter/trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)1.0.0 · #### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](../iter/struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](../iter/struct.peekable#method.peek) and [`peek_mut`](../iter/struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](../iter/trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)1.0.0 · #### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](../iter/struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](../iter/trait.iterator#method.skip)s elements based on a predicate. [Read more](../iter/trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)1.0.0 · #### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](../iter/struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](../iter/trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](../iter/struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](../iter/trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)1.0.0 · #### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](../iter/struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](../iter/trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)1.0.0 · #### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](../iter/struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](../iter/trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)1.0.0 · #### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](../iter/struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](../iter/trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](../iter/trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)1.0.0 · #### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](../iter/struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](../iter/trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)1.0.0 · #### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](../iter/struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](../iter/trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)1.0.0 · #### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](../iter/struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](../iter/trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)1.0.0 · #### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](../iter/trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)1.0.0 · #### fn collect<B>(self) -> Bwhere B: [FromIterator](../iter/trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](../iter/trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](../iter/trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)1.0.0 · #### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](../iter/trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2079-2082)#### fn partition\_in\_place<'a, T, P>(self, predicate: P) -> usizewhere T: 'a, Self: [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator")<Item = [&'a mut](../primitive.reference) T>, P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_partition_in_place` [#62543](https://github.com/rust-lang/rust/issues/62543))
Reorders the elements of this iterator *in-place* according to the given predicate, such that all those that return `true` precede all those that return `false`. Returns the number of `true` elements found. [Read more](../iter/trait.iterator#method.partition_in_place)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](../iter/trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2230-2234)#### fn try\_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](../iter/trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)#### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](../iter/trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2407-2410)1.0.0 · #### fn fold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](../iter/trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](../iter/trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](../iter/trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)1.0.0 · #### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)1.0.0 · #### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)1.0.0 · #### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](../iter/trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](../iter/trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](../iter/trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)1.0.0 · #### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](../iter/trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](../iter/trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](../iter/trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3161-3163)1.0.0 · #### fn rev(self) -> Rev<Self>where Self: [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
Notable traits for [Rev](../iter/struct.rev "struct std::iter::Rev")<I>
```
impl<I> Iterator for Rev<I>where
I: DoubleEndedIterator,
type Item = <I as Iterator>::Item;
```
Reverses an iterator’s direction. [Read more](../iter/trait.iterator#method.rev)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)1.0.0 · #### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](../iter/trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](../iter/struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](../iter/trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)1.0.0 · #### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](../iter/struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](../iter/trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](../iter/struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](../iter/trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](../iter/trait.sum "trait std::iter::Sum")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](../iter/trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](../iter/trait.product "trait std::iter::Product")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](../iter/trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another. [Read more](../iter/trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another. [Read more](../iter/trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](../iter/trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are unequal to those of another. [Read more](../iter/trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](../iter/trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](../iter/trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](../iter/trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](../iter/trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](../iter/trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](../iter/trait.iterator#method.is_sorted_by_key)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1077)### impl<T, P> FusedIterator for RSplitMut<'\_, T, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
Auto Trait Implementations
--------------------------
### impl<'a, T, P> RefUnwindSafe for RSplitMut<'a, T, P>where P: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"), T: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<'a, T, P> Send for RSplitMut<'a, T, P>where P: [Send](../marker/trait.send "trait std::marker::Send"), T: [Send](../marker/trait.send "trait std::marker::Send"),
### impl<'a, T, P> Sync for RSplitMut<'a, T, P>where P: [Sync](../marker/trait.sync "trait std::marker::Sync"), T: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<'a, T, P> Unpin for RSplitMut<'a, T, P>where P: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"),
### impl<'a, T, P> !UnwindSafe for RSplitMut<'a, T, P>
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](../iter/trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](../iter/trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Function std::slice::from_mut Function std::slice::from\_mut
==============================
```
pub fn from_mut<T>(s: &mut T) -> &mut [T]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
```
Converts a reference to T into a slice of length 1 (without copying).
rust Trait std::slice::Join Trait std::slice::Join
======================
```
pub trait Join<Separator> {
type Output;
fn join(slice: &Self, sep: Separator) -> Self::Output;
}
```
🔬This is a nightly-only experimental API. (`slice_concat_trait` [#27747](https://github.com/rust-lang/rust/issues/27747))
Helper trait for [`[T]::join`](../primitive.slice#method.join)
Required Associated Types
-------------------------
[source](https://doc.rust-lang.org/src/alloc/slice.rs.html#695)#### type Output
🔬This is a nightly-only experimental API. (`slice_concat_trait` [#27747](https://github.com/rust-lang/rust/issues/27747))
The resulting type after concatenation
Required Methods
----------------
[source](https://doc.rust-lang.org/src/alloc/slice.rs.html#699)#### fn join(slice: &Self, sep: Separator) -> Self::Output
🔬This is a nightly-only experimental API. (`slice_concat_trait` [#27747](https://github.com/rust-lang/rust/issues/27747))
Implementation of [`[T]::join`](../primitive.slice#method.join)
Implementors
------------
[source](https://doc.rust-lang.org/src/alloc/str.rs.html#71)### impl<S> Join<&str> for [S]where S: [Borrow](../borrow/trait.borrow "trait std::borrow::Borrow")<[str](../primitive.str)>,
#### type Output = String
[source](https://doc.rust-lang.org/src/std/ffi/os_str.rs.html#1265-1279)### impl<S: Borrow<OsStr>> Join<&OsStr> for [S]
#### type Output = OsString
[source](https://doc.rust-lang.org/src/alloc/slice.rs.html#742)### impl<T, V> Join<&[T]> for [V]where T: [Clone](../clone/trait.clone "trait std::clone::Clone"), V: [Borrow](../borrow/trait.borrow "trait std::borrow::Borrow")<[[T]](../primitive.slice)>,
#### type Output = Vec<T, Global>
[source](https://doc.rust-lang.org/src/alloc/slice.rs.html#719)### impl<T, V> Join<&T> for [V]where T: [Clone](../clone/trait.clone "trait std::clone::Clone"), V: [Borrow](../borrow/trait.borrow "trait std::borrow::Borrow")<[[T]](../primitive.slice)>,
#### type Output = Vec<T, Global>
rust Struct std::slice::SplitMut Struct std::slice::SplitMut
===========================
```
pub struct SplitMut<'a, T, P>where T: 'a, P: FnMut(&T) -> bool,{ /* private fields */ }
```
An iterator over the mutable subslices of the vector which are separated by elements that match `pred`.
This struct is created by the [`split_mut`](../primitive.slice#method.split_mut) method on [slices](../primitive.slice).
Example
-------
```
let mut v = [10, 40, 30, 20, 60, 50];
let iter = v.split_mut(|num| *num % 3 == 0);
```
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#676)1.9.0 · ### impl<T, P> Debug for SplitMut<'\_, T, P>where T: [Debug](../fmt/trait.debug "trait std::fmt::Debug"), P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#680)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#741)### impl<'a, T, P> DoubleEndedIterator for SplitMut<'a, T, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#746)#### fn next\_back(&mut self) -> Option<&'a mut [T]>
Removes and returns an element from the end of the iterator. [Read more](../iter/trait.doubleendediterator#tymethod.next_back)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#134)#### fn advance\_back\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator from the back by `n` elements. [Read more](../iter/trait.doubleendediterator#method.advance_back_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#184)1.37.0 · #### fn nth\_back(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element from the end of the iterator. [Read more](../iter/trait.doubleendediterator#method.nth_back)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#221-225)1.27.0 · #### fn try\_rfold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
This is the reverse version of [`Iterator::try_fold()`](../iter/trait.iterator#method.try_fold "Iterator::try_fold()"): it takes elements starting from the back of the iterator. [Read more](../iter/trait.doubleendediterator#method.try_rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#292-295)1.27.0 · #### fn rfold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
An iterator method that reduces the iterator’s elements to a single, final value, starting from the back. [Read more](../iter/trait.doubleendediterator#method.rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#347-350)1.27.0 · #### fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator from the back that satisfies a predicate. [Read more](../iter/trait.doubleendediterator#method.rfind)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#701)### impl<'a, T, P> Iterator for SplitMut<'a, T, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
#### type Item = &'a mut [T]
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#708)#### fn next(&mut self) -> Option<&'a mut [T]>
Advances the iterator and returns the next value. [Read more](../iter/trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#729)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](../iter/trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](../iter/trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#252-254)#### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](../iter/trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#282-284)#### fn last(self) -> Option<Self::Item>
Consumes the iterator, returning the last element. [Read more](../iter/trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#328)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](../iter/trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#376)#### fn nth(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element of the iterator. [Read more](../iter/trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](../iter/struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](../iter/trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)#### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](../iter/struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](../iter/trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)#### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](../iter/struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](../iter/trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](../iter/struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](../iter/trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)#### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](../iter/struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](../iter/trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](../iter/trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)#### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](../iter/struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](../iter/trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)#### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](../iter/struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](../iter/trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)#### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](../iter/struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](../iter/trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)#### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](../iter/struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](../iter/struct.peekable#method.peek) and [`peek_mut`](../iter/struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](../iter/trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)#### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](../iter/struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](../iter/trait.iterator#method.skip)s elements based on a predicate. [Read more](../iter/trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)#### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](../iter/struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](../iter/trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](../iter/struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](../iter/trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)#### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](../iter/struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](../iter/trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)#### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](../iter/struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](../iter/trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)#### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](../iter/struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](../iter/trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](../iter/trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)#### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](../iter/struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](../iter/trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)#### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](../iter/struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](../iter/trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)#### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](../iter/struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](../iter/trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)#### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](../iter/trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)#### fn collect<B>(self) -> Bwhere B: [FromIterator](../iter/trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](../iter/trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](../iter/trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)#### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](../iter/trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2079-2082)#### fn partition\_in\_place<'a, T, P>(self, predicate: P) -> usizewhere T: 'a, Self: [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator")<Item = [&'a mut](../primitive.reference) T>, P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_partition_in_place` [#62543](https://github.com/rust-lang/rust/issues/62543))
Reorders the elements of this iterator *in-place* according to the given predicate, such that all those that return `true` precede all those that return `false`. Returns the number of `true` elements found. [Read more](../iter/trait.iterator#method.partition_in_place)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](../iter/trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2230-2234)1.27.0 · #### fn try\_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](../iter/trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](../iter/trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2407-2410)#### fn fold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](../iter/trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](../iter/trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](../iter/trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)#### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)#### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)#### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](../iter/trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](../iter/trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](../iter/trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)#### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](../iter/trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](../iter/trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](../iter/trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3161-3163)#### fn rev(self) -> Rev<Self>where Self: [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
Notable traits for [Rev](../iter/struct.rev "struct std::iter::Rev")<I>
```
impl<I> Iterator for Rev<I>where
I: DoubleEndedIterator,
type Item = <I as Iterator>::Item;
```
Reverses an iterator’s direction. [Read more](../iter/trait.iterator#method.rev)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)#### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](../iter/trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](../iter/struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](../iter/trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)#### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](../iter/struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](../iter/trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](../iter/struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](../iter/trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](../iter/trait.sum "trait std::iter::Sum")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](../iter/trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](../iter/trait.product "trait std::iter::Product")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](../iter/trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another. [Read more](../iter/trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another. [Read more](../iter/trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](../iter/trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are unequal to those of another. [Read more](../iter/trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](../iter/trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](../iter/trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](../iter/trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](../iter/trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](../iter/trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](../iter/trait.iterator#method.is_sorted_by_key)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#769)1.26.0 · ### impl<T, P> FusedIterator for SplitMut<'\_, T, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
Auto Trait Implementations
--------------------------
### impl<'a, T, P> RefUnwindSafe for SplitMut<'a, T, P>where P: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"), T: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<'a, T, P> Send for SplitMut<'a, T, P>where P: [Send](../marker/trait.send "trait std::marker::Send"), T: [Send](../marker/trait.send "trait std::marker::Send"),
### impl<'a, T, P> Sync for SplitMut<'a, T, P>where P: [Sync](../marker/trait.sync "trait std::marker::Sync"), T: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<'a, T, P> Unpin for SplitMut<'a, T, P>where P: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"),
### impl<'a, T, P> !UnwindSafe for SplitMut<'a, T, P>
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](../iter/trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](../iter/trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Struct std::slice::ChunksExactMut Struct std::slice::ChunksExactMut
=================================
```
pub struct ChunksExactMut<'a, T>where T: 'a,{ /* private fields */ }
```
An iterator over a slice in (non-overlapping) mutable chunks (`chunk_size` elements at a time), starting at the beginning of the slice.
When the slice len is not evenly divided by the chunk size, the last up to `chunk_size-1` elements will be omitted but can be retrieved from the [`into_remainder`](struct.chunksexactmut#method.into_remainder) function from the iterator.
This struct is created by the [`chunks_exact_mut`](../primitive.slice#method.chunks_exact_mut) method on [slices](../primitive.slice).
Example
-------
```
let mut slice = ['l', 'o', 'r', 'e', 'm'];
let iter = slice.chunks_exact_mut(2);
```
Implementations
---------------
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1991)### impl<'a, T> ChunksExactMut<'a, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2006)#### pub fn into\_remainder(self) -> &'a mut [T]
Notable traits for &[[u8](../primitive.u8)]
```
impl Read for &[u8]
impl Write for &mut [u8]
```
Returns the remainder of the original slice that is not going to be returned by the iterator. The returned slice has at most `chunk_size-1` elements.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1975)### impl<'a, T> Debug for ChunksExactMut<'a, T>where T: 'a + [Debug](../fmt/trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1975)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2066)### impl<'a, T> DoubleEndedIterator for ChunksExactMut<'a, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2068)#### fn next\_back(&mut self) -> Option<&'a mut [T]>
Removes and returns an element from the end of the iterator. [Read more](../iter/trait.doubleendediterator#tymethod.next_back)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2081)#### fn nth\_back( &mut self, n: usize) -> Option<<ChunksExactMut<'a, T> as Iterator>::Item>
Returns the `n`th element from the end of the iterator. [Read more](../iter/trait.doubleendediterator#method.nth_back)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#134)#### fn advance\_back\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator from the back by `n` elements. [Read more](../iter/trait.doubleendediterator#method.advance_back_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#221-225)1.27.0 · #### fn try\_rfold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
This is the reverse version of [`Iterator::try_fold()`](../iter/trait.iterator#method.try_fold "Iterator::try_fold()"): it takes elements starting from the back of the iterator. [Read more](../iter/trait.doubleendediterator#method.try_rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#292-295)1.27.0 · #### fn rfold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
An iterator method that reduces the iterator’s elements to a single, final value, starting from the back. [Read more](../iter/trait.doubleendediterator#method.rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#347-350)1.27.0 · #### fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator from the back that satisfies a predicate. [Read more](../iter/trait.doubleendediterator#method.rfind)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2101)### impl<T> ExactSizeIterator for ChunksExactMut<'\_, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2102)#### fn is\_empty(&self) -> bool
🔬This is a nightly-only experimental API. (`exact_size_is_empty` [#35428](https://github.com/rust-lang/rust/issues/35428))
Returns `true` if the iterator is empty. [Read more](../iter/trait.exactsizeiterator#method.is_empty)
[source](https://doc.rust-lang.org/src/core/iter/traits/exact_size.rs.html#106)1.0.0 · #### fn len(&self) -> usize
Returns the exact remaining length of the iterator. [Read more](../iter/trait.exactsizeiterator#method.len)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2012)### impl<'a, T> Iterator for ChunksExactMut<'a, T>
#### type Item = &'a mut [T]
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2016)#### fn next(&mut self) -> Option<&'a mut [T]>
Advances the iterator and returns the next value. [Read more](../iter/trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2029)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](../iter/trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2035)#### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](../iter/trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2040)#### fn nth(&mut self, n: usize) -> Option<&'a mut [T]>
Returns the `n`th element of the iterator. [Read more](../iter/trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2054)#### fn last(self) -> Option<<ChunksExactMut<'a, T> as Iterator>::Item>
Consumes the iterator, returning the last element. [Read more](../iter/trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](../iter/trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#328)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](../iter/trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](../iter/struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](../iter/trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)1.0.0 · #### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](../iter/struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](../iter/trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)1.0.0 · #### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](../iter/struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](../iter/trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](../iter/struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](../iter/trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)1.0.0 · #### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](../iter/struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](../iter/trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](../iter/trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)1.0.0 · #### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](../iter/struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](../iter/trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)1.0.0 · #### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](../iter/struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](../iter/trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)1.0.0 · #### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](../iter/struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](../iter/trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)1.0.0 · #### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](../iter/struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](../iter/struct.peekable#method.peek) and [`peek_mut`](../iter/struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](../iter/trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)1.0.0 · #### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](../iter/struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](../iter/trait.iterator#method.skip)s elements based on a predicate. [Read more](../iter/trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)1.0.0 · #### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](../iter/struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](../iter/trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](../iter/struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](../iter/trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)1.0.0 · #### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](../iter/struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](../iter/trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)1.0.0 · #### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](../iter/struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](../iter/trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)1.0.0 · #### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](../iter/struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](../iter/trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](../iter/trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)1.0.0 · #### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](../iter/struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](../iter/trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)1.0.0 · #### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](../iter/struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](../iter/trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)1.0.0 · #### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](../iter/struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](../iter/trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)1.0.0 · #### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](../iter/trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)1.0.0 · #### fn collect<B>(self) -> Bwhere B: [FromIterator](../iter/trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](../iter/trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](../iter/trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)1.0.0 · #### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](../iter/trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2079-2082)#### fn partition\_in\_place<'a, T, P>(self, predicate: P) -> usizewhere T: 'a, Self: [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator")<Item = [&'a mut](../primitive.reference) T>, P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_partition_in_place` [#62543](https://github.com/rust-lang/rust/issues/62543))
Reorders the elements of this iterator *in-place* according to the given predicate, such that all those that return `true` precede all those that return `false`. Returns the number of `true` elements found. [Read more](../iter/trait.iterator#method.partition_in_place)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](../iter/trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2230-2234)1.27.0 · #### fn try\_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](../iter/trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](../iter/trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2407-2410)1.0.0 · #### fn fold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](../iter/trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](../iter/trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](../iter/trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)1.0.0 · #### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)1.0.0 · #### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)1.0.0 · #### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](../iter/trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](../iter/trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](../iter/trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)1.0.0 · #### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](../iter/trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2920-2923)1.0.0 · #### fn rposition<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool), Self: [ExactSizeIterator](../iter/trait.exactsizeiterator "trait std::iter::ExactSizeIterator") + [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
Searches for an element in an iterator from the right, returning its index. [Read more](../iter/trait.iterator#method.rposition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](../iter/trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](../iter/trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3161-3163)1.0.0 · #### fn rev(self) -> Rev<Self>where Self: [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
Notable traits for [Rev](../iter/struct.rev "struct std::iter::Rev")<I>
```
impl<I> Iterator for Rev<I>where
I: DoubleEndedIterator,
type Item = <I as Iterator>::Item;
```
Reverses an iterator’s direction. [Read more](../iter/trait.iterator#method.rev)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)1.0.0 · #### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](../iter/trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](../iter/struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](../iter/trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)1.0.0 · #### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](../iter/struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](../iter/trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](../iter/struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](../iter/trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](../iter/trait.sum "trait std::iter::Sum")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](../iter/trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](../iter/trait.product "trait std::iter::Product")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](../iter/trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another. [Read more](../iter/trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another. [Read more](../iter/trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](../iter/trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are unequal to those of another. [Read more](../iter/trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](../iter/trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](../iter/trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](../iter/trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](../iter/trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](../iter/trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](../iter/trait.iterator#method.is_sorted_by_key)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2111)### impl<T> FusedIterator for ChunksExactMut<'\_, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2124)### impl<T> Send for ChunksExactMut<'\_, T>where T: [Send](../marker/trait.send "trait std::marker::Send"),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2127)### impl<T> Sync for ChunksExactMut<'\_, T>where T: [Sync](../marker/trait.sync "trait std::marker::Sync"),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2108)### impl<T> TrustedLen for ChunksExactMut<'\_, T>
Auto Trait Implementations
--------------------------
### impl<'a, T> RefUnwindSafe for ChunksExactMut<'a, T>where T: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<'a, T> Unpin for ChunksExactMut<'a, T>
### impl<'a, T> !UnwindSafe for ChunksExactMut<'a, T>
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](../iter/trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](../iter/trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Struct std::slice::SplitInclusiveMut Struct std::slice::SplitInclusiveMut
====================================
```
pub struct SplitInclusiveMut<'a, T, P>where T: 'a, P: FnMut(&T) -> bool,{ /* private fields */ }
```
An iterator over the mutable subslices of the vector which are separated by elements that match `pred`. Unlike `SplitMut`, it contains the matched parts in the ends of the subslices.
This struct is created by the [`split_inclusive_mut`](../primitive.slice#method.split_inclusive_mut) method on [slices](../primitive.slice).
Example
-------
```
let mut v = [10, 40, 30, 20, 60, 50];
let iter = v.split_inclusive_mut(|num| *num % 3 == 0);
```
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#806)### impl<T, P> Debug for SplitInclusiveMut<'\_, T, P>where T: [Debug](../fmt/trait.debug "trait std::fmt::Debug"), P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#810)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#860)### impl<'a, T, P> DoubleEndedIterator for SplitInclusiveMut<'a, T, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#865)#### fn next\_back(&mut self) -> Option<&'a mut [T]>
Removes and returns an element from the end of the iterator. [Read more](../iter/trait.doubleendediterator#tymethod.next_back)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#134)#### fn advance\_back\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator from the back by `n` elements. [Read more](../iter/trait.doubleendediterator#method.advance_back_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#184)1.37.0 · #### fn nth\_back(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element from the end of the iterator. [Read more](../iter/trait.doubleendediterator#method.nth_back)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#221-225)1.27.0 · #### fn try\_rfold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
This is the reverse version of [`Iterator::try_fold()`](../iter/trait.iterator#method.try_fold "Iterator::try_fold()"): it takes elements starting from the back of the iterator. [Read more](../iter/trait.doubleendediterator#method.try_rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#292-295)1.27.0 · #### fn rfold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
An iterator method that reduces the iterator’s elements to a single, final value, starting from the back. [Read more](../iter/trait.doubleendediterator#method.rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#347-350)1.27.0 · #### fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator from the back that satisfies a predicate. [Read more](../iter/trait.doubleendediterator#method.rfind)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#819)### impl<'a, T, P> Iterator for SplitInclusiveMut<'a, T, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
#### type Item = &'a mut [T]
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#826)#### fn next(&mut self) -> Option<&'a mut [T]>
Advances the iterator and returns the next value. [Read more](../iter/trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#847)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](../iter/trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](../iter/trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#252-254)1.0.0 · #### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](../iter/trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#282-284)1.0.0 · #### fn last(self) -> Option<Self::Item>
Consumes the iterator, returning the last element. [Read more](../iter/trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#328)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](../iter/trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#376)1.0.0 · #### fn nth(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element of the iterator. [Read more](../iter/trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](../iter/struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](../iter/trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)1.0.0 · #### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](../iter/struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](../iter/trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)1.0.0 · #### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](../iter/struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](../iter/trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](../iter/struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](../iter/trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)1.0.0 · #### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](../iter/struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](../iter/trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](../iter/trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)1.0.0 · #### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](../iter/struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](../iter/trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)1.0.0 · #### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](../iter/struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](../iter/trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)1.0.0 · #### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](../iter/struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](../iter/trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)1.0.0 · #### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](../iter/struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](../iter/struct.peekable#method.peek) and [`peek_mut`](../iter/struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](../iter/trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)1.0.0 · #### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](../iter/struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](../iter/trait.iterator#method.skip)s elements based on a predicate. [Read more](../iter/trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)1.0.0 · #### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](../iter/struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](../iter/trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](../iter/struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](../iter/trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)1.0.0 · #### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](../iter/struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](../iter/trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)1.0.0 · #### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](../iter/struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](../iter/trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)1.0.0 · #### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](../iter/struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](../iter/trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](../iter/trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)1.0.0 · #### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](../iter/struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](../iter/trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)1.0.0 · #### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](../iter/struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](../iter/trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)1.0.0 · #### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](../iter/struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](../iter/trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)1.0.0 · #### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](../iter/trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)1.0.0 · #### fn collect<B>(self) -> Bwhere B: [FromIterator](../iter/trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](../iter/trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](../iter/trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)1.0.0 · #### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](../iter/trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2079-2082)#### fn partition\_in\_place<'a, T, P>(self, predicate: P) -> usizewhere T: 'a, Self: [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator")<Item = [&'a mut](../primitive.reference) T>, P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_partition_in_place` [#62543](https://github.com/rust-lang/rust/issues/62543))
Reorders the elements of this iterator *in-place* according to the given predicate, such that all those that return `true` precede all those that return `false`. Returns the number of `true` elements found. [Read more](../iter/trait.iterator#method.partition_in_place)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](../iter/trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2230-2234)1.27.0 · #### fn try\_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](../iter/trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](../iter/trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2407-2410)1.0.0 · #### fn fold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](../iter/trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)#### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](../iter/trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](../iter/trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)1.0.0 · #### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)1.0.0 · #### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)1.0.0 · #### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](../iter/trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](../iter/trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](../iter/trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)1.0.0 · #### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](../iter/trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](../iter/trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](../iter/trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3161-3163)1.0.0 · #### fn rev(self) -> Rev<Self>where Self: [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
Notable traits for [Rev](../iter/struct.rev "struct std::iter::Rev")<I>
```
impl<I> Iterator for Rev<I>where
I: DoubleEndedIterator,
type Item = <I as Iterator>::Item;
```
Reverses an iterator’s direction. [Read more](../iter/trait.iterator#method.rev)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)1.0.0 · #### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](../iter/trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](../iter/struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](../iter/trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)1.0.0 · #### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](../iter/struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](../iter/trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](../iter/struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](../iter/trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](../iter/trait.sum "trait std::iter::Sum")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](../iter/trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](../iter/trait.product "trait std::iter::Product")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](../iter/trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another. [Read more](../iter/trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another. [Read more](../iter/trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](../iter/trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are unequal to those of another. [Read more](../iter/trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](../iter/trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](../iter/trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](../iter/trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](../iter/trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](../iter/trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](../iter/trait.iterator#method.is_sorted_by_key)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#894)### impl<T, P> FusedIterator for SplitInclusiveMut<'\_, T, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
Auto Trait Implementations
--------------------------
### impl<'a, T, P> RefUnwindSafe for SplitInclusiveMut<'a, T, P>where P: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"), T: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<'a, T, P> Send for SplitInclusiveMut<'a, T, P>where P: [Send](../marker/trait.send "trait std::marker::Send"), T: [Send](../marker/trait.send "trait std::marker::Send"),
### impl<'a, T, P> Sync for SplitInclusiveMut<'a, T, P>where P: [Sync](../marker/trait.sync "trait std::marker::Sync"), T: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<'a, T, P> Unpin for SplitInclusiveMut<'a, T, P>where P: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"),
### impl<'a, T, P> !UnwindSafe for SplitInclusiveMut<'a, T, P>
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](../iter/trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](../iter/trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Struct std::slice::ArrayChunks Struct std::slice::ArrayChunks
==============================
```
pub struct ArrayChunks<'a, T, const N: usize>where T: 'a,{ /* private fields */ }
```
🔬This is a nightly-only experimental API. (`array_chunks` [#74985](https://github.com/rust-lang/rust/issues/74985))
An iterator over a slice in (non-overlapping) chunks (`N` elements at a time), starting at the beginning of the slice.
When the slice len is not evenly divided by the chunk size, the last up to `N-1` elements will be omitted but can be retrieved from the [`remainder`](struct.arraychunks#method.remainder) function from the iterator.
This struct is created by the [`array_chunks`](../primitive.slice#method.array_chunks) method on [slices](../primitive.slice).
Example
-------
```
#![feature(array_chunks)]
let slice = ['l', 'o', 'r', 'e', 'm'];
let iter = slice.array_chunks::<2>();
```
Implementations
---------------
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2276)### impl<'a, T, const N: usize> ArrayChunks<'a, T, N>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2288)#### pub fn remainder(&self) -> &'a [T]
Notable traits for &[[u8](../primitive.u8)]
```
impl Read for &[u8]
impl Write for &mut [u8]
```
🔬This is a nightly-only experimental API. (`array_chunks` [#74985](https://github.com/rust-lang/rust/issues/74985))
Returns the remainder of the original slice that is not going to be returned by the iterator. The returned slice has at most `N-1` elements.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2295)### impl<T, const N: usize> Clone for ArrayChunks<'\_, T, N>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2296)#### fn clone(&self) -> ArrayChunks<'\_, T, N>
Notable traits for [ArrayChunks](struct.arraychunks "struct std::slice::ArrayChunks")<'a, T, N>
```
impl<'a, T, const N: usize> Iterator for ArrayChunks<'a, T, N>
type Item = &'a [T; N];
```
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)1.0.0 · #### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2268)### impl<'a, T, const N: usize> Debug for ArrayChunks<'a, T, N>where T: 'a + [Debug](../fmt/trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2268)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2338)### impl<'a, T, const N: usize> DoubleEndedIterator for ArrayChunks<'a, T, N>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2340)#### fn next\_back(&mut self) -> Option<&'a [T; N]>
Removes and returns an element from the end of the iterator. [Read more](../iter/trait.doubleendediterator#tymethod.next_back)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2345)#### fn nth\_back( &mut self, n: usize) -> Option<<ArrayChunks<'a, T, N> as Iterator>::Item>
Returns the `n`th element from the end of the iterator. [Read more](../iter/trait.doubleendediterator#method.nth_back)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#134)#### fn advance\_back\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator from the back by `n` elements. [Read more](../iter/trait.doubleendediterator#method.advance_back_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#221-225)1.27.0 · #### fn try\_rfold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
This is the reverse version of [`Iterator::try_fold()`](../iter/trait.iterator#method.try_fold "Iterator::try_fold()"): it takes elements starting from the back of the iterator. [Read more](../iter/trait.doubleendediterator#method.try_rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#292-295)1.27.0 · #### fn rfold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
An iterator method that reduces the iterator’s elements to a single, final value, starting from the back. [Read more](../iter/trait.doubleendediterator#method.rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#347-350)1.27.0 · #### fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator from the back that satisfies a predicate. [Read more](../iter/trait.doubleendediterator#method.rfind)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2351)### impl<T, const N: usize> ExactSizeIterator for ArrayChunks<'\_, T, N>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2352)#### fn is\_empty(&self) -> bool
🔬This is a nightly-only experimental API. (`exact_size_is_empty` [#35428](https://github.com/rust-lang/rust/issues/35428))
Returns `true` if the iterator is empty. [Read more](../iter/trait.exactsizeiterator#method.is_empty)
[source](https://doc.rust-lang.org/src/core/iter/traits/exact_size.rs.html#106)1.0.0 · #### fn len(&self) -> usize
Returns the exact remaining length of the iterator. [Read more](../iter/trait.exactsizeiterator#method.len)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2302)### impl<'a, T, const N: usize> Iterator for ArrayChunks<'a, T, N>
#### type Item = &'a [T; N]
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2306)#### fn next(&mut self) -> Option<&'a [T; N]>
Advances the iterator and returns the next value. [Read more](../iter/trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2311)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](../iter/trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2316)#### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](../iter/trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2321)#### fn nth(&mut self, n: usize) -> Option<<ArrayChunks<'a, T, N> as Iterator>::Item>
Returns the `n`th element of the iterator. [Read more](../iter/trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2326)#### fn last(self) -> Option<<ArrayChunks<'a, T, N> as Iterator>::Item>
Consumes the iterator, returning the last element. [Read more](../iter/trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](../iter/trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#328)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](../iter/trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](../iter/struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](../iter/trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)1.0.0 · #### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](../iter/struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](../iter/trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)1.0.0 · #### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](../iter/struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](../iter/trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](../iter/struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](../iter/trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)1.0.0 · #### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](../iter/struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](../iter/trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](../iter/trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)1.0.0 · #### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](../iter/struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](../iter/trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)1.0.0 · #### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](../iter/struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](../iter/trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)1.0.0 · #### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](../iter/struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](../iter/trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)1.0.0 · #### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](../iter/struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](../iter/struct.peekable#method.peek) and [`peek_mut`](../iter/struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](../iter/trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)1.0.0 · #### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](../iter/struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](../iter/trait.iterator#method.skip)s elements based on a predicate. [Read more](../iter/trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)1.0.0 · #### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](../iter/struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](../iter/trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](../iter/struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](../iter/trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)1.0.0 · #### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](../iter/struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](../iter/trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)1.0.0 · #### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](../iter/struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](../iter/trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)1.0.0 · #### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](../iter/struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](../iter/trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](../iter/trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)1.0.0 · #### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](../iter/struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](../iter/trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)1.0.0 · #### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](../iter/struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](../iter/trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)1.0.0 · #### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](../iter/struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](../iter/trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)1.0.0 · #### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](../iter/trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)1.0.0 · #### fn collect<B>(self) -> Bwhere B: [FromIterator](../iter/trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](../iter/trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](../iter/trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)1.0.0 · #### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](../iter/trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2079-2082)#### fn partition\_in\_place<'a, T, P>(self, predicate: P) -> usizewhere T: 'a, Self: [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator")<Item = [&'a mut](../primitive.reference) T>, P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_partition_in_place` [#62543](https://github.com/rust-lang/rust/issues/62543))
Reorders the elements of this iterator *in-place* according to the given predicate, such that all those that return `true` precede all those that return `false`. Returns the number of `true` elements found. [Read more](../iter/trait.iterator#method.partition_in_place)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](../iter/trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2230-2234)1.27.0 · #### fn try\_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](../iter/trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](../iter/trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2407-2410)1.0.0 · #### fn fold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](../iter/trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](../iter/trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](../iter/trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)1.0.0 · #### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)1.0.0 · #### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)1.0.0 · #### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](../iter/trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](../iter/trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](../iter/trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)1.0.0 · #### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](../iter/trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2920-2923)1.0.0 · #### fn rposition<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool), Self: [ExactSizeIterator](../iter/trait.exactsizeiterator "trait std::iter::ExactSizeIterator") + [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
Searches for an element in an iterator from the right, returning its index. [Read more](../iter/trait.iterator#method.rposition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](../iter/trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](../iter/trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3161-3163)1.0.0 · #### fn rev(self) -> Rev<Self>where Self: [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
Notable traits for [Rev](../iter/struct.rev "struct std::iter::Rev")<I>
```
impl<I> Iterator for Rev<I>where
I: DoubleEndedIterator,
type Item = <I as Iterator>::Item;
```
Reverses an iterator’s direction. [Read more](../iter/trait.iterator#method.rev)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)1.0.0 · #### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](../iter/trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](../iter/struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](../iter/trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)1.0.0 · #### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](../iter/struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](../iter/trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3312-3314)1.0.0 · #### fn cycle(self) -> Cycle<Self>where Self: [Clone](../clone/trait.clone "trait std::clone::Clone"),
Notable traits for [Cycle](../iter/struct.cycle "struct std::iter::Cycle")<I>
```
impl<I> Iterator for Cycle<I>where
I: Clone + Iterator,
type Item = <I as Iterator>::Item;
```
Repeats an iterator endlessly. [Read more](../iter/trait.iterator#method.cycle)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](../iter/struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](../iter/trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](../iter/trait.sum "trait std::iter::Sum")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](../iter/trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](../iter/trait.product "trait std::iter::Product")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](../iter/trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another. [Read more](../iter/trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another. [Read more](../iter/trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](../iter/trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are unequal to those of another. [Read more](../iter/trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](../iter/trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](../iter/trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](../iter/trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](../iter/trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](../iter/trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](../iter/trait.iterator#method.is_sorted_by_key)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2361)### impl<T, const N: usize> FusedIterator for ArrayChunks<'\_, T, N>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2358)### impl<T, const N: usize> TrustedLen for ArrayChunks<'\_, T, N>
Auto Trait Implementations
--------------------------
### impl<'a, T, const N: usize> RefUnwindSafe for ArrayChunks<'a, T, N>where T: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<'a, T, const N: usize> Send for ArrayChunks<'a, T, N>where T: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<'a, T, const N: usize> Sync for ArrayChunks<'a, T, N>where T: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<'a, T, const N: usize> Unpin for ArrayChunks<'a, T, N>
### impl<'a, T, const N: usize> UnwindSafe for ArrayChunks<'a, T, N>where T: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](../iter/trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](../iter/trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Function std::slice::from_ref Function std::slice::from\_ref
==============================
```
pub const fn from_ref<T>(s: &T) -> &[T]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
```
Converts a reference to T into a slice of length 1 (without copying).
rust Struct std::slice::IterMut Struct std::slice::IterMut
==========================
```
pub struct IterMut<'a, T>where T: 'a,{ /* private fields */ }
```
Mutable slice iterator.
This struct is created by the [`iter_mut`](../primitive.slice#method.iter_mut) method on [slices](../primitive.slice).
Examples
--------
Basic usage:
```
// First, we declare a type which has `iter_mut` method to get the `IterMut`
// struct (`&[usize]` here):
let mut slice = &mut [1, 2, 3];
// Then, we iterate over it and increment each element value:
for element in slice.iter_mut() {
*element += 1;
}
// We now have "[2, 3, 4]":
println!("{slice:?}");
```
Implementations
---------------
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#207)### impl<'a, T> IterMut<'a, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#275)1.4.0 · #### pub fn into\_slice(self) -> &'a mut [T]
Notable traits for &[[u8](../primitive.u8)]
```
impl Read for &[u8]
impl Write for &mut [u8]
```
Views the underlying data as a subslice of the original data.
To avoid creating `&mut` references that alias, this is forced to consume the iterator.
##### Examples
Basic usage:
```
// First, we declare a type which has `iter_mut` method to get the `IterMut`
// struct (`&[usize]` here):
let mut slice = &mut [1, 2, 3];
{
// Then, we get the iterator:
let mut iter = slice.iter_mut();
// We move to next element:
iter.next();
// So if we print what `into_slice` method returns here, we have "[2, 3]":
println!("{:?}", iter.into_slice());
}
// Now let's modify a value of the slice:
{
// First we get back the iterator:
let mut iter = slice.iter_mut();
// We change the value of the first element of the slice returned by the `next` method:
*iter.next().unwrap() += 1;
}
// Now slice is "[2, 2, 3]":
println!("{slice:?}");
```
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#306)1.53.0 · #### pub fn as\_slice(&self) -> &[T]
Notable traits for &[[u8](../primitive.u8)]
```
impl Read for &[u8]
impl Write for &mut [u8]
```
Views the underlying data as a subslice of the original data.
To avoid creating `&mut [T]` references that alias, the returned slice borrows its lifetime from the iterator the method is applied on.
##### Examples
Basic usage:
```
let mut slice: &mut [usize] = &mut [1, 2, 3];
// First, we get the iterator:
let mut iter = slice.iter_mut();
// So if we check what the `as_slice` method returns here, we have "[1, 2, 3]":
assert_eq!(iter.as_slice(), &[1, 2, 3]);
// Next, we move to the second element of the slice:
iter.next();
// Now `as_slice` returns "[2, 3]":
assert_eq!(iter.as_slice(), &[2, 3]);
```
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#344)#### pub fn as\_mut\_slice(&mut self) -> &mut [T]
Notable traits for &[[u8](../primitive.u8)]
```
impl Read for &[u8]
impl Write for &mut [u8]
```
🔬This is a nightly-only experimental API. (`slice_iter_mut_as_mut_slice` [#93079](https://github.com/rust-lang/rust/issues/93079))
Views the underlying data as a mutable subslice of the original data.
To avoid creating `&mut [T]` references that alias, the returned slice borrows its lifetime from the iterator the method is applied on.
##### Examples
Basic usage:
```
#![feature(slice_iter_mut_as_mut_slice)]
let mut slice: &mut [usize] = &mut [1, 2, 3];
// First, we get the iterator:
let mut iter = slice.iter_mut();
// Then, we get a mutable slice from it:
let mut_slice = iter.as_mut_slice();
// So if we check what the `as_mut_slice` method returned, we have "[1, 2, 3]":
assert_eq!(mut_slice, &mut [1, 2, 3]);
// We can use it to mutate the slice:
mut_slice[0] = 4;
mut_slice[2] = 5;
// Next, we can move to the second element of the slice, checking that
// it yields the value we just wrote:
assert_eq!(iter.next(), Some(&mut 4));
// Now `as_mut_slice` returns "[2, 5]":
assert_eq!(iter.as_mut_slice(), &mut [2, 5]);
```
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#353)1.53.0 · ### impl<T> AsRef<[T]> for IterMut<'\_, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#354)#### fn as\_ref(&self) -> &[T]
Notable traits for &[[u8](../primitive.u8)]
```
impl Read for &[u8]
impl Write for &mut [u8]
```
Converts this type into a shared reference of the (usually inferred) input type.
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#196)1.9.0 · ### impl<T> Debug for IterMut<'\_, T>where T: [Debug](../fmt/trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#197)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#366)### impl<'a, T> DoubleEndedIterator for IterMut<'a, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#366)#### fn next\_back(&mut self) -> Option<&'a mut T>
Removes and returns an element from the end of the iterator. [Read more](../iter/trait.doubleendediterator#tymethod.next_back)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#366)#### fn nth\_back(&mut self, n: usize) -> Option<&'a mut T>
Returns the `n`th element from the end of the iterator. [Read more](../iter/trait.doubleendediterator#method.nth_back)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#366)#### fn advance\_back\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator from the back by `n` elements. [Read more](../iter/trait.doubleendediterator#method.advance_back_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#221-225)1.27.0 · #### fn try\_rfold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
This is the reverse version of [`Iterator::try_fold()`](../iter/trait.iterator#method.try_fold "Iterator::try_fold()"): it takes elements starting from the back of the iterator. [Read more](../iter/trait.doubleendediterator#method.try_rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#292-295)1.27.0 · #### fn rfold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
An iterator method that reduces the iterator’s elements to a single, final value, starting from the back. [Read more](../iter/trait.doubleendediterator#method.rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#347-350)1.27.0 · #### fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator from the back that satisfies a predicate. [Read more](../iter/trait.doubleendediterator#method.rfind)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#366)### impl<T> ExactSizeIterator for IterMut<'\_, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#366)#### fn len(&self) -> usize
Returns the exact remaining length of the iterator. [Read more](../iter/trait.exactsizeiterator#method.len)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#366)#### fn is\_empty(&self) -> bool
🔬This is a nightly-only experimental API. (`exact_size_is_empty` [#35428](https://github.com/rust-lang/rust/issues/35428))
Returns `true` if the iterator is empty. [Read more](../iter/trait.exactsizeiterator#method.is_empty)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#366)### impl<'a, T> Iterator for IterMut<'a, T>
#### type Item = &'a mut T
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#366)#### fn next(&mut self) -> Option<&'a mut T>
Advances the iterator and returns the next value. [Read more](../iter/trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#366)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](../iter/trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#366)#### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](../iter/trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#366)#### fn nth(&mut self, n: usize) -> Option<&'a mut T>
Returns the `n`th element of the iterator. [Read more](../iter/trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#366)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](../iter/trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#366)#### fn last(self) -> Option<&'a mut T>
Consumes the iterator, returning the last element. [Read more](../iter/trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#366)#### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(<[IterMut](struct.itermut "struct std::slice::IterMut")<'a, T> as [Iterator](../iter/trait.iterator "trait std::iter::Iterator")>::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")), [IterMut](struct.itermut "struct std::slice::IterMut")<'a, T>: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Calls a closure on each element of an iterator. [Read more](../iter/trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#366)#### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(<[IterMut](struct.itermut "struct std::slice::IterMut")<'a, T> as [Iterator](../iter/trait.iterator "trait std::iter::Iterator")>::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool), [IterMut](struct.itermut "struct std::slice::IterMut")<'a, T>: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Tests if every element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#366)#### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(<[IterMut](struct.itermut "struct std::slice::IterMut")<'a, T> as [Iterator](../iter/trait.iterator "trait std::iter::Iterator")>::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool), [IterMut](struct.itermut "struct std::slice::IterMut")<'a, T>: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Tests if any element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#366)#### fn find<P>(&mut self, predicate: P) -> Option<<IterMut<'a, T> as Iterator>::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&<[IterMut](struct.itermut "struct std::slice::IterMut")<'a, T> as [Iterator](../iter/trait.iterator "trait std::iter::Iterator")>::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool), [IterMut](struct.itermut "struct std::slice::IterMut")<'a, T>: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Searches for an element of an iterator that satisfies a predicate. [Read more](../iter/trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#366)#### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(<[IterMut](struct.itermut "struct std::slice::IterMut")<'a, T> as [Iterator](../iter/trait.iterator "trait std::iter::Iterator")>::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>, [IterMut](struct.itermut "struct std::slice::IterMut")<'a, T>: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Applies function to the elements of iterator and returns the first non-none result. [Read more](../iter/trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#366)#### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(<[IterMut](struct.itermut "struct std::slice::IterMut")<'a, T> as [Iterator](../iter/trait.iterator "trait std::iter::Iterator")>::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool), [IterMut](struct.itermut "struct std::slice::IterMut")<'a, T>: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Searches for an element in an iterator, returning its index. [Read more](../iter/trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#366)#### fn rposition<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(<[IterMut](struct.itermut "struct std::slice::IterMut")<'a, T> as [Iterator](../iter/trait.iterator "trait std::iter::Iterator")>::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool), [IterMut](struct.itermut "struct std::slice::IterMut")<'a, T>: [Sized](../marker/trait.sized "trait std::marker::Sized"), [IterMut](struct.itermut "struct std::slice::IterMut")<'a, T>: [ExactSizeIterator](../iter/trait.exactsizeiterator "trait std::iter::ExactSizeIterator"), [IterMut](struct.itermut "struct std::slice::IterMut")<'a, T>: [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
Searches for an element in an iterator from the right, returning its index. [Read more](../iter/trait.iterator#method.rposition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](../iter/trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](../iter/struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](../iter/trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)#### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](../iter/struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](../iter/trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)#### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](../iter/struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](../iter/trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](../iter/struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](../iter/trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)#### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](../iter/struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](../iter/trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)#### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](../iter/struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](../iter/trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)#### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](../iter/struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](../iter/trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)#### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](../iter/struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](../iter/trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)#### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](../iter/struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](../iter/struct.peekable#method.peek) and [`peek_mut`](../iter/struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](../iter/trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)#### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](../iter/struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](../iter/trait.iterator#method.skip)s elements based on a predicate. [Read more](../iter/trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)#### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](../iter/struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](../iter/trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](../iter/struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](../iter/trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)#### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](../iter/struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](../iter/trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)#### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](../iter/struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](../iter/trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)#### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](../iter/struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](../iter/trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](../iter/trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)#### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](../iter/struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](../iter/trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)#### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](../iter/struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](../iter/trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)#### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](../iter/struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](../iter/trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)#### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](../iter/trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)#### fn collect<B>(self) -> Bwhere B: [FromIterator](../iter/trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](../iter/trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](../iter/trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)#### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](../iter/trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2079-2082)#### fn partition\_in\_place<'a, T, P>(self, predicate: P) -> usizewhere T: 'a, Self: [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator")<Item = [&'a mut](../primitive.reference) T>, P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_partition_in_place` [#62543](https://github.com/rust-lang/rust/issues/62543))
Reorders the elements of this iterator *in-place* according to the given predicate, such that all those that return `true` precede all those that return `false`. Returns the number of `true` elements found. [Read more](../iter/trait.iterator#method.partition_in_place)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](../iter/trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2230-2234)1.27.0 · #### fn try\_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](../iter/trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](../iter/trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2407-2410)#### fn fold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](../iter/trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](../iter/trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](../iter/trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](../iter/trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](../iter/trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](../iter/trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3161-3163)#### fn rev(self) -> Rev<Self>where Self: [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
Notable traits for [Rev](../iter/struct.rev "struct std::iter::Rev")<I>
```
impl<I> Iterator for Rev<I>where
I: DoubleEndedIterator,
type Item = <I as Iterator>::Item;
```
Reverses an iterator’s direction. [Read more](../iter/trait.iterator#method.rev)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)#### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](../iter/trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](../iter/struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](../iter/trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)#### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](../iter/struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](../iter/trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](../iter/struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](../iter/trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](../iter/trait.sum "trait std::iter::Sum")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](../iter/trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](../iter/trait.product "trait std::iter::Product")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](../iter/trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another. [Read more](../iter/trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another. [Read more](../iter/trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](../iter/trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are unequal to those of another. [Read more](../iter/trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](../iter/trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](../iter/trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](../iter/trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](../iter/trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](../iter/trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](../iter/trait.iterator#method.is_sorted_by_key)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#366)1.26.0 · ### impl<T> FusedIterator for IterMut<'\_, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#205)### impl<T> Send for IterMut<'\_, T>where T: [Send](../marker/trait.send "trait std::marker::Send"),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#203)### impl<T> Sync for IterMut<'\_, T>where T: [Sync](../marker/trait.sync "trait std::marker::Sync"),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#366)### impl<T> TrustedLen for IterMut<'\_, T>
Auto Trait Implementations
--------------------------
### impl<'a, T> RefUnwindSafe for IterMut<'a, T>where T: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<'a, T> Unpin for IterMut<'a, T>
### impl<'a, T> !UnwindSafe for IterMut<'a, T>
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](../iter/trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](../iter/trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Struct std::slice::SplitInclusive Struct std::slice::SplitInclusive
=================================
```
pub struct SplitInclusive<'a, T, P>where T: 'a, P: FnMut(&T) -> bool,{ /* private fields */ }
```
An iterator over subslices separated by elements that match a predicate function. Unlike `Split`, it contains the matched part as a terminator of the subslice.
This struct is created by the [`split_inclusive`](../primitive.slice#method.split_inclusive) method on [slices](../primitive.slice).
Example
-------
```
let slice = [10, 40, 33, 20];
let mut iter = slice.split_inclusive(|num| num % 3 == 0);
```
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#570)### impl<T, P> Clone for SplitInclusive<'\_, T, P>where P: [Clone](../clone/trait.clone "trait std::clone::Clone") + [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#574)#### fn clone(&self) -> SplitInclusive<'\_, T, P>
Notable traits for [SplitInclusive](struct.splitinclusive "struct std::slice::SplitInclusive")<'a, T, P>
```
impl<'a, T, P> Iterator for SplitInclusive<'a, T, P>where
P: FnMut(&T) -> bool,
type Item = &'a [T];
```
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)1.0.0 · #### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#556)### impl<T, P> Debug for SplitInclusive<'\_, T, P>where T: [Debug](../fmt/trait.debug "trait std::fmt::Debug"), P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#560)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#616)### impl<'a, T, P> DoubleEndedIterator for SplitInclusive<'a, T, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#621)#### fn next\_back(&mut self) -> Option<&'a [T]>
Removes and returns an element from the end of the iterator. [Read more](../iter/trait.doubleendediterator#tymethod.next_back)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#134)#### fn advance\_back\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator from the back by `n` elements. [Read more](../iter/trait.doubleendediterator#method.advance_back_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#184)1.37.0 · #### fn nth\_back(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element from the end of the iterator. [Read more](../iter/trait.doubleendediterator#method.nth_back)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#221-225)1.27.0 · #### fn try\_rfold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
This is the reverse version of [`Iterator::try_fold()`](../iter/trait.iterator#method.try_fold "Iterator::try_fold()"): it takes elements starting from the back of the iterator. [Read more](../iter/trait.doubleendediterator#method.try_rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#292-295)1.27.0 · #### fn rfold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
An iterator method that reduces the iterator’s elements to a single, final value, starting from the back. [Read more](../iter/trait.doubleendediterator#method.rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#347-350)1.27.0 · #### fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator from the back that satisfies a predicate. [Read more](../iter/trait.doubleendediterator#method.rfind)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#580)### impl<'a, T, P> Iterator for SplitInclusive<'a, T, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
#### type Item = &'a [T]
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#587)#### fn next(&mut self) -> Option<&'a [T]>
Advances the iterator and returns the next value. [Read more](../iter/trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#603)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](../iter/trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](../iter/trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#252-254)1.0.0 · #### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](../iter/trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#282-284)1.0.0 · #### fn last(self) -> Option<Self::Item>
Consumes the iterator, returning the last element. [Read more](../iter/trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#328)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](../iter/trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#376)1.0.0 · #### fn nth(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element of the iterator. [Read more](../iter/trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](../iter/struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](../iter/trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)1.0.0 · #### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](../iter/struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](../iter/trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)1.0.0 · #### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](../iter/struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](../iter/trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](../iter/struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](../iter/trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)1.0.0 · #### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](../iter/struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](../iter/trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](../iter/trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)1.0.0 · #### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](../iter/struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](../iter/trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)1.0.0 · #### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](../iter/struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](../iter/trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)1.0.0 · #### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](../iter/struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](../iter/trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)1.0.0 · #### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](../iter/struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](../iter/struct.peekable#method.peek) and [`peek_mut`](../iter/struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](../iter/trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)1.0.0 · #### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](../iter/struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](../iter/trait.iterator#method.skip)s elements based on a predicate. [Read more](../iter/trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)1.0.0 · #### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](../iter/struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](../iter/trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](../iter/struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](../iter/trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)1.0.0 · #### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](../iter/struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](../iter/trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)1.0.0 · #### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](../iter/struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](../iter/trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)1.0.0 · #### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](../iter/struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](../iter/trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](../iter/trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)1.0.0 · #### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](../iter/struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](../iter/trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)1.0.0 · #### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](../iter/struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](../iter/trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)1.0.0 · #### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](../iter/struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](../iter/trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)1.0.0 · #### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](../iter/trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)1.0.0 · #### fn collect<B>(self) -> Bwhere B: [FromIterator](../iter/trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](../iter/trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](../iter/trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)1.0.0 · #### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](../iter/trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2079-2082)#### fn partition\_in\_place<'a, T, P>(self, predicate: P) -> usizewhere T: 'a, Self: [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator")<Item = [&'a mut](../primitive.reference) T>, P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_partition_in_place` [#62543](https://github.com/rust-lang/rust/issues/62543))
Reorders the elements of this iterator *in-place* according to the given predicate, such that all those that return `true` precede all those that return `false`. Returns the number of `true` elements found. [Read more](../iter/trait.iterator#method.partition_in_place)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](../iter/trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2230-2234)1.27.0 · #### fn try\_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](../iter/trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](../iter/trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2407-2410)1.0.0 · #### fn fold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](../iter/trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)#### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](../iter/trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](../iter/trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)1.0.0 · #### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)1.0.0 · #### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)1.0.0 · #### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](../iter/trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](../iter/trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](../iter/trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)1.0.0 · #### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](../iter/trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](../iter/trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](../iter/trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3161-3163)1.0.0 · #### fn rev(self) -> Rev<Self>where Self: [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
Notable traits for [Rev](../iter/struct.rev "struct std::iter::Rev")<I>
```
impl<I> Iterator for Rev<I>where
I: DoubleEndedIterator,
type Item = <I as Iterator>::Item;
```
Reverses an iterator’s direction. [Read more](../iter/trait.iterator#method.rev)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)1.0.0 · #### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](../iter/trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](../iter/struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](../iter/trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)1.0.0 · #### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](../iter/struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](../iter/trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](../iter/struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](../iter/trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](../iter/trait.sum "trait std::iter::Sum")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](../iter/trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](../iter/trait.product "trait std::iter::Product")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](../iter/trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another. [Read more](../iter/trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another. [Read more](../iter/trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](../iter/trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are unequal to those of another. [Read more](../iter/trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](../iter/trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](../iter/trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](../iter/trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](../iter/trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](../iter/trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](../iter/trait.iterator#method.is_sorted_by_key)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#641)### impl<T, P> FusedIterator for SplitInclusive<'\_, T, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
Auto Trait Implementations
--------------------------
### impl<'a, T, P> RefUnwindSafe for SplitInclusive<'a, T, P>where P: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"), T: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<'a, T, P> Send for SplitInclusive<'a, T, P>where P: [Send](../marker/trait.send "trait std::marker::Send"), T: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<'a, T, P> Sync for SplitInclusive<'a, T, P>where P: [Sync](../marker/trait.sync "trait std::marker::Sync"), T: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<'a, T, P> Unpin for SplitInclusive<'a, T, P>where P: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"),
### impl<'a, T, P> UnwindSafe for SplitInclusive<'a, T, P>where P: [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"), T: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](../iter/trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](../iter/trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Function std::slice::from_mut_ptr_range Function std::slice::from\_mut\_ptr\_range
==========================================
```
pub unsafe fn from_mut_ptr_range<'a, T>(range: Range<*mut T>) -> &'a mut [T]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
```
🔬This is a nightly-only experimental API. (`slice_from_ptr_range` [#89792](https://github.com/rust-lang/rust/issues/89792))
Performs the same functionality as [`from_ptr_range`](fn.from_ptr_range "from_ptr_range"), except that a mutable slice is returned.
Safety
------
Behavior is undefined if any of the following conditions are violated:
* The `start` pointer of the range must be a [valid](../ptr/index#safety) and properly aligned pointer to the first element of a slice.
* The `end` pointer must be a [valid](../ptr/index#safety) and properly aligned pointer to *one past* the last element, such that the offset from the end to the start pointer is the length of the slice.
* The range must contain `N` consecutive properly initialized values of type `T`:
+ The entire memory range of this slice must be contained within a single allocated object! Slices can never span across multiple allocated objects.
* The memory referenced by the returned slice must not be accessed through any other pointer (not derived from the return value) for the duration of lifetime `'a`. Both read and write accesses are forbidden.
* The total length of the range must be no larger than `isize::MAX`. See the safety documentation of [`pointer::offset`](../primitive.pointer#method.offset "pointer::offset").
Note that a range created from [`slice::as_mut_ptr_range`](../primitive.slice#method.as_mut_ptr_range "slice::as_mut_ptr_range") fulfills these requirements.
Examples
--------
```
#![feature(slice_from_ptr_range)]
use core::slice;
let mut x = [1, 2, 3];
let range = x.as_mut_ptr_range();
unsafe {
assert_eq!(slice::from_mut_ptr_range(range), &mut [1, 2, 3]);
}
```
rust Struct std::slice::RChunks Struct std::slice::RChunks
==========================
```
pub struct RChunks<'a, T>where T: 'a,{ /* private fields */ }
```
An iterator over a slice in (non-overlapping) chunks (`chunk_size` elements at a time), starting at the end of the slice.
When the slice len is not evenly divided by the chunk size, the last slice of the iteration will be the remainder.
This struct is created by the [`rchunks`](../primitive.slice#method.rchunks) method on [slices](../primitive.slice).
Example
-------
```
let slice = ['l', 'o', 'r', 'e', 'm'];
let iter = slice.rchunks(2);
```
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2525)### impl<T> Clone for RChunks<'\_, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2526)#### fn clone(&self) -> RChunks<'\_, T>
Notable traits for [RChunks](struct.rchunks "struct std::slice::RChunks")<'a, T>
```
impl<'a, T> Iterator for RChunks<'a, T>
type Item = &'a [T];
```
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)1.0.0 · #### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2508)### impl<'a, T> Debug for RChunks<'a, T>where T: 'a + [Debug](../fmt/trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2508)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2612)### impl<'a, T> DoubleEndedIterator for RChunks<'a, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2614)#### fn next\_back(&mut self) -> Option<&'a [T]>
Removes and returns an element from the end of the iterator. [Read more](../iter/trait.doubleendediterator#tymethod.next_back)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2628)#### fn nth\_back(&mut self, n: usize) -> Option<<RChunks<'a, T> as Iterator>::Item>
Returns the `n`th element from the end of the iterator. [Read more](../iter/trait.doubleendediterator#method.nth_back)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#134)#### fn advance\_back\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator from the back by `n` elements. [Read more](../iter/trait.doubleendediterator#method.advance_back_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#221-225)1.27.0 · #### fn try\_rfold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
This is the reverse version of [`Iterator::try_fold()`](../iter/trait.iterator#method.try_fold "Iterator::try_fold()"): it takes elements starting from the back of the iterator. [Read more](../iter/trait.doubleendediterator#method.try_rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#292-295)1.27.0 · #### fn rfold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
An iterator method that reduces the iterator’s elements to a single, final value, starting from the back. [Read more](../iter/trait.doubleendediterator#method.rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#347-350)1.27.0 · #### fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator from the back that satisfies a predicate. [Read more](../iter/trait.doubleendediterator#method.rfind)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2646)### impl<T> ExactSizeIterator for RChunks<'\_, T>
[source](https://doc.rust-lang.org/src/core/iter/traits/exact_size.rs.html#106)1.0.0 · #### fn len(&self) -> usize
Returns the exact remaining length of the iterator. [Read more](../iter/trait.exactsizeiterator#method.len)
[source](https://doc.rust-lang.org/src/core/iter/traits/exact_size.rs.html#138)#### fn is\_empty(&self) -> bool
🔬This is a nightly-only experimental API. (`exact_size_is_empty` [#35428](https://github.com/rust-lang/rust/issues/35428))
Returns `true` if the iterator is empty. [Read more](../iter/trait.exactsizeiterator#method.is_empty)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2532)### impl<'a, T> Iterator for RChunks<'a, T>
#### type Item = &'a [T]
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2536)#### fn next(&mut self) -> Option<&'a [T]>
Advances the iterator and returns the next value. [Read more](../iter/trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2554)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](../iter/trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2566)#### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](../iter/trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2571)#### fn nth(&mut self, n: usize) -> Option<<RChunks<'a, T> as Iterator>::Item>
Returns the `n`th element of the iterator. [Read more](../iter/trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2590)#### fn last(self) -> Option<<RChunks<'a, T> as Iterator>::Item>
Consumes the iterator, returning the last element. [Read more](../iter/trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](../iter/trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#328)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](../iter/trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](../iter/struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](../iter/trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)1.0.0 · #### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](../iter/struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](../iter/trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)1.0.0 · #### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](../iter/struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](../iter/trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](../iter/struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](../iter/trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)1.0.0 · #### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](../iter/struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](../iter/trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](../iter/trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)1.0.0 · #### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](../iter/struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](../iter/trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)1.0.0 · #### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](../iter/struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](../iter/trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)1.0.0 · #### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](../iter/struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](../iter/trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)1.0.0 · #### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](../iter/struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](../iter/struct.peekable#method.peek) and [`peek_mut`](../iter/struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](../iter/trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)1.0.0 · #### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](../iter/struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](../iter/trait.iterator#method.skip)s elements based on a predicate. [Read more](../iter/trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)1.0.0 · #### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](../iter/struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](../iter/trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](../iter/struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](../iter/trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)1.0.0 · #### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](../iter/struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](../iter/trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)1.0.0 · #### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](../iter/struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](../iter/trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)1.0.0 · #### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](../iter/struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](../iter/trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](../iter/trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)1.0.0 · #### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](../iter/struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](../iter/trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)1.0.0 · #### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](../iter/struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](../iter/trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)1.0.0 · #### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](../iter/struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](../iter/trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)1.0.0 · #### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](../iter/trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)1.0.0 · #### fn collect<B>(self) -> Bwhere B: [FromIterator](../iter/trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](../iter/trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](../iter/trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)1.0.0 · #### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](../iter/trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2079-2082)#### fn partition\_in\_place<'a, T, P>(self, predicate: P) -> usizewhere T: 'a, Self: [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator")<Item = [&'a mut](../primitive.reference) T>, P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_partition_in_place` [#62543](https://github.com/rust-lang/rust/issues/62543))
Reorders the elements of this iterator *in-place* according to the given predicate, such that all those that return `true` precede all those that return `false`. Returns the number of `true` elements found. [Read more](../iter/trait.iterator#method.partition_in_place)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](../iter/trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2230-2234)1.27.0 · #### fn try\_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](../iter/trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](../iter/trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2407-2410)1.0.0 · #### fn fold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](../iter/trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](../iter/trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](../iter/trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)1.0.0 · #### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)1.0.0 · #### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)1.0.0 · #### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](../iter/trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](../iter/trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](../iter/trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)1.0.0 · #### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](../iter/trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2920-2923)1.0.0 · #### fn rposition<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool), Self: [ExactSizeIterator](../iter/trait.exactsizeiterator "trait std::iter::ExactSizeIterator") + [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
Searches for an element in an iterator from the right, returning its index. [Read more](../iter/trait.iterator#method.rposition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](../iter/trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](../iter/trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3161-3163)1.0.0 · #### fn rev(self) -> Rev<Self>where Self: [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
Notable traits for [Rev](../iter/struct.rev "struct std::iter::Rev")<I>
```
impl<I> Iterator for Rev<I>where
I: DoubleEndedIterator,
type Item = <I as Iterator>::Item;
```
Reverses an iterator’s direction. [Read more](../iter/trait.iterator#method.rev)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)1.0.0 · #### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](../iter/trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](../iter/struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](../iter/trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)1.0.0 · #### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](../iter/struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](../iter/trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3312-3314)1.0.0 · #### fn cycle(self) -> Cycle<Self>where Self: [Clone](../clone/trait.clone "trait std::clone::Clone"),
Notable traits for [Cycle](../iter/struct.cycle "struct std::iter::Cycle")<I>
```
impl<I> Iterator for Cycle<I>where
I: Clone + Iterator,
type Item = <I as Iterator>::Item;
```
Repeats an iterator endlessly. [Read more](../iter/trait.iterator#method.cycle)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](../iter/struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](../iter/trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](../iter/trait.sum "trait std::iter::Sum")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](../iter/trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](../iter/trait.product "trait std::iter::Product")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](../iter/trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another. [Read more](../iter/trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another. [Read more](../iter/trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](../iter/trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are unequal to those of another. [Read more](../iter/trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](../iter/trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](../iter/trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](../iter/trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](../iter/trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](../iter/trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](../iter/trait.iterator#method.is_sorted_by_key)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2652)### impl<T> FusedIterator for RChunks<'\_, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2649)### impl<T> TrustedLen for RChunks<'\_, T>
Auto Trait Implementations
--------------------------
### impl<'a, T> RefUnwindSafe for RChunks<'a, T>where T: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<'a, T> Send for RChunks<'a, T>where T: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<'a, T> Sync for RChunks<'a, T>where T: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<'a, T> Unpin for RChunks<'a, T>
### impl<'a, T> UnwindSafe for RChunks<'a, T>where T: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](../iter/trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](../iter/trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Struct std::slice::Windows Struct std::slice::Windows
==========================
```
pub struct Windows<'a, T>where T: 'a,{ /* private fields */ }
```
An iterator over overlapping subslices of length `size`.
This struct is created by the [`windows`](../primitive.slice#method.windows) method on [slices](../primitive.slice).
Example
-------
```
let slice = ['r', 'u', 's', 't'];
let iter = slice.windows(2);
```
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1313)### impl<T> Clone for Windows<'\_, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1314)#### fn clone(&self) -> Windows<'\_, T>
Notable traits for [Windows](struct.windows "struct std::slice::Windows")<'a, T>
```
impl<'a, T> Iterator for Windows<'a, T>
type Item = &'a [T];
```
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)#### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1296)### impl<'a, T> Debug for Windows<'a, T>where T: 'a + [Debug](../fmt/trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1296)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1382)### impl<'a, T> DoubleEndedIterator for Windows<'a, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1384)#### fn next\_back(&mut self) -> Option<&'a [T]>
Removes and returns an element from the end of the iterator. [Read more](../iter/trait.doubleendediterator#tymethod.next_back)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1395)#### fn nth\_back(&mut self, n: usize) -> Option<<Windows<'a, T> as Iterator>::Item>
Returns the `n`th element from the end of the iterator. [Read more](../iter/trait.doubleendediterator#method.nth_back)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#134)#### fn advance\_back\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator from the back by `n` elements. [Read more](../iter/trait.doubleendediterator#method.advance_back_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#221-225)1.27.0 · #### fn try\_rfold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
This is the reverse version of [`Iterator::try_fold()`](../iter/trait.iterator#method.try_fold "Iterator::try_fold()"): it takes elements starting from the back of the iterator. [Read more](../iter/trait.doubleendediterator#method.try_rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#292-295)1.27.0 · #### fn rfold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
An iterator method that reduces the iterator’s elements to a single, final value, starting from the back. [Read more](../iter/trait.doubleendediterator#method.rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#347-350)1.27.0 · #### fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator from the back that satisfies a predicate. [Read more](../iter/trait.doubleendediterator#method.rfind)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1409)### impl<T> ExactSizeIterator for Windows<'\_, T>
[source](https://doc.rust-lang.org/src/core/iter/traits/exact_size.rs.html#106)#### fn len(&self) -> usize
Returns the exact remaining length of the iterator. [Read more](../iter/trait.exactsizeiterator#method.len)
[source](https://doc.rust-lang.org/src/core/iter/traits/exact_size.rs.html#138)#### fn is\_empty(&self) -> bool
🔬This is a nightly-only experimental API. (`exact_size_is_empty` [#35428](https://github.com/rust-lang/rust/issues/35428))
Returns `true` if the iterator is empty. [Read more](../iter/trait.exactsizeiterator#method.is_empty)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1320)### impl<'a, T> Iterator for Windows<'a, T>
#### type Item = &'a [T]
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1324)#### fn next(&mut self) -> Option<&'a [T]>
Advances the iterator and returns the next value. [Read more](../iter/trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1335)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](../iter/trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1345)#### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](../iter/trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1350)#### fn nth(&mut self, n: usize) -> Option<<Windows<'a, T> as Iterator>::Item>
Returns the `n`th element of the iterator. [Read more](../iter/trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1363)#### fn last(self) -> Option<<Windows<'a, T> as Iterator>::Item>
Consumes the iterator, returning the last element. [Read more](../iter/trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](../iter/trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#328)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](../iter/trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](../iter/struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](../iter/trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)#### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](../iter/struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](../iter/trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)#### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](../iter/struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](../iter/trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](../iter/struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](../iter/trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)#### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](../iter/struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](../iter/trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](../iter/trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)#### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](../iter/struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](../iter/trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)#### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](../iter/struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](../iter/trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)#### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](../iter/struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](../iter/trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)#### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](../iter/struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](../iter/struct.peekable#method.peek) and [`peek_mut`](../iter/struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](../iter/trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)#### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](../iter/struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](../iter/trait.iterator#method.skip)s elements based on a predicate. [Read more](../iter/trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)#### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](../iter/struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](../iter/trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](../iter/struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](../iter/trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)#### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](../iter/struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](../iter/trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)#### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](../iter/struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](../iter/trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)#### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](../iter/struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](../iter/trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](../iter/trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)#### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](../iter/struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](../iter/trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)#### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](../iter/struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](../iter/trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)#### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](../iter/struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](../iter/trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)#### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](../iter/trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)#### fn collect<B>(self) -> Bwhere B: [FromIterator](../iter/trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](../iter/trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](../iter/trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)#### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](../iter/trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2079-2082)#### fn partition\_in\_place<'a, T, P>(self, predicate: P) -> usizewhere T: 'a, Self: [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator")<Item = [&'a mut](../primitive.reference) T>, P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_partition_in_place` [#62543](https://github.com/rust-lang/rust/issues/62543))
Reorders the elements of this iterator *in-place* according to the given predicate, such that all those that return `true` precede all those that return `false`. Returns the number of `true` elements found. [Read more](../iter/trait.iterator#method.partition_in_place)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](../iter/trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2230-2234)1.27.0 · #### fn try\_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](../iter/trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](../iter/trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2407-2410)#### fn fold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](../iter/trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](../iter/trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](../iter/trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)#### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)#### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)#### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](../iter/trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](../iter/trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](../iter/trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)#### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](../iter/trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2920-2923)#### fn rposition<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool), Self: [ExactSizeIterator](../iter/trait.exactsizeiterator "trait std::iter::ExactSizeIterator") + [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
Searches for an element in an iterator from the right, returning its index. [Read more](../iter/trait.iterator#method.rposition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](../iter/trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](../iter/trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3161-3163)#### fn rev(self) -> Rev<Self>where Self: [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
Notable traits for [Rev](../iter/struct.rev "struct std::iter::Rev")<I>
```
impl<I> Iterator for Rev<I>where
I: DoubleEndedIterator,
type Item = <I as Iterator>::Item;
```
Reverses an iterator’s direction. [Read more](../iter/trait.iterator#method.rev)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)#### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](../iter/trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](../iter/struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](../iter/trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)#### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](../iter/struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](../iter/trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3312-3314)#### fn cycle(self) -> Cycle<Self>where Self: [Clone](../clone/trait.clone "trait std::clone::Clone"),
Notable traits for [Cycle](../iter/struct.cycle "struct std::iter::Cycle")<I>
```
impl<I> Iterator for Cycle<I>where
I: Clone + Iterator,
type Item = <I as Iterator>::Item;
```
Repeats an iterator endlessly. [Read more](../iter/trait.iterator#method.cycle)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](../iter/struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](../iter/trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](../iter/trait.sum "trait std::iter::Sum")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](../iter/trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](../iter/trait.product "trait std::iter::Product")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](../iter/trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another. [Read more](../iter/trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another. [Read more](../iter/trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](../iter/trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are unequal to those of another. [Read more](../iter/trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](../iter/trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](../iter/trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](../iter/trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](../iter/trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](../iter/trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](../iter/trait.iterator#method.is_sorted_by_key)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1415)1.26.0 · ### impl<T> FusedIterator for Windows<'\_, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1412)### impl<T> TrustedLen for Windows<'\_, T>
Auto Trait Implementations
--------------------------
### impl<'a, T> RefUnwindSafe for Windows<'a, T>where T: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<'a, T> Send for Windows<'a, T>where T: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<'a, T> Sync for Windows<'a, T>where T: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<'a, T> Unpin for Windows<'a, T>
### impl<'a, T> UnwindSafe for Windows<'a, T>where T: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](../iter/trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](../iter/trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Struct std::slice::SplitNMut Struct std::slice::SplitNMut
============================
```
pub struct SplitNMut<'a, T, P>where T: 'a, P: FnMut(&T) -> bool,{ /* private fields */ }
```
An iterator over subslices separated by elements that match a predicate function, limited to a given number of splits.
This struct is created by the [`splitn_mut`](../primitive.slice#method.splitn_mut) method on [slices](../primitive.slice).
Example
-------
```
let mut slice = [10, 40, 30, 20, 60, 50];
let iter = slice.splitn_mut(2, |num| *num % 3 == 0);
```
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1228)1.9.0 · ### impl<T, P> Debug for SplitNMut<'\_, T, P>where T: [Debug](../fmt/trait.debug "trait std::fmt::Debug"), P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1232)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1280)### impl<'a, T, P> Iterator for SplitNMut<'a, T, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
#### type Item = &'a mut [T]
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1280)#### fn next(&mut self) -> Option<&'a mut [T]>
Advances the iterator and returns the next value. [Read more](../iter/trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1280)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](../iter/trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](../iter/trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#252-254)#### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](../iter/trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#282-284)#### fn last(self) -> Option<Self::Item>
Consumes the iterator, returning the last element. [Read more](../iter/trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#328)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](../iter/trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#376)#### fn nth(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element of the iterator. [Read more](../iter/trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](../iter/struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](../iter/trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)#### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](../iter/struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](../iter/trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)#### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](../iter/struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](../iter/trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](../iter/struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](../iter/trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)#### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](../iter/struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](../iter/trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](../iter/trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)#### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](../iter/struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](../iter/trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)#### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](../iter/struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](../iter/trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)#### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](../iter/struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](../iter/trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)#### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](../iter/struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](../iter/struct.peekable#method.peek) and [`peek_mut`](../iter/struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](../iter/trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)#### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](../iter/struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](../iter/trait.iterator#method.skip)s elements based on a predicate. [Read more](../iter/trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)#### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](../iter/struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](../iter/trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](../iter/struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](../iter/trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)#### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](../iter/struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](../iter/trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)#### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](../iter/struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](../iter/trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)#### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](../iter/struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](../iter/trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](../iter/trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)#### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](../iter/struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](../iter/trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)#### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](../iter/struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](../iter/trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)#### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](../iter/struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](../iter/trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)#### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](../iter/trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)#### fn collect<B>(self) -> Bwhere B: [FromIterator](../iter/trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](../iter/trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](../iter/trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)#### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](../iter/trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](../iter/trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2230-2234)1.27.0 · #### fn try\_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](../iter/trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](../iter/trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2407-2410)#### fn fold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](../iter/trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](../iter/trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](../iter/trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)#### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)#### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)#### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](../iter/trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](../iter/trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](../iter/trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)#### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](../iter/trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](../iter/trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](../iter/trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)#### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](../iter/trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](../iter/struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](../iter/trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)#### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](../iter/struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](../iter/trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](../iter/struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](../iter/trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](../iter/trait.sum "trait std::iter::Sum")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](../iter/trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](../iter/trait.product "trait std::iter::Product")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](../iter/trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another. [Read more](../iter/trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another. [Read more](../iter/trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](../iter/trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are unequal to those of another. [Read more](../iter/trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](../iter/trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](../iter/trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](../iter/trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](../iter/trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](../iter/trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](../iter/trait.iterator#method.is_sorted_by_key)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1280)1.26.0 · ### impl<'a, T, P> FusedIterator for SplitNMut<'a, T, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
Auto Trait Implementations
--------------------------
### impl<'a, T, P> RefUnwindSafe for SplitNMut<'a, T, P>where P: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"), T: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<'a, T, P> Send for SplitNMut<'a, T, P>where P: [Send](../marker/trait.send "trait std::marker::Send"), T: [Send](../marker/trait.send "trait std::marker::Send"),
### impl<'a, T, P> Sync for SplitNMut<'a, T, P>where P: [Sync](../marker/trait.sync "trait std::marker::Sync"), T: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<'a, T, P> Unpin for SplitNMut<'a, T, P>where P: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"),
### impl<'a, T, P> !UnwindSafe for SplitNMut<'a, T, P>
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](../iter/trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](../iter/trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Struct std::slice::RChunksMut Struct std::slice::RChunksMut
=============================
```
pub struct RChunksMut<'a, T>where T: 'a,{ /* private fields */ }
```
An iterator over a slice in (non-overlapping) mutable chunks (`chunk_size` elements at a time), starting at the end of the slice.
When the slice len is not evenly divided by the chunk size, the last slice of the iteration will be the remainder.
This struct is created by the [`rchunks_mut`](../primitive.slice#method.rchunks_mut) method on [slices](../primitive.slice).
Example
-------
```
let mut slice = ['l', 'o', 'r', 'e', 'm'];
let iter = slice.rchunks_mut(2);
```
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2681)### impl<'a, T> Debug for RChunksMut<'a, T>where T: 'a + [Debug](../fmt/trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2681)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2793)### impl<'a, T> DoubleEndedIterator for RChunksMut<'a, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2795)#### fn next\_back(&mut self) -> Option<&'a mut [T]>
Removes and returns an element from the end of the iterator. [Read more](../iter/trait.doubleendediterator#tymethod.next_back)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2810)#### fn nth\_back(&mut self, n: usize) -> Option<<RChunksMut<'a, T> as Iterator>::Item>
Returns the `n`th element from the end of the iterator. [Read more](../iter/trait.doubleendediterator#method.nth_back)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#134)#### fn advance\_back\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator from the back by `n` elements. [Read more](../iter/trait.doubleendediterator#method.advance_back_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#221-225)1.27.0 · #### fn try\_rfold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
This is the reverse version of [`Iterator::try_fold()`](../iter/trait.iterator#method.try_fold "Iterator::try_fold()"): it takes elements starting from the back of the iterator. [Read more](../iter/trait.doubleendediterator#method.try_rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#292-295)1.27.0 · #### fn rfold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
An iterator method that reduces the iterator’s elements to a single, final value, starting from the back. [Read more](../iter/trait.doubleendediterator#method.rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#347-350)1.27.0 · #### fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator from the back that satisfies a predicate. [Read more](../iter/trait.doubleendediterator#method.rfind)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2832)### impl<T> ExactSizeIterator for RChunksMut<'\_, T>
[source](https://doc.rust-lang.org/src/core/iter/traits/exact_size.rs.html#106)1.0.0 · #### fn len(&self) -> usize
Returns the exact remaining length of the iterator. [Read more](../iter/trait.exactsizeiterator#method.len)
[source](https://doc.rust-lang.org/src/core/iter/traits/exact_size.rs.html#138)#### fn is\_empty(&self) -> bool
🔬This is a nightly-only experimental API. (`exact_size_is_empty` [#35428](https://github.com/rust-lang/rust/issues/35428))
Returns `true` if the iterator is empty. [Read more](../iter/trait.exactsizeiterator#method.is_empty)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2704)### impl<'a, T> Iterator for RChunksMut<'a, T>
#### type Item = &'a mut [T]
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2708)#### fn next(&mut self) -> Option<&'a mut [T]>
Advances the iterator and returns the next value. [Read more](../iter/trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2727)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](../iter/trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2739)#### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](../iter/trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2744)#### fn nth(&mut self, n: usize) -> Option<&'a mut [T]>
Returns the `n`th element of the iterator. [Read more](../iter/trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2769)#### fn last(self) -> Option<<RChunksMut<'a, T> as Iterator>::Item>
Consumes the iterator, returning the last element. [Read more](../iter/trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](../iter/trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#328)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](../iter/trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](../iter/struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](../iter/trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)1.0.0 · #### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](../iter/struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](../iter/trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)1.0.0 · #### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](../iter/struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](../iter/trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](../iter/struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](../iter/trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)1.0.0 · #### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](../iter/struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](../iter/trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](../iter/trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)1.0.0 · #### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](../iter/struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](../iter/trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)1.0.0 · #### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](../iter/struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](../iter/trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)1.0.0 · #### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](../iter/struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](../iter/trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)1.0.0 · #### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](../iter/struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](../iter/struct.peekable#method.peek) and [`peek_mut`](../iter/struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](../iter/trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)1.0.0 · #### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](../iter/struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](../iter/trait.iterator#method.skip)s elements based on a predicate. [Read more](../iter/trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)1.0.0 · #### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](../iter/struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](../iter/trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](../iter/struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](../iter/trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)1.0.0 · #### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](../iter/struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](../iter/trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)1.0.0 · #### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](../iter/struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](../iter/trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)1.0.0 · #### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](../iter/struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](../iter/trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](../iter/trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)1.0.0 · #### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](../iter/struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](../iter/trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)1.0.0 · #### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](../iter/struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](../iter/trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)1.0.0 · #### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](../iter/struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](../iter/trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)1.0.0 · #### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](../iter/trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)1.0.0 · #### fn collect<B>(self) -> Bwhere B: [FromIterator](../iter/trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](../iter/trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](../iter/trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)1.0.0 · #### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](../iter/trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2079-2082)#### fn partition\_in\_place<'a, T, P>(self, predicate: P) -> usizewhere T: 'a, Self: [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator")<Item = [&'a mut](../primitive.reference) T>, P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_partition_in_place` [#62543](https://github.com/rust-lang/rust/issues/62543))
Reorders the elements of this iterator *in-place* according to the given predicate, such that all those that return `true` precede all those that return `false`. Returns the number of `true` elements found. [Read more](../iter/trait.iterator#method.partition_in_place)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](../iter/trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2230-2234)1.27.0 · #### fn try\_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](../iter/trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](../iter/trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2407-2410)1.0.0 · #### fn fold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](../iter/trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](../iter/trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](../iter/trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)1.0.0 · #### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)1.0.0 · #### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)1.0.0 · #### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](../iter/trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](../iter/trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](../iter/trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)1.0.0 · #### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](../iter/trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2920-2923)1.0.0 · #### fn rposition<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool), Self: [ExactSizeIterator](../iter/trait.exactsizeiterator "trait std::iter::ExactSizeIterator") + [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
Searches for an element in an iterator from the right, returning its index. [Read more](../iter/trait.iterator#method.rposition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](../iter/trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](../iter/trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3161-3163)1.0.0 · #### fn rev(self) -> Rev<Self>where Self: [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
Notable traits for [Rev](../iter/struct.rev "struct std::iter::Rev")<I>
```
impl<I> Iterator for Rev<I>where
I: DoubleEndedIterator,
type Item = <I as Iterator>::Item;
```
Reverses an iterator’s direction. [Read more](../iter/trait.iterator#method.rev)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)1.0.0 · #### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](../iter/trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](../iter/struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](../iter/trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)1.0.0 · #### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](../iter/struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](../iter/trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](../iter/struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](../iter/trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](../iter/trait.sum "trait std::iter::Sum")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](../iter/trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](../iter/trait.product "trait std::iter::Product")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](../iter/trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another. [Read more](../iter/trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another. [Read more](../iter/trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](../iter/trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are unequal to those of another. [Read more](../iter/trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](../iter/trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](../iter/trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](../iter/trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](../iter/trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](../iter/trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](../iter/trait.iterator#method.is_sorted_by_key)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2838)### impl<T> FusedIterator for RChunksMut<'\_, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2851)### impl<T> Send for RChunksMut<'\_, T>where T: [Send](../marker/trait.send "trait std::marker::Send"),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2854)### impl<T> Sync for RChunksMut<'\_, T>where T: [Sync](../marker/trait.sync "trait std::marker::Sync"),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2835)### impl<T> TrustedLen for RChunksMut<'\_, T>
Auto Trait Implementations
--------------------------
### impl<'a, T> RefUnwindSafe for RChunksMut<'a, T>where T: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<'a, T> Unpin for RChunksMut<'a, T>
### impl<'a, T> !UnwindSafe for RChunksMut<'a, T>
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](../iter/trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](../iter/trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Trait std::slice::SliceIndex Trait std::slice::SliceIndex
============================
```
pub unsafe trait SliceIndex<T>: Sealedwhere T: ?Sized,{
type Output: ?Sized;
fn get(self, slice: &T) -> Option<&Self::Output>;
fn get_mut(self, slice: &mut T) -> Option<&mut Self::Output>;
unsafe fn get_unchecked(self, slice: *const T) -> *const Self::Output;
unsafe fn get_unchecked_mut(self, slice: *mut T) -> *mut Self::Output;
fn index(self, slice: &T) -> &Self::Output;
fn index_mut(self, slice: &mut T) -> &mut Self::Output;
}
```
A helper trait used for indexing operations.
Implementations of this trait have to promise that if the argument to `get_unchecked(_mut)` is a safe reference, then so is the result.
Required Associated Types
-------------------------
[source](https://doc.rust-lang.org/src/core/slice/index.rs.html#164)#### type Output: ?Sized
The output type returned by methods.
Required Methods
----------------
[source](https://doc.rust-lang.org/src/core/slice/index.rs.html#169)#### fn get(self, slice: &T) -> Option<&Self::Output>
🔬This is a nightly-only experimental API. (`slice_index_methods`)
Returns a shared reference to the output at this location, if in bounds.
[source](https://doc.rust-lang.org/src/core/slice/index.rs.html#174)#### fn get\_mut(self, slice: &mut T) -> Option<&mut Self::Output>
🔬This is a nightly-only experimental API. (`slice_index_methods`)
Returns a mutable reference to the output at this location, if in bounds.
[source](https://doc.rust-lang.org/src/core/slice/index.rs.html#183)#### unsafe fn get\_unchecked(self, slice: \*const T) -> \*const Self::Output
🔬This is a nightly-only experimental API. (`slice_index_methods`)
Returns a shared reference to the output at this location, without performing any bounds checking. Calling this method with an out-of-bounds index or a dangling `slice` pointer is *[undefined behavior](../../reference/behavior-considered-undefined)* even if the resulting reference is not used.
[source](https://doc.rust-lang.org/src/core/slice/index.rs.html#192)#### unsafe fn get\_unchecked\_mut(self, slice: \*mut T) -> \*mut Self::Output
🔬This is a nightly-only experimental API. (`slice_index_methods`)
Returns a mutable reference to the output at this location, without performing any bounds checking. Calling this method with an out-of-bounds index or a dangling `slice` pointer is *[undefined behavior](../../reference/behavior-considered-undefined)* even if the resulting reference is not used.
[source](https://doc.rust-lang.org/src/core/slice/index.rs.html#198)#### fn index(self, slice: &T) -> &Self::Output
🔬This is a nightly-only experimental API. (`slice_index_methods`)
Returns a shared reference to the output at this location, panicking if out of bounds.
[source](https://doc.rust-lang.org/src/core/slice/index.rs.html#204)#### fn index\_mut(self, slice: &mut T) -> &mut Self::Output
🔬This is a nightly-only experimental API. (`slice_index_methods`)
Returns a mutable reference to the output at this location, panicking if out of bounds.
Implementors
------------
[source](https://doc.rust-lang.org/src/core/str/traits.rs.html#167)1.20.0 (const: unstable) · ### impl SliceIndex<str> for Range<usize>
Implements substring slicing with syntax `&self[begin .. end]` or `&mut self[begin .. end]`.
Returns a slice of the given string from the byte range [`begin`, `end`).
This operation is *O*(1).
Prior to 1.20.0, these indexing operations were still supported by direct implementation of `Index` and `IndexMut`.
#### Panics
Panics if `begin` or `end` does not point to the starting byte offset of a character (as defined by `is_char_boundary`), if `begin > end`, or if `end > len`.
#### Examples
```
let s = "Löwe 老虎 Léopard";
assert_eq!(&s[0 .. 1], "L");
assert_eq!(&s[1 .. 9], "öwe 老");
// these will panic:
// byte 2 lies within `ö`:
// &s[2 ..3];
// byte 8 lies within `老`
// &s[1 .. 8];
// byte 100 is outside the string
// &s[3 .. 100];
```
#### type Output = str
[source](https://doc.rust-lang.org/src/core/str/traits.rs.html#326)1.20.0 (const: unstable) · ### impl SliceIndex<str> for RangeFrom<usize>
Implements substring slicing with syntax `&self[begin ..]` or `&mut self[begin ..]`.
Returns a slice of the given string from the byte range [`begin`, `len`). Equivalent to `&self[begin .. len]` or `&mut self[begin .. len]`.
This operation is *O*(1).
Prior to 1.20.0, these indexing operations were still supported by direct implementation of `Index` and `IndexMut`.
#### Panics
Panics if `begin` does not point to the starting byte offset of a character (as defined by `is_char_boundary`), or if `begin > len`.
#### type Output = str
[source](https://doc.rust-lang.org/src/core/str/traits.rs.html#102)1.20.0 (const: unstable) · ### impl SliceIndex<str> for RangeFull
Implements substring slicing with syntax `&self[..]` or `&mut self[..]`.
Returns a slice of the whole string, i.e., returns `&self` or `&mut self`. Equivalent to `&self[0 .. len]` or `&mut self[0 .. len]`. Unlike other indexing operations, this can never panic.
This operation is *O*(1).
Prior to 1.20.0, these indexing operations were still supported by direct implementation of `Index` and `IndexMut`.
Equivalent to `&self[0 .. len]` or `&mut self[0 .. len]`.
#### type Output = str
[source](https://doc.rust-lang.org/src/core/str/traits.rs.html#403)1.26.0 (const: unstable) · ### impl SliceIndex<str> for RangeInclusive<usize>
Implements substring slicing with syntax `&self[begin ..= end]` or `&mut self[begin ..= end]`.
Returns a slice of the given string from the byte range [`begin`, `end`]. Equivalent to `&self [begin .. end + 1]` or `&mut self[begin .. end + 1]`, except if `end` has the maximum value for `usize`.
This operation is *O*(1).
#### Panics
Panics if `begin` does not point to the starting byte offset of a character (as defined by `is_char_boundary`), if `end` does not point to the ending byte offset of a character (`end + 1` is either a starting byte offset or equal to `len`), if `begin > end`, or if `end >= len`.
#### type Output = str
[source](https://doc.rust-lang.org/src/core/str/traits.rs.html#255)1.20.0 (const: unstable) · ### impl SliceIndex<str> for RangeTo<usize>
Implements substring slicing with syntax `&self[.. end]` or `&mut self[.. end]`.
Returns a slice of the given string from the byte range [0, `end`). Equivalent to `&self[0 .. end]` or `&mut self[0 .. end]`.
This operation is *O*(1).
Prior to 1.20.0, these indexing operations were still supported by direct implementation of `Index` and `IndexMut`.
#### Panics
Panics if `end` does not point to the starting byte offset of a character (as defined by `is_char_boundary`), or if `end > len`.
#### type Output = str
[source](https://doc.rust-lang.org/src/core/str/traits.rs.html#455)1.26.0 (const: unstable) · ### impl SliceIndex<str> for RangeToInclusive<usize>
Implements substring slicing with syntax `&self[..= end]` or `&mut self[..= end]`.
Returns a slice of the given string from the byte range [0, `end`]. Equivalent to `&self [0 .. end + 1]`, except if `end` has the maximum value for `usize`.
This operation is *O*(1).
#### Panics
Panics if `end` does not point to the ending byte offset of a character (`end + 1` is either a starting byte offset as defined by `is_char_boundary`, or equal to `len`), or if `end >= len`.
#### type Output = str
[source](https://doc.rust-lang.org/src/core/slice/index.rs.html#708)1.53.0 · ### impl<T> SliceIndex<[T]> for (Bound<usize>, Bound<usize>)
#### type Output = [T]
[source](https://doc.rust-lang.org/src/core/slice/index.rs.html#209)1.15.0 (const: unstable) · ### impl<T> SliceIndex<[T]> for usize
#### type Output = T
[source](https://doc.rust-lang.org/src/core/slice/index.rs.html#262)1.15.0 (const: unstable) · ### impl<T> SliceIndex<[T]> for Range<usize>
#### type Output = [T]
[source](https://doc.rust-lang.org/src/core/slice/index.rs.html#374)1.15.0 (const: unstable) · ### impl<T> SliceIndex<[T]> for RangeFrom<usize>
#### type Output = [T]
[source](https://doc.rust-lang.org/src/core/slice/index.rs.html#420)1.15.0 (const: unstable) · ### impl<T> SliceIndex<[T]> for RangeFull
#### type Output = [T]
[source](https://doc.rust-lang.org/src/core/slice/index.rs.html#456)1.26.0 (const: unstable) · ### impl<T> SliceIndex<[T]> for RangeInclusive<usize>
#### type Output = [T]
[source](https://doc.rust-lang.org/src/core/slice/index.rs.html#336)1.15.0 (const: unstable) · ### impl<T> SliceIndex<[T]> for RangeTo<usize>
#### type Output = [T]
[source](https://doc.rust-lang.org/src/core/slice/index.rs.html#500)1.26.0 (const: unstable) · ### impl<T> SliceIndex<[T]> for RangeToInclusive<usize>
#### type Output = [T]
rust Struct std::slice::RSplitN Struct std::slice::RSplitN
==========================
```
pub struct RSplitN<'a, T, P>where T: 'a, P: FnMut(&T) -> bool,{ /* private fields */ }
```
An iterator over subslices separated by elements that match a predicate function, limited to a given number of splits, starting from the end of the slice.
This struct is created by the [`rsplitn`](../primitive.slice#method.rsplitn) method on [slices](../primitive.slice).
Example
-------
```
let slice = [10, 40, 30, 20, 60, 50];
let iter = slice.rsplitn(2, |num| *num % 3 == 0);
```
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1188)1.9.0 · ### impl<T, P> Debug for RSplitN<'\_, T, P>where T: [Debug](../fmt/trait.debug "trait std::fmt::Debug"), P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1192)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1279)### impl<'a, T, P> Iterator for RSplitN<'a, T, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
#### type Item = &'a [T]
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1279)#### fn next(&mut self) -> Option<&'a [T]>
Advances the iterator and returns the next value. [Read more](../iter/trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1279)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](../iter/trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](../iter/trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#252-254)#### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](../iter/trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#282-284)#### fn last(self) -> Option<Self::Item>
Consumes the iterator, returning the last element. [Read more](../iter/trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#328)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](../iter/trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#376)#### fn nth(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element of the iterator. [Read more](../iter/trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](../iter/struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](../iter/trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)#### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](../iter/struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](../iter/trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)#### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](../iter/struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](../iter/trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](../iter/struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](../iter/trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)#### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](../iter/struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](../iter/trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](../iter/trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)#### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](../iter/struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](../iter/trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)#### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](../iter/struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](../iter/trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)#### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](../iter/struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](../iter/trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)#### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](../iter/struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](../iter/struct.peekable#method.peek) and [`peek_mut`](../iter/struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](../iter/trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)#### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](../iter/struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](../iter/trait.iterator#method.skip)s elements based on a predicate. [Read more](../iter/trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)#### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](../iter/struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](../iter/trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](../iter/struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](../iter/trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)#### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](../iter/struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](../iter/trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)#### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](../iter/struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](../iter/trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)#### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](../iter/struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](../iter/trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](../iter/trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)#### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](../iter/struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](../iter/trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)#### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](../iter/struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](../iter/trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)#### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](../iter/struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](../iter/trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)#### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](../iter/trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)#### fn collect<B>(self) -> Bwhere B: [FromIterator](../iter/trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](../iter/trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](../iter/trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)#### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](../iter/trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](../iter/trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2230-2234)1.27.0 · #### fn try\_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](../iter/trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](../iter/trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2407-2410)#### fn fold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](../iter/trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](../iter/trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](../iter/trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)#### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)#### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)#### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](../iter/trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](../iter/trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](../iter/trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)#### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](../iter/trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](../iter/trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](../iter/trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)#### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](../iter/trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](../iter/struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](../iter/trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)#### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](../iter/struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](../iter/trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](../iter/struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](../iter/trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](../iter/trait.sum "trait std::iter::Sum")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](../iter/trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](../iter/trait.product "trait std::iter::Product")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](../iter/trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another. [Read more](../iter/trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another. [Read more](../iter/trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](../iter/trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are unequal to those of another. [Read more](../iter/trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](../iter/trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](../iter/trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](../iter/trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](../iter/trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](../iter/trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](../iter/trait.iterator#method.is_sorted_by_key)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1279)1.26.0 · ### impl<'a, T, P> FusedIterator for RSplitN<'a, T, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
Auto Trait Implementations
--------------------------
### impl<'a, T, P> RefUnwindSafe for RSplitN<'a, T, P>where P: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"), T: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<'a, T, P> Send for RSplitN<'a, T, P>where P: [Send](../marker/trait.send "trait std::marker::Send"), T: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<'a, T, P> Sync for RSplitN<'a, T, P>where P: [Sync](../marker/trait.sync "trait std::marker::Sync"), T: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<'a, T, P> Unpin for RSplitN<'a, T, P>where P: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"),
### impl<'a, T, P> UnwindSafe for RSplitN<'a, T, P>where P: [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"), T: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](../iter/trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](../iter/trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Struct std::slice::EscapeAscii Struct std::slice::EscapeAscii
==============================
```
pub struct EscapeAscii<'a> { /* private fields */ }
```
An iterator over the escaped version of a byte slice.
This `struct` is created by the [`slice::escape_ascii`](../primitive.slice#method.escape_ascii "slice::escape_ascii") method. See its documentation for more information.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/slice/ascii.rs.html#173)### impl<'a> Clone for EscapeAscii<'a>
[source](https://doc.rust-lang.org/src/core/slice/ascii.rs.html#173)#### fn clone(&self) -> EscapeAscii<'a>
Notable traits for [EscapeAscii](struct.escapeascii "struct std::slice::EscapeAscii")<'a>
```
impl<'a> Iterator for EscapeAscii<'a>
type Item = u8;
```
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)1.0.0 · #### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/core/slice/ascii.rs.html#226)### impl<'a> Debug for EscapeAscii<'a>
[source](https://doc.rust-lang.org/src/core/slice/ascii.rs.html#227)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/slice/ascii.rs.html#220)### impl<'a> Display for EscapeAscii<'a>
[source](https://doc.rust-lang.org/src/core/slice/ascii.rs.html#221)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.display#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/slice/ascii.rs.html#212)### impl<'a> DoubleEndedIterator for EscapeAscii<'a>
[source](https://doc.rust-lang.org/src/core/slice/ascii.rs.html#213)#### fn next\_back(&mut self) -> Option<u8>
Removes and returns an element from the end of the iterator. [Read more](../iter/trait.doubleendediterator#tymethod.next_back)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#134)#### fn advance\_back\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator from the back by `n` elements. [Read more](../iter/trait.doubleendediterator#method.advance_back_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#184)1.37.0 · #### fn nth\_back(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element from the end of the iterator. [Read more](../iter/trait.doubleendediterator#method.nth_back)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#221-225)1.27.0 · #### fn try\_rfold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
This is the reverse version of [`Iterator::try_fold()`](../iter/trait.iterator#method.try_fold "Iterator::try_fold()"): it takes elements starting from the back of the iterator. [Read more](../iter/trait.doubleendediterator#method.try_rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#292-295)1.27.0 · #### fn rfold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
An iterator method that reduces the iterator’s elements to a single, final value, starting from the back. [Read more](../iter/trait.doubleendediterator#method.rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#347-350)1.27.0 · #### fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator from the back that satisfies a predicate. [Read more](../iter/trait.doubleendediterator#method.rfind)
[source](https://doc.rust-lang.org/src/core/slice/ascii.rs.html#180)### impl<'a> Iterator for EscapeAscii<'a>
#### type Item = u8
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/slice/ascii.rs.html#183)#### fn next(&mut self) -> Option<u8>
Advances the iterator and returns the next value. [Read more](../iter/trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/slice/ascii.rs.html#187)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](../iter/trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/slice/ascii.rs.html#191-194)#### fn try\_fold<Acc, Fold, R>(&mut self, init: Acc, fold: Fold) -> Rwhere Fold: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[EscapeAscii](struct.escapeascii "struct std::slice::EscapeAscii")<'a> as [Iterator](../iter/trait.iterator "trait std::iter::Iterator")>::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Acc>,
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](../iter/trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/slice/ascii.rs.html#199-201)#### fn fold<Acc, Fold>(self, init: Acc, fold: Fold) -> Accwhere Fold: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Acc, <[EscapeAscii](struct.escapeascii "struct std::slice::EscapeAscii")<'a> as [Iterator](../iter/trait.iterator "trait std::iter::Iterator")>::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Acc,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](../iter/trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/slice/ascii.rs.html#206)#### fn last(self) -> Option<u8>
Consumes the iterator, returning the last element. [Read more](../iter/trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](../iter/trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#252-254)1.0.0 · #### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](../iter/trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#328)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](../iter/trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#376)1.0.0 · #### fn nth(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element of the iterator. [Read more](../iter/trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](../iter/struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](../iter/trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)1.0.0 · #### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](../iter/struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](../iter/trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)1.0.0 · #### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](../iter/struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](../iter/trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](../iter/struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](../iter/trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)1.0.0 · #### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](../iter/struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](../iter/trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](../iter/trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)1.0.0 · #### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](../iter/struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](../iter/trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)1.0.0 · #### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](../iter/struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](../iter/trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)1.0.0 · #### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](../iter/struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](../iter/trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)1.0.0 · #### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](../iter/struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](../iter/struct.peekable#method.peek) and [`peek_mut`](../iter/struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](../iter/trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)1.0.0 · #### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](../iter/struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](../iter/trait.iterator#method.skip)s elements based on a predicate. [Read more](../iter/trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)1.0.0 · #### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](../iter/struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](../iter/trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](../iter/struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](../iter/trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)1.0.0 · #### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](../iter/struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](../iter/trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)1.0.0 · #### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](../iter/struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](../iter/trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)1.0.0 · #### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](../iter/struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](../iter/trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](../iter/trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)1.0.0 · #### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](../iter/struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](../iter/trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)1.0.0 · #### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](../iter/struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](../iter/trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)1.0.0 · #### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](../iter/struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](../iter/trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)1.0.0 · #### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](../iter/trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)1.0.0 · #### fn collect<B>(self) -> Bwhere B: [FromIterator](../iter/trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](../iter/trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](../iter/trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)1.0.0 · #### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](../iter/trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2079-2082)#### fn partition\_in\_place<'a, T, P>(self, predicate: P) -> usizewhere T: 'a, Self: [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator")<Item = [&'a mut](../primitive.reference) T>, P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_partition_in_place` [#62543](https://github.com/rust-lang/rust/issues/62543))
Reorders the elements of this iterator *in-place* according to the given predicate, such that all those that return `true` precede all those that return `false`. Returns the number of `true` elements found. [Read more](../iter/trait.iterator#method.partition_in_place)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](../iter/trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](../iter/trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](../iter/trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](../iter/trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)1.0.0 · #### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)1.0.0 · #### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)1.0.0 · #### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](../iter/trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](../iter/trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](../iter/trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)1.0.0 · #### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](../iter/trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](../iter/trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](../iter/trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3161-3163)1.0.0 · #### fn rev(self) -> Rev<Self>where Self: [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
Notable traits for [Rev](../iter/struct.rev "struct std::iter::Rev")<I>
```
impl<I> Iterator for Rev<I>where
I: DoubleEndedIterator,
type Item = <I as Iterator>::Item;
```
Reverses an iterator’s direction. [Read more](../iter/trait.iterator#method.rev)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)1.0.0 · #### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](../iter/trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](../iter/struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](../iter/trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)1.0.0 · #### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](../iter/struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](../iter/trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3312-3314)1.0.0 · #### fn cycle(self) -> Cycle<Self>where Self: [Clone](../clone/trait.clone "trait std::clone::Clone"),
Notable traits for [Cycle](../iter/struct.cycle "struct std::iter::Cycle")<I>
```
impl<I> Iterator for Cycle<I>where
I: Clone + Iterator,
type Item = <I as Iterator>::Item;
```
Repeats an iterator endlessly. [Read more](../iter/trait.iterator#method.cycle)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](../iter/struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](../iter/trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](../iter/trait.sum "trait std::iter::Sum")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](../iter/trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](../iter/trait.product "trait std::iter::Product")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](../iter/trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another. [Read more](../iter/trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another. [Read more](../iter/trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](../iter/trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are unequal to those of another. [Read more](../iter/trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](../iter/trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](../iter/trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](../iter/trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](../iter/trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](../iter/trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](../iter/trait.iterator#method.is_sorted_by_key)
[source](https://doc.rust-lang.org/src/core/slice/ascii.rs.html#218)### impl<'a> FusedIterator for EscapeAscii<'a>
Auto Trait Implementations
--------------------------
### impl<'a> RefUnwindSafe for EscapeAscii<'a>
### impl<'a> Send for EscapeAscii<'a>
### impl<'a> Sync for EscapeAscii<'a>
### impl<'a> Unpin for EscapeAscii<'a>
### impl<'a> UnwindSafe for EscapeAscii<'a>
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](../iter/trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](../iter/trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/alloc/string.rs.html#2500)### impl<T> ToString for Twhere T: [Display](../fmt/trait.display "trait std::fmt::Display") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/alloc/string.rs.html#2506)#### default fn to\_string(&self) -> String
Converts the given value to a `String`. [Read more](../string/trait.tostring#tymethod.to_string)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Struct std::slice::RChunksExact Struct std::slice::RChunksExact
===============================
```
pub struct RChunksExact<'a, T>where T: 'a,{ /* private fields */ }
```
An iterator over a slice in (non-overlapping) chunks (`chunk_size` elements at a time), starting at the end of the slice.
When the slice len is not evenly divided by the chunk size, the last up to `chunk_size-1` elements will be omitted but can be retrieved from the [`remainder`](struct.chunksexact#method.remainder) function from the iterator.
This struct is created by the [`rchunks_exact`](../primitive.slice#method.rchunks_exact) method on [slices](../primitive.slice).
Example
-------
```
let slice = ['l', 'o', 'r', 'e', 'm'];
let iter = slice.rchunks_exact(2);
```
Implementations
---------------
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2884)### impl<'a, T> RChunksExact<'a, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2898)#### pub fn remainder(&self) -> &'a [T]
Notable traits for &[[u8](../primitive.u8)]
```
impl Read for &[u8]
impl Write for &mut [u8]
```
Returns the remainder of the original slice that is not going to be returned by the iterator. The returned slice has at most `chunk_size-1` elements.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2905)### impl<'a, T> Clone for RChunksExact<'a, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2906)#### fn clone(&self) -> RChunksExact<'a, T>
Notable traits for [RChunksExact](struct.rchunksexact "struct std::slice::RChunksExact")<'a, T>
```
impl<'a, T> Iterator for RChunksExact<'a, T>
type Item = &'a [T];
```
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)1.0.0 · #### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2875)### impl<'a, T> Debug for RChunksExact<'a, T>where T: 'a + [Debug](../fmt/trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2875)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2964)### impl<'a, T> DoubleEndedIterator for RChunksExact<'a, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2966)#### fn next\_back(&mut self) -> Option<&'a [T]>
Removes and returns an element from the end of the iterator. [Read more](../iter/trait.doubleendediterator#tymethod.next_back)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2977)#### fn nth\_back( &mut self, n: usize) -> Option<<RChunksExact<'a, T> as Iterator>::Item>
Returns the `n`th element from the end of the iterator. [Read more](../iter/trait.doubleendediterator#method.nth_back)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#134)#### fn advance\_back\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator from the back by `n` elements. [Read more](../iter/trait.doubleendediterator#method.advance_back_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#221-225)1.27.0 · #### fn try\_rfold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
This is the reverse version of [`Iterator::try_fold()`](../iter/trait.iterator#method.try_fold "Iterator::try_fold()"): it takes elements starting from the back of the iterator. [Read more](../iter/trait.doubleendediterator#method.try_rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#292-295)1.27.0 · #### fn rfold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
An iterator method that reduces the iterator’s elements to a single, final value, starting from the back. [Read more](../iter/trait.doubleendediterator#method.rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#347-350)1.27.0 · #### fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator from the back that satisfies a predicate. [Read more](../iter/trait.doubleendediterator#method.rfind)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2996)### impl<'a, T> ExactSizeIterator for RChunksExact<'a, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2997)#### fn is\_empty(&self) -> bool
🔬This is a nightly-only experimental API. (`exact_size_is_empty` [#35428](https://github.com/rust-lang/rust/issues/35428))
Returns `true` if the iterator is empty. [Read more](../iter/trait.exactsizeiterator#method.is_empty)
[source](https://doc.rust-lang.org/src/core/iter/traits/exact_size.rs.html#106)1.0.0 · #### fn len(&self) -> usize
Returns the exact remaining length of the iterator. [Read more](../iter/trait.exactsizeiterator#method.len)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2912)### impl<'a, T> Iterator for RChunksExact<'a, T>
#### type Item = &'a [T]
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2916)#### fn next(&mut self) -> Option<&'a [T]>
Advances the iterator and returns the next value. [Read more](../iter/trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2927)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](../iter/trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2933)#### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](../iter/trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2938)#### fn nth(&mut self, n: usize) -> Option<<RChunksExact<'a, T> as Iterator>::Item>
Returns the `n`th element of the iterator. [Read more](../iter/trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2951)#### fn last(self) -> Option<<RChunksExact<'a, T> as Iterator>::Item>
Consumes the iterator, returning the last element. [Read more](../iter/trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](../iter/trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#328)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](../iter/trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](../iter/struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](../iter/trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)1.0.0 · #### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](../iter/struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](../iter/trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)1.0.0 · #### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](../iter/struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](../iter/trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](../iter/struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](../iter/trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)1.0.0 · #### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](../iter/struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](../iter/trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](../iter/trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)1.0.0 · #### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](../iter/struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](../iter/trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)1.0.0 · #### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](../iter/struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](../iter/trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)1.0.0 · #### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](../iter/struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](../iter/trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)1.0.0 · #### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](../iter/struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](../iter/struct.peekable#method.peek) and [`peek_mut`](../iter/struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](../iter/trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)1.0.0 · #### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](../iter/struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](../iter/trait.iterator#method.skip)s elements based on a predicate. [Read more](../iter/trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)1.0.0 · #### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](../iter/struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](../iter/trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](../iter/struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](../iter/trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)1.0.0 · #### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](../iter/struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](../iter/trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)1.0.0 · #### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](../iter/struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](../iter/trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)1.0.0 · #### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](../iter/struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](../iter/trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](../iter/trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)1.0.0 · #### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](../iter/struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](../iter/trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)1.0.0 · #### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](../iter/struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](../iter/trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)1.0.0 · #### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](../iter/struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](../iter/trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)1.0.0 · #### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](../iter/trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)1.0.0 · #### fn collect<B>(self) -> Bwhere B: [FromIterator](../iter/trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](../iter/trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](../iter/trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)1.0.0 · #### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](../iter/trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2079-2082)#### fn partition\_in\_place<'a, T, P>(self, predicate: P) -> usizewhere T: 'a, Self: [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator")<Item = [&'a mut](../primitive.reference) T>, P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_partition_in_place` [#62543](https://github.com/rust-lang/rust/issues/62543))
Reorders the elements of this iterator *in-place* according to the given predicate, such that all those that return `true` precede all those that return `false`. Returns the number of `true` elements found. [Read more](../iter/trait.iterator#method.partition_in_place)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](../iter/trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2230-2234)1.27.0 · #### fn try\_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](../iter/trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](../iter/trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2407-2410)1.0.0 · #### fn fold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](../iter/trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](../iter/trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](../iter/trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)1.0.0 · #### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)1.0.0 · #### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)1.0.0 · #### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](../iter/trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](../iter/trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](../iter/trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)1.0.0 · #### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](../iter/trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2920-2923)1.0.0 · #### fn rposition<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool), Self: [ExactSizeIterator](../iter/trait.exactsizeiterator "trait std::iter::ExactSizeIterator") + [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
Searches for an element in an iterator from the right, returning its index. [Read more](../iter/trait.iterator#method.rposition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](../iter/trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](../iter/trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3161-3163)1.0.0 · #### fn rev(self) -> Rev<Self>where Self: [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
Notable traits for [Rev](../iter/struct.rev "struct std::iter::Rev")<I>
```
impl<I> Iterator for Rev<I>where
I: DoubleEndedIterator,
type Item = <I as Iterator>::Item;
```
Reverses an iterator’s direction. [Read more](../iter/trait.iterator#method.rev)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)1.0.0 · #### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](../iter/trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](../iter/struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](../iter/trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)1.0.0 · #### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](../iter/struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](../iter/trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3312-3314)1.0.0 · #### fn cycle(self) -> Cycle<Self>where Self: [Clone](../clone/trait.clone "trait std::clone::Clone"),
Notable traits for [Cycle](../iter/struct.cycle "struct std::iter::Cycle")<I>
```
impl<I> Iterator for Cycle<I>where
I: Clone + Iterator,
type Item = <I as Iterator>::Item;
```
Repeats an iterator endlessly. [Read more](../iter/trait.iterator#method.cycle)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](../iter/struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](../iter/trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](../iter/trait.sum "trait std::iter::Sum")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](../iter/trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](../iter/trait.product "trait std::iter::Product")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](../iter/trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another. [Read more](../iter/trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another. [Read more](../iter/trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](../iter/trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are unequal to those of another. [Read more](../iter/trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](../iter/trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](../iter/trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](../iter/trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](../iter/trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](../iter/trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](../iter/trait.iterator#method.is_sorted_by_key)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#3006)### impl<T> FusedIterator for RChunksExact<'\_, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#3003)### impl<T> TrustedLen for RChunksExact<'\_, T>
Auto Trait Implementations
--------------------------
### impl<'a, T> RefUnwindSafe for RChunksExact<'a, T>where T: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<'a, T> Send for RChunksExact<'a, T>where T: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<'a, T> Sync for RChunksExact<'a, T>where T: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<'a, T> Unpin for RChunksExact<'a, T>
### impl<'a, T> UnwindSafe for RChunksExact<'a, T>where T: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](../iter/trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](../iter/trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Function std::slice::from_ptr_range Function std::slice::from\_ptr\_range
=====================================
```
pub unsafe fn from_ptr_range<'a, T>(range: Range<*const T>) -> &'a [T]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
```
🔬This is a nightly-only experimental API. (`slice_from_ptr_range` [#89792](https://github.com/rust-lang/rust/issues/89792))
Forms a slice from a pointer range.
This function is useful for interacting with foreign interfaces which use two pointers to refer to a range of elements in memory, as is common in C++.
Safety
------
Behavior is undefined if any of the following conditions are violated:
* The `start` pointer of the range must be a [valid](../ptr/index#safety) and properly aligned pointer to the first element of a slice.
* The `end` pointer must be a [valid](../ptr/index#safety) and properly aligned pointer to *one past* the last element, such that the offset from the end to the start pointer is the length of the slice.
* The range must contain `N` consecutive properly initialized values of type `T`:
+ The entire memory range of this slice must be contained within a single allocated object! Slices can never span across multiple allocated objects.
* The memory referenced by the returned slice must not be mutated for the duration of lifetime `'a`, except inside an `UnsafeCell`.
* The total length of the range must be no larger than `isize::MAX`. See the safety documentation of [`pointer::offset`](../primitive.pointer#method.offset "pointer::offset").
Note that a range created from [`slice::as_ptr_range`](../primitive.slice#method.as_ptr_range "slice::as_ptr_range") fulfills these requirements.
Caveat
------
The lifetime for the returned slice is inferred from its usage. To prevent accidental misuse, it’s suggested to tie the lifetime to whichever source lifetime is safe in the context, such as by providing a helper function taking the lifetime of a host value for the slice, or by explicit annotation.
Examples
--------
```
#![feature(slice_from_ptr_range)]
use core::slice;
let x = [1, 2, 3];
let range = x.as_ptr_range();
unsafe {
assert_eq!(slice::from_ptr_range(range), &x);
}
```
rust Struct std::slice::ArrayChunksMut Struct std::slice::ArrayChunksMut
=================================
```
pub struct ArrayChunksMut<'a, T, const N: usize>where T: 'a,{ /* private fields */ }
```
🔬This is a nightly-only experimental API. (`array_chunks` [#74985](https://github.com/rust-lang/rust/issues/74985))
An iterator over a slice in (non-overlapping) mutable chunks (`N` elements at a time), starting at the beginning of the slice.
When the slice len is not evenly divided by the chunk size, the last up to `N-1` elements will be omitted but can be retrieved from the [`into_remainder`](struct.arraychunksmut#method.into_remainder) function from the iterator.
This struct is created by the [`array_chunks_mut`](../primitive.slice#method.array_chunks_mut) method on [slices](../primitive.slice).
Example
-------
```
#![feature(array_chunks)]
let mut slice = ['l', 'o', 'r', 'e', 'm'];
let iter = slice.array_chunks_mut::<2>();
```
Implementations
---------------
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2402)### impl<'a, T, const N: usize> ArrayChunksMut<'a, T, N>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2414)#### pub fn into\_remainder(self) -> &'a mut [T]
Notable traits for &[[u8](../primitive.u8)]
```
impl Read for &[u8]
impl Write for &mut [u8]
```
🔬This is a nightly-only experimental API. (`array_chunks` [#74985](https://github.com/rust-lang/rust/issues/74985))
Returns the remainder of the original slice that is not going to be returned by the iterator. The returned slice has at most `N-1` elements.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2394)### impl<'a, T, const N: usize> Debug for ArrayChunksMut<'a, T, N>where T: 'a + [Debug](../fmt/trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2394)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2456)### impl<'a, T, const N: usize> DoubleEndedIterator for ArrayChunksMut<'a, T, N>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2458)#### fn next\_back(&mut self) -> Option<&'a mut [T; N]>
Removes and returns an element from the end of the iterator. [Read more](../iter/trait.doubleendediterator#tymethod.next_back)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2463)#### fn nth\_back( &mut self, n: usize) -> Option<<ArrayChunksMut<'a, T, N> as Iterator>::Item>
Returns the `n`th element from the end of the iterator. [Read more](../iter/trait.doubleendediterator#method.nth_back)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#134)#### fn advance\_back\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator from the back by `n` elements. [Read more](../iter/trait.doubleendediterator#method.advance_back_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#221-225)1.27.0 · #### fn try\_rfold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
This is the reverse version of [`Iterator::try_fold()`](../iter/trait.iterator#method.try_fold "Iterator::try_fold()"): it takes elements starting from the back of the iterator. [Read more](../iter/trait.doubleendediterator#method.try_rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#292-295)1.27.0 · #### fn rfold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
An iterator method that reduces the iterator’s elements to a single, final value, starting from the back. [Read more](../iter/trait.doubleendediterator#method.rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#347-350)1.27.0 · #### fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator from the back that satisfies a predicate. [Read more](../iter/trait.doubleendediterator#method.rfind)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2469)### impl<T, const N: usize> ExactSizeIterator for ArrayChunksMut<'\_, T, N>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2470)#### fn is\_empty(&self) -> bool
🔬This is a nightly-only experimental API. (`exact_size_is_empty` [#35428](https://github.com/rust-lang/rust/issues/35428))
Returns `true` if the iterator is empty. [Read more](../iter/trait.exactsizeiterator#method.is_empty)
[source](https://doc.rust-lang.org/src/core/iter/traits/exact_size.rs.html#106)1.0.0 · #### fn len(&self) -> usize
Returns the exact remaining length of the iterator. [Read more](../iter/trait.exactsizeiterator#method.len)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2420)### impl<'a, T, const N: usize> Iterator for ArrayChunksMut<'a, T, N>
#### type Item = &'a mut [T; N]
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2424)#### fn next(&mut self) -> Option<&'a mut [T; N]>
Advances the iterator and returns the next value. [Read more](../iter/trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2429)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](../iter/trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2434)#### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](../iter/trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2439)#### fn nth( &mut self, n: usize) -> Option<<ArrayChunksMut<'a, T, N> as Iterator>::Item>
Returns the `n`th element of the iterator. [Read more](../iter/trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2444)#### fn last(self) -> Option<<ArrayChunksMut<'a, T, N> as Iterator>::Item>
Consumes the iterator, returning the last element. [Read more](../iter/trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](../iter/trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#328)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](../iter/trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](../iter/struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](../iter/trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)1.0.0 · #### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](../iter/struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](../iter/trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)1.0.0 · #### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](../iter/struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](../iter/trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](../iter/struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](../iter/trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)1.0.0 · #### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](../iter/struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](../iter/trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](../iter/trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)1.0.0 · #### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](../iter/struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](../iter/trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)1.0.0 · #### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](../iter/struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](../iter/trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)1.0.0 · #### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](../iter/struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](../iter/trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)1.0.0 · #### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](../iter/struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](../iter/struct.peekable#method.peek) and [`peek_mut`](../iter/struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](../iter/trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)1.0.0 · #### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](../iter/struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](../iter/trait.iterator#method.skip)s elements based on a predicate. [Read more](../iter/trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)1.0.0 · #### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](../iter/struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](../iter/trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](../iter/struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](../iter/trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)1.0.0 · #### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](../iter/struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](../iter/trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)1.0.0 · #### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](../iter/struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](../iter/trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)1.0.0 · #### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](../iter/struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](../iter/trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](../iter/trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)1.0.0 · #### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](../iter/struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](../iter/trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)1.0.0 · #### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](../iter/struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](../iter/trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)1.0.0 · #### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](../iter/struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](../iter/trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)1.0.0 · #### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](../iter/trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)1.0.0 · #### fn collect<B>(self) -> Bwhere B: [FromIterator](../iter/trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](../iter/trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](../iter/trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)1.0.0 · #### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](../iter/trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2079-2082)#### fn partition\_in\_place<'a, T, P>(self, predicate: P) -> usizewhere T: 'a, Self: [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator")<Item = [&'a mut](../primitive.reference) T>, P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_partition_in_place` [#62543](https://github.com/rust-lang/rust/issues/62543))
Reorders the elements of this iterator *in-place* according to the given predicate, such that all those that return `true` precede all those that return `false`. Returns the number of `true` elements found. [Read more](../iter/trait.iterator#method.partition_in_place)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](../iter/trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2230-2234)1.27.0 · #### fn try\_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](../iter/trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](../iter/trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2407-2410)1.0.0 · #### fn fold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](../iter/trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](../iter/trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](../iter/trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)1.0.0 · #### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)1.0.0 · #### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)1.0.0 · #### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](../iter/trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](../iter/trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](../iter/trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)1.0.0 · #### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](../iter/trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2920-2923)1.0.0 · #### fn rposition<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool), Self: [ExactSizeIterator](../iter/trait.exactsizeiterator "trait std::iter::ExactSizeIterator") + [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
Searches for an element in an iterator from the right, returning its index. [Read more](../iter/trait.iterator#method.rposition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](../iter/trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](../iter/trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3161-3163)1.0.0 · #### fn rev(self) -> Rev<Self>where Self: [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
Notable traits for [Rev](../iter/struct.rev "struct std::iter::Rev")<I>
```
impl<I> Iterator for Rev<I>where
I: DoubleEndedIterator,
type Item = <I as Iterator>::Item;
```
Reverses an iterator’s direction. [Read more](../iter/trait.iterator#method.rev)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)1.0.0 · #### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](../iter/trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](../iter/struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](../iter/trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)1.0.0 · #### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](../iter/struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](../iter/trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](../iter/struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](../iter/trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](../iter/trait.sum "trait std::iter::Sum")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](../iter/trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](../iter/trait.product "trait std::iter::Product")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](../iter/trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another. [Read more](../iter/trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another. [Read more](../iter/trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](../iter/trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are unequal to those of another. [Read more](../iter/trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](../iter/trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](../iter/trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](../iter/trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](../iter/trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](../iter/trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](../iter/trait.iterator#method.is_sorted_by_key)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2479)### impl<T, const N: usize> FusedIterator for ArrayChunksMut<'\_, T, N>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#2476)### impl<T, const N: usize> TrustedLen for ArrayChunksMut<'\_, T, N>
Auto Trait Implementations
--------------------------
### impl<'a, T, const N: usize> RefUnwindSafe for ArrayChunksMut<'a, T, N>where T: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<'a, T, const N: usize> Send for ArrayChunksMut<'a, T, N>where T: [Send](../marker/trait.send "trait std::marker::Send"),
### impl<'a, T, const N: usize> Sync for ArrayChunksMut<'a, T, N>where T: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<'a, T, const N: usize> Unpin for ArrayChunksMut<'a, T, N>
### impl<'a, T, const N: usize> !UnwindSafe for ArrayChunksMut<'a, T, N>
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](../iter/trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](../iter/trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Function std::slice::range Function std::slice::range
==========================
```
pub fn range<R>(range: R, bounds: RangeTo<usize>) -> Range<usize>ⓘNotable traits for Range<A>impl<A> Iterator for Range<A>where A: Step, type Item = A;where R: RangeBounds<usize>,
```
🔬This is a nightly-only experimental API. (`slice_range` [#76393](https://github.com/rust-lang/rust/issues/76393))
Performs bounds-checking of a range.
This method is similar to [`Index::index`](../ops/trait.index#tymethod.index) for slices, but it returns a [`Range`](../ops/struct.range) equivalent to `range`. You can use this method to turn any range into `start` and `end` values.
`bounds` is the range of the slice to use for bounds-checking. It should be a [`RangeTo`](../ops/struct.rangeto) range that ends at the length of the slice.
The returned [`Range`](../ops/struct.range) is safe to pass to [`slice::get_unchecked`](../primitive.slice#method.get_unchecked) and [`slice::get_unchecked_mut`](../primitive.slice#method.get_unchecked_mut) for slices with the given range.
Panics
------
Panics if `range` would be out of bounds.
Examples
--------
```
#![feature(slice_range)]
use std::slice;
let v = [10, 40, 30];
assert_eq!(1..2, slice::range(1..2, ..v.len()));
assert_eq!(0..2, slice::range(..2, ..v.len()));
assert_eq!(1..3, slice::range(1.., ..v.len()));
```
Panics when [`Index::index`](../ops/trait.index#tymethod.index) would panic:
ⓘ
```
#![feature(slice_range)]
use std::slice;
let _ = slice::range(2..1, ..3);
```
ⓘ
```
#![feature(slice_range)]
use std::slice;
let _ = slice::range(1..4, ..3);
```
ⓘ
```
#![feature(slice_range)]
use std::slice;
let _ = slice::range(1..=usize::MAX, ..3);
```
rust Function std::slice::from_raw_parts Function std::slice::from\_raw\_parts
=====================================
```
pub const unsafe fn from_raw_parts<'a, T>(data: *const T, len: usize) -> &'a [T]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
```
Forms a slice from a pointer and a length.
The `len` argument is the number of **elements**, not the number of bytes.
Safety
------
Behavior is undefined if any of the following conditions are violated:
* `data` must be [valid](../ptr/index#safety) for reads for `len * mem::size_of::<T>()` many bytes, and it must be properly aligned. This means in particular:
+ The entire memory range of this slice must be contained within a single allocated object! Slices can never span across multiple allocated objects. See [below](#incorrect-usage) for an example incorrectly not taking this into account.
+ `data` must be non-null and aligned even for zero-length slices. One reason for this is that enum layout optimizations may rely on references (including slices of any length) being aligned and non-null to distinguish them from other data. You can obtain a pointer that is usable as `data` for zero-length slices using [`NonNull::dangling()`](../ptr/struct.nonnull#method.dangling).
* `data` must point to `len` consecutive properly initialized values of type `T`.
* The memory referenced by the returned slice must not be mutated for the duration of lifetime `'a`, except inside an `UnsafeCell`.
* The total size `len * mem::size_of::<T>()` of the slice must be no larger than `isize::MAX`. See the safety documentation of [`pointer::offset`](../primitive.pointer#method.offset "pointer::offset").
Caveat
------
The lifetime for the returned slice is inferred from its usage. To prevent accidental misuse, it’s suggested to tie the lifetime to whichever source lifetime is safe in the context, such as by providing a helper function taking the lifetime of a host value for the slice, or by explicit annotation.
Examples
--------
```
use std::slice;
// manifest a slice for a single element
let x = 42;
let ptr = &x as *const _;
let slice = unsafe { slice::from_raw_parts(ptr, 1) };
assert_eq!(slice[0], 42);
```
#### Incorrect usage
The following `join_slices` function is **unsound** ⚠️
```
use std::slice;
fn join_slices<'a, T>(fst: &'a [T], snd: &'a [T]) -> &'a [T] {
let fst_end = fst.as_ptr().wrapping_add(fst.len());
let snd_start = snd.as_ptr();
assert_eq!(fst_end, snd_start, "Slices must be contiguous!");
unsafe {
// The assertion above ensures `fst` and `snd` are contiguous, but they might
// still be contained within _different allocated objects_, in which case
// creating this slice is undefined behavior.
slice::from_raw_parts(fst.as_ptr(), fst.len() + snd.len())
}
}
fn main() {
// `a` and `b` are different allocated objects...
let a = 42;
let b = 27;
// ... which may nevertheless be laid out contiguously in memory: | a | b |
let _ = join_slices(slice::from_ref(&a), slice::from_ref(&b)); // UB
}
```
rust Struct std::slice::RSplitNMut Struct std::slice::RSplitNMut
=============================
```
pub struct RSplitNMut<'a, T, P>where T: 'a, P: FnMut(&T) -> bool,{ /* private fields */ }
```
An iterator over subslices separated by elements that match a predicate function, limited to a given number of splits, starting from the end of the slice.
This struct is created by the [`rsplitn_mut`](../primitive.slice#method.rsplitn_mut) method on [slices](../primitive.slice).
Example
-------
```
let mut slice = [10, 40, 30, 20, 60, 50];
let iter = slice.rsplitn_mut(2, |num| *num % 3 == 0);
```
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1269)1.9.0 · ### impl<T, P> Debug for RSplitNMut<'\_, T, P>where T: [Debug](../fmt/trait.debug "trait std::fmt::Debug"), P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1273)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1281)### impl<'a, T, P> Iterator for RSplitNMut<'a, T, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
#### type Item = &'a mut [T]
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1281)#### fn next(&mut self) -> Option<&'a mut [T]>
Advances the iterator and returns the next value. [Read more](../iter/trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1281)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](../iter/trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](../iter/trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#252-254)#### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](../iter/trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#282-284)#### fn last(self) -> Option<Self::Item>
Consumes the iterator, returning the last element. [Read more](../iter/trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#328)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](../iter/trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#376)#### fn nth(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element of the iterator. [Read more](../iter/trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](../iter/struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](../iter/trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)#### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](../iter/struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](../iter/trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)#### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](../iter/struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](../iter/trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](../iter/struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](../iter/trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)#### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](../iter/struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](../iter/trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](../iter/trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)#### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](../iter/struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](../iter/trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)#### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](../iter/struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](../iter/trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)#### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](../iter/struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](../iter/trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)#### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](../iter/struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](../iter/struct.peekable#method.peek) and [`peek_mut`](../iter/struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](../iter/trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)#### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](../iter/struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](../iter/trait.iterator#method.skip)s elements based on a predicate. [Read more](../iter/trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)#### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](../iter/struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](../iter/trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](../iter/struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](../iter/trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)#### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](../iter/struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](../iter/trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)#### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](../iter/struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](../iter/trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)#### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](../iter/struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](../iter/trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](../iter/trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)#### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](../iter/struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](../iter/trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)#### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](../iter/struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](../iter/trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)#### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](../iter/struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](../iter/trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)#### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](../iter/trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)#### fn collect<B>(self) -> Bwhere B: [FromIterator](../iter/trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](../iter/trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](../iter/trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)#### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](../iter/trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](../iter/trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2230-2234)1.27.0 · #### fn try\_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](../iter/trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](../iter/trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2407-2410)#### fn fold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](../iter/trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](../iter/trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](../iter/trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)#### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)#### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)#### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](../iter/trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](../iter/trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](../iter/trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)#### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](../iter/trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](../iter/trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](../iter/trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)#### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](../iter/trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](../iter/struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](../iter/trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)#### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](../iter/struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](../iter/trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](../iter/struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](../iter/trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](../iter/trait.sum "trait std::iter::Sum")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](../iter/trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](../iter/trait.product "trait std::iter::Product")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](../iter/trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another. [Read more](../iter/trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another. [Read more](../iter/trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](../iter/trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are unequal to those of another. [Read more](../iter/trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](../iter/trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](../iter/trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](../iter/trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](../iter/trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](../iter/trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](../iter/trait.iterator#method.is_sorted_by_key)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1281)1.26.0 · ### impl<'a, T, P> FusedIterator for RSplitNMut<'a, T, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
Auto Trait Implementations
--------------------------
### impl<'a, T, P> RefUnwindSafe for RSplitNMut<'a, T, P>where P: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"), T: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<'a, T, P> Send for RSplitNMut<'a, T, P>where P: [Send](../marker/trait.send "trait std::marker::Send"), T: [Send](../marker/trait.send "trait std::marker::Send"),
### impl<'a, T, P> Sync for RSplitNMut<'a, T, P>where P: [Sync](../marker/trait.sync "trait std::marker::Sync"), T: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<'a, T, P> Unpin for RSplitNMut<'a, T, P>where P: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"),
### impl<'a, T, P> !UnwindSafe for RSplitNMut<'a, T, P>
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](../iter/trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](../iter/trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Struct std::slice::Iter Struct std::slice::Iter
=======================
```
pub struct Iter<'a, T>where T: 'a,{ /* private fields */ }
```
Immutable slice iterator
This struct is created by the [`iter`](../primitive.slice#method.iter) method on [slices](../primitive.slice).
Examples
--------
Basic usage:
```
// First, we declare a type which has `iter` method to get the `Iter` struct (`&[usize]` here):
let slice = &[1, 2, 3];
// Then, we iterate over it:
for element in slice.iter() {
println!("{element}");
}
```
Implementations
---------------
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#86)### impl<'a, T> Iter<'a, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#130)1.4.0 · #### pub fn as\_slice(&self) -> &'a [T]
Notable traits for &[[u8](../primitive.u8)]
```
impl Read for &[u8]
impl Write for &mut [u8]
```
Views the underlying data as a subslice of the original data.
This has the same lifetime as the original slice, and so the iterator can continue to be used while this exists.
##### Examples
Basic usage:
```
// First, we declare a type which has the `iter` method to get the `Iter`
// struct (`&[usize]` here):
let slice = &[1, 2, 3];
// Then, we get the iterator:
let mut iter = slice.iter();
// So if we print what `as_slice` method returns here, we have "[1, 2, 3]":
println!("{:?}", iter.as_slice());
// Next, we move to the second element of the slice:
iter.next();
// Now `as_slice` returns "[2, 3]":
println!("{:?}", iter.as_slice());
```
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#155)1.13.0 · ### impl<T> AsRef<[T]> for Iter<'\_, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#156)#### fn as\_ref(&self) -> &[T]
Notable traits for &[[u8](../primitive.u8)]
```
impl Read for &[u8]
impl Write for &mut [u8]
```
Converts this type into a shared reference of the (usually inferred) input type.
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#148)### impl<T> Clone for Iter<'\_, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#149)#### fn clone(&self) -> Iter<'\_, T>
Notable traits for [Iter](struct.iter "struct std::slice::Iter")<'a, T>
```
impl<'a, T> Iterator for Iter<'a, T>
type Item = &'a T;
```
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)#### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#75)1.9.0 · ### impl<T> Debug for Iter<'\_, T>where T: [Debug](../fmt/trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#76)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#135-145)### impl<'a, T> DoubleEndedIterator for Iter<'a, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#135-145)#### fn next\_back(&mut self) -> Option<&'a T>
Removes and returns an element from the end of the iterator. [Read more](../iter/trait.doubleendediterator#tymethod.next_back)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#135-145)#### fn nth\_back(&mut self, n: usize) -> Option<&'a T>
Returns the `n`th element from the end of the iterator. [Read more](../iter/trait.doubleendediterator#method.nth_back)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#135-145)#### fn advance\_back\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator from the back by `n` elements. [Read more](../iter/trait.doubleendediterator#method.advance_back_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#221-225)1.27.0 · #### fn try\_rfold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
This is the reverse version of [`Iterator::try_fold()`](../iter/trait.iterator#method.try_fold "Iterator::try_fold()"): it takes elements starting from the back of the iterator. [Read more](../iter/trait.doubleendediterator#method.try_rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#292-295)1.27.0 · #### fn rfold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
An iterator method that reduces the iterator’s elements to a single, final value, starting from the back. [Read more](../iter/trait.doubleendediterator#method.rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#347-350)1.27.0 · #### fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator from the back that satisfies a predicate. [Read more](../iter/trait.doubleendediterator#method.rfind)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#135-145)### impl<T> ExactSizeIterator for Iter<'\_, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#135-145)#### fn len(&self) -> usize
Returns the exact remaining length of the iterator. [Read more](../iter/trait.exactsizeiterator#method.len)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#135-145)#### fn is\_empty(&self) -> bool
🔬This is a nightly-only experimental API. (`exact_size_is_empty` [#35428](https://github.com/rust-lang/rust/issues/35428))
Returns `true` if the iterator is empty. [Read more](../iter/trait.exactsizeiterator#method.is_empty)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#135-145)### impl<'a, T> Iterator for Iter<'a, T>
#### type Item = &'a T
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#135-145)#### fn next(&mut self) -> Option<&'a T>
Advances the iterator and returns the next value. [Read more](../iter/trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#135-145)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](../iter/trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#135-145)#### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](../iter/trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#135-145)#### fn nth(&mut self, n: usize) -> Option<&'a T>
Returns the `n`th element of the iterator. [Read more](../iter/trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#135-145)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](../iter/trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#135-145)#### fn last(self) -> Option<&'a T>
Consumes the iterator, returning the last element. [Read more](../iter/trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#135-145)#### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(<[Iter](struct.iter "struct std::slice::Iter")<'a, T> as [Iterator](../iter/trait.iterator "trait std::iter::Iterator")>::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")), [Iter](struct.iter "struct std::slice::Iter")<'a, T>: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Calls a closure on each element of an iterator. [Read more](../iter/trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#135-145)#### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(<[Iter](struct.iter "struct std::slice::Iter")<'a, T> as [Iterator](../iter/trait.iterator "trait std::iter::Iterator")>::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool), [Iter](struct.iter "struct std::slice::Iter")<'a, T>: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Tests if every element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#135-145)#### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(<[Iter](struct.iter "struct std::slice::Iter")<'a, T> as [Iterator](../iter/trait.iterator "trait std::iter::Iterator")>::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool), [Iter](struct.iter "struct std::slice::Iter")<'a, T>: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Tests if any element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#135-145)#### fn find<P>(&mut self, predicate: P) -> Option<<Iter<'a, T> as Iterator>::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&<[Iter](struct.iter "struct std::slice::Iter")<'a, T> as [Iterator](../iter/trait.iterator "trait std::iter::Iterator")>::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool), [Iter](struct.iter "struct std::slice::Iter")<'a, T>: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Searches for an element of an iterator that satisfies a predicate. [Read more](../iter/trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#135-145)#### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(<[Iter](struct.iter "struct std::slice::Iter")<'a, T> as [Iterator](../iter/trait.iterator "trait std::iter::Iterator")>::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>, [Iter](struct.iter "struct std::slice::Iter")<'a, T>: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Applies function to the elements of iterator and returns the first non-none result. [Read more](../iter/trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#135-145)#### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(<[Iter](struct.iter "struct std::slice::Iter")<'a, T> as [Iterator](../iter/trait.iterator "trait std::iter::Iterator")>::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool), [Iter](struct.iter "struct std::slice::Iter")<'a, T>: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Searches for an element in an iterator, returning its index. [Read more](../iter/trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#135-145)#### fn rposition<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(<[Iter](struct.iter "struct std::slice::Iter")<'a, T> as [Iterator](../iter/trait.iterator "trait std::iter::Iterator")>::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool), [Iter](struct.iter "struct std::slice::Iter")<'a, T>: [Sized](../marker/trait.sized "trait std::marker::Sized"), [Iter](struct.iter "struct std::slice::Iter")<'a, T>: [ExactSizeIterator](../iter/trait.exactsizeiterator "trait std::iter::ExactSizeIterator"), [Iter](struct.iter "struct std::slice::Iter")<'a, T>: [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
Searches for an element in an iterator from the right, returning its index. [Read more](../iter/trait.iterator#method.rposition)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#136-139)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&<[Iter](struct.iter "struct std::slice::Iter")<'a, T> as [Iterator](../iter/trait.iterator "trait std::iter::Iterator")>::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &<[Iter](struct.iter "struct std::slice::Iter")<'a, T> as [Iterator](../iter/trait.iterator "trait std::iter::Iterator")>::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>, [Iter](struct.iter "struct std::slice::Iter")<'a, T>: [Sized](../marker/trait.sized "trait std::marker::Sized"),
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](../iter/trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](../iter/trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](../iter/struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](../iter/trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)#### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](../iter/struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](../iter/trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)#### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](../iter/struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](../iter/trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](../iter/struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](../iter/trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)#### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](../iter/struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](../iter/trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)#### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](../iter/struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](../iter/trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)#### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](../iter/struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](../iter/trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)#### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](../iter/struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](../iter/trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)#### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](../iter/struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](../iter/struct.peekable#method.peek) and [`peek_mut`](../iter/struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](../iter/trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)#### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](../iter/struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](../iter/trait.iterator#method.skip)s elements based on a predicate. [Read more](../iter/trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)#### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](../iter/struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](../iter/trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](../iter/struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](../iter/trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)#### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](../iter/struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](../iter/trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)#### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](../iter/struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](../iter/trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)#### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](../iter/struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](../iter/trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](../iter/trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)#### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](../iter/struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](../iter/trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)#### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](../iter/struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](../iter/trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)#### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](../iter/struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](../iter/trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)#### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](../iter/trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)#### fn collect<B>(self) -> Bwhere B: [FromIterator](../iter/trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](../iter/trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](../iter/trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)#### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](../iter/trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2079-2082)#### fn partition\_in\_place<'a, T, P>(self, predicate: P) -> usizewhere T: 'a, Self: [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator")<Item = [&'a mut](../primitive.reference) T>, P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_partition_in_place` [#62543](https://github.com/rust-lang/rust/issues/62543))
Reorders the elements of this iterator *in-place* according to the given predicate, such that all those that return `true` precede all those that return `false`. Returns the number of `true` elements found. [Read more](../iter/trait.iterator#method.partition_in_place)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](../iter/trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2230-2234)1.27.0 · #### fn try\_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](../iter/trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](../iter/trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2407-2410)#### fn fold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](../iter/trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](../iter/trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](../iter/trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](../iter/trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](../iter/trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](../iter/trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3161-3163)#### fn rev(self) -> Rev<Self>where Self: [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
Notable traits for [Rev](../iter/struct.rev "struct std::iter::Rev")<I>
```
impl<I> Iterator for Rev<I>where
I: DoubleEndedIterator,
type Item = <I as Iterator>::Item;
```
Reverses an iterator’s direction. [Read more](../iter/trait.iterator#method.rev)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)#### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](../iter/trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](../iter/struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](../iter/trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)#### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](../iter/struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](../iter/trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3312-3314)#### fn cycle(self) -> Cycle<Self>where Self: [Clone](../clone/trait.clone "trait std::clone::Clone"),
Notable traits for [Cycle](../iter/struct.cycle "struct std::iter::Cycle")<I>
```
impl<I> Iterator for Cycle<I>where
I: Clone + Iterator,
type Item = <I as Iterator>::Item;
```
Repeats an iterator endlessly. [Read more](../iter/trait.iterator#method.cycle)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](../iter/struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](../iter/trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](../iter/trait.sum "trait std::iter::Sum")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](../iter/trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](../iter/trait.product "trait std::iter::Product")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](../iter/trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another. [Read more](../iter/trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another. [Read more](../iter/trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](../iter/trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are unequal to those of another. [Read more](../iter/trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](../iter/trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](../iter/trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](../iter/trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](../iter/trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](../iter/trait.iterator#method.is_sorted_by_key)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#135-145)1.26.0 · ### impl<T> FusedIterator for Iter<'\_, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#84)### impl<T> Send for Iter<'\_, T>where T: [Sync](../marker/trait.sync "trait std::marker::Sync"),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#82)### impl<T> Sync for Iter<'\_, T>where T: [Sync](../marker/trait.sync "trait std::marker::Sync"),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#135-145)### impl<T> TrustedLen for Iter<'\_, T>
Auto Trait Implementations
--------------------------
### impl<'a, T> RefUnwindSafe for Iter<'a, T>where T: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<'a, T> Unpin for Iter<'a, T>
### impl<'a, T> UnwindSafe for Iter<'a, T>where T: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](../iter/trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](../iter/trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Struct std::slice::RSplit Struct std::slice::RSplit
=========================
```
pub struct RSplit<'a, T, P>where T: 'a, P: FnMut(&T) -> bool,{ /* private fields */ }
```
An iterator over subslices separated by elements that match a predicate function, starting from the end of the slice.
This struct is created by the [`rsplit`](../primitive.slice#method.rsplit) method on [slices](../primitive.slice).
Example
-------
```
let slice = [11, 22, 33, 0, 44, 55];
let iter = slice.rsplit(|num| *num == 0);
```
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#941)### impl<T, P> Clone for RSplit<'\_, T, P>where P: [Clone](../clone/trait.clone "trait std::clone::Clone") + [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#945)#### fn clone(&self) -> RSplit<'\_, T, P>
Notable traits for [RSplit](struct.rsplit "struct std::slice::RSplit")<'a, T, P>
```
impl<'a, T, P> Iterator for RSplit<'a, T, P>where
P: FnMut(&T) -> bool,
type Item = &'a [T];
```
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)1.0.0 · #### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#927)### impl<T, P> Debug for RSplit<'\_, T, P>where T: [Debug](../fmt/trait.debug "trait std::fmt::Debug"), P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#931)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#969)### impl<'a, T, P> DoubleEndedIterator for RSplit<'a, T, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#974)#### fn next\_back(&mut self) -> Option<&'a [T]>
Removes and returns an element from the end of the iterator. [Read more](../iter/trait.doubleendediterator#tymethod.next_back)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#134)#### fn advance\_back\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator from the back by `n` elements. [Read more](../iter/trait.doubleendediterator#method.advance_back_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#184)1.37.0 · #### fn nth\_back(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element from the end of the iterator. [Read more](../iter/trait.doubleendediterator#method.nth_back)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#221-225)#### fn try\_rfold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
This is the reverse version of [`Iterator::try_fold()`](../iter/trait.iterator#method.try_fold "Iterator::try_fold()"): it takes elements starting from the back of the iterator. [Read more](../iter/trait.doubleendediterator#method.try_rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#292-295)#### fn rfold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
An iterator method that reduces the iterator’s elements to a single, final value, starting from the back. [Read more](../iter/trait.doubleendediterator#method.rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#347-350)#### fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator from the back that satisfies a predicate. [Read more](../iter/trait.doubleendediterator#method.rfind)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#951)### impl<'a, T, P> Iterator for RSplit<'a, T, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
#### type Item = &'a [T]
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#958)#### fn next(&mut self) -> Option<&'a [T]>
Advances the iterator and returns the next value. [Read more](../iter/trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#963)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](../iter/trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](../iter/trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#252-254)1.0.0 · #### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](../iter/trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#282-284)1.0.0 · #### fn last(self) -> Option<Self::Item>
Consumes the iterator, returning the last element. [Read more](../iter/trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#328)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](../iter/trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#376)1.0.0 · #### fn nth(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element of the iterator. [Read more](../iter/trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](../iter/struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](../iter/trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)1.0.0 · #### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](../iter/struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](../iter/trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)1.0.0 · #### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](../iter/struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](../iter/trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](../iter/struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](../iter/trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)1.0.0 · #### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](../iter/struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](../iter/trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](../iter/trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)1.0.0 · #### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](../iter/struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](../iter/trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)1.0.0 · #### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](../iter/struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](../iter/trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)1.0.0 · #### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](../iter/struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](../iter/trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)1.0.0 · #### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](../iter/struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](../iter/struct.peekable#method.peek) and [`peek_mut`](../iter/struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](../iter/trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)1.0.0 · #### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](../iter/struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](../iter/trait.iterator#method.skip)s elements based on a predicate. [Read more](../iter/trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)1.0.0 · #### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](../iter/struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](../iter/trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](../iter/struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](../iter/trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)1.0.0 · #### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](../iter/struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](../iter/trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)1.0.0 · #### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](../iter/struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](../iter/trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)1.0.0 · #### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](../iter/struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](../iter/trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](../iter/trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)1.0.0 · #### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](../iter/struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](../iter/trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)1.0.0 · #### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](../iter/struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](../iter/trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)1.0.0 · #### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](../iter/struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](../iter/trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)1.0.0 · #### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](../iter/trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)1.0.0 · #### fn collect<B>(self) -> Bwhere B: [FromIterator](../iter/trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](../iter/trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](../iter/trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)1.0.0 · #### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](../iter/trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2079-2082)#### fn partition\_in\_place<'a, T, P>(self, predicate: P) -> usizewhere T: 'a, Self: [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator")<Item = [&'a mut](../primitive.reference) T>, P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_partition_in_place` [#62543](https://github.com/rust-lang/rust/issues/62543))
Reorders the elements of this iterator *in-place* according to the given predicate, such that all those that return `true` precede all those that return `false`. Returns the number of `true` elements found. [Read more](../iter/trait.iterator#method.partition_in_place)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](../iter/trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2230-2234)#### fn try\_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](../iter/trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)#### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](../iter/trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2407-2410)1.0.0 · #### fn fold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](../iter/trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](../iter/trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](../iter/trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)1.0.0 · #### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)1.0.0 · #### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)1.0.0 · #### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](../iter/trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](../iter/trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](../iter/trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)1.0.0 · #### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](../iter/trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](../iter/trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](../iter/trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3161-3163)1.0.0 · #### fn rev(self) -> Rev<Self>where Self: [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
Notable traits for [Rev](../iter/struct.rev "struct std::iter::Rev")<I>
```
impl<I> Iterator for Rev<I>where
I: DoubleEndedIterator,
type Item = <I as Iterator>::Item;
```
Reverses an iterator’s direction. [Read more](../iter/trait.iterator#method.rev)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)1.0.0 · #### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](../iter/trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](../iter/struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](../iter/trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)1.0.0 · #### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](../iter/struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](../iter/trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](../iter/struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](../iter/trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](../iter/trait.sum "trait std::iter::Sum")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](../iter/trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](../iter/trait.product "trait std::iter::Product")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](../iter/trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another. [Read more](../iter/trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another. [Read more](../iter/trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](../iter/trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are unequal to those of another. [Read more](../iter/trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](../iter/trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](../iter/trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](../iter/trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](../iter/trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](../iter/trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](../iter/trait.iterator#method.is_sorted_by_key)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#991)### impl<T, P> FusedIterator for RSplit<'\_, T, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
Auto Trait Implementations
--------------------------
### impl<'a, T, P> RefUnwindSafe for RSplit<'a, T, P>where P: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"), T: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<'a, T, P> Send for RSplit<'a, T, P>where P: [Send](../marker/trait.send "trait std::marker::Send"), T: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<'a, T, P> Sync for RSplit<'a, T, P>where P: [Sync](../marker/trait.sync "trait std::marker::Sync"), T: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<'a, T, P> Unpin for RSplit<'a, T, P>where P: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"),
### impl<'a, T, P> UnwindSafe for RSplit<'a, T, P>where P: [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"), T: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](../iter/trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](../iter/trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Struct std::slice::ChunksMut Struct std::slice::ChunksMut
============================
```
pub struct ChunksMut<'a, T>where T: 'a,{ /* private fields */ }
```
An iterator over a slice in (non-overlapping) mutable chunks (`chunk_size` elements at a time), starting at the beginning of the slice.
When the slice len is not evenly divided by the chunk size, the last slice of the iteration will be the remainder.
This struct is created by the [`chunks_mut`](../primitive.slice#method.chunks_mut) method on [slices](../primitive.slice).
Example
-------
```
let mut slice = ['l', 'o', 'r', 'e', 'm'];
let iter = slice.chunks_mut(2);
```
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1627)### impl<'a, T> Debug for ChunksMut<'a, T>where T: 'a + [Debug](../fmt/trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1627)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result<(), Error>
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1732)### impl<'a, T> DoubleEndedIterator for ChunksMut<'a, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1734)#### fn next\_back(&mut self) -> Option<&'a mut [T]>
Removes and returns an element from the end of the iterator. [Read more](../iter/trait.doubleendediterator#tymethod.next_back)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1750)#### fn nth\_back(&mut self, n: usize) -> Option<<ChunksMut<'a, T> as Iterator>::Item>
Returns the `n`th element from the end of the iterator. [Read more](../iter/trait.doubleendediterator#method.nth_back)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#134)#### fn advance\_back\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator from the back by `n` elements. [Read more](../iter/trait.doubleendediterator#method.advance_back_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#221-225)1.27.0 · #### fn try\_rfold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
This is the reverse version of [`Iterator::try_fold()`](../iter/trait.iterator#method.try_fold "Iterator::try_fold()"): it takes elements starting from the back of the iterator. [Read more](../iter/trait.doubleendediterator#method.try_rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#292-295)1.27.0 · #### fn rfold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
An iterator method that reduces the iterator’s elements to a single, final value, starting from the back. [Read more](../iter/trait.doubleendediterator#method.rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#347-350)1.27.0 · #### fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator from the back that satisfies a predicate. [Read more](../iter/trait.doubleendediterator#method.rfind)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1773)### impl<T> ExactSizeIterator for ChunksMut<'\_, T>
[source](https://doc.rust-lang.org/src/core/iter/traits/exact_size.rs.html#106)#### fn len(&self) -> usize
Returns the exact remaining length of the iterator. [Read more](../iter/trait.exactsizeiterator#method.len)
[source](https://doc.rust-lang.org/src/core/iter/traits/exact_size.rs.html#138)#### fn is\_empty(&self) -> bool
🔬This is a nightly-only experimental API. (`exact_size_is_empty` [#35428](https://github.com/rust-lang/rust/issues/35428))
Returns `true` if the iterator is empty. [Read more](../iter/trait.exactsizeiterator#method.is_empty)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1650)### impl<'a, T> Iterator for ChunksMut<'a, T>
#### type Item = &'a mut [T]
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1654)#### fn next(&mut self) -> Option<&'a mut [T]>
Advances the iterator and returns the next value. [Read more](../iter/trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1668)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](../iter/trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1680)#### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](../iter/trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1685)#### fn nth(&mut self, n: usize) -> Option<&'a mut [T]>
Returns the `n`th element of the iterator. [Read more](../iter/trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1706)#### fn last(self) -> Option<<ChunksMut<'a, T> as Iterator>::Item>
Consumes the iterator, returning the last element. [Read more](../iter/trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](../iter/trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#328)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](../iter/trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](../iter/struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](../iter/trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)#### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](../iter/struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](../iter/trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)#### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](../iter/struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](../iter/trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](../iter/struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](../iter/trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)#### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](../iter/struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](../iter/trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](../iter/trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)#### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](../iter/struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](../iter/trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)#### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](../iter/struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](../iter/trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)#### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](../iter/struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](../iter/trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)#### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](../iter/struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](../iter/struct.peekable#method.peek) and [`peek_mut`](../iter/struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](../iter/trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)#### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](../iter/struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](../iter/trait.iterator#method.skip)s elements based on a predicate. [Read more](../iter/trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)#### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](../iter/struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](../iter/trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](../iter/struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](../iter/trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)#### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](../iter/struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](../iter/trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)#### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](../iter/struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](../iter/trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)#### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](../iter/struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](../iter/trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](../iter/trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)#### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](../iter/struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](../iter/trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)#### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](../iter/struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](../iter/trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)#### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](../iter/struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](../iter/trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)#### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](../iter/trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)#### fn collect<B>(self) -> Bwhere B: [FromIterator](../iter/trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](../iter/trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](../iter/trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)#### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](../iter/trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2079-2082)#### fn partition\_in\_place<'a, T, P>(self, predicate: P) -> usizewhere T: 'a, Self: [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator")<Item = [&'a mut](../primitive.reference) T>, P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_partition_in_place` [#62543](https://github.com/rust-lang/rust/issues/62543))
Reorders the elements of this iterator *in-place* according to the given predicate, such that all those that return `true` precede all those that return `false`. Returns the number of `true` elements found. [Read more](../iter/trait.iterator#method.partition_in_place)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](../iter/trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2230-2234)1.27.0 · #### fn try\_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](../iter/trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](../iter/trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2407-2410)#### fn fold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](../iter/trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](../iter/trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](../iter/trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)#### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)#### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)#### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](../iter/trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](../iter/trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](../iter/trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)#### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](../iter/trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2920-2923)#### fn rposition<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool), Self: [ExactSizeIterator](../iter/trait.exactsizeiterator "trait std::iter::ExactSizeIterator") + [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
Searches for an element in an iterator from the right, returning its index. [Read more](../iter/trait.iterator#method.rposition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](../iter/trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](../iter/trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3161-3163)#### fn rev(self) -> Rev<Self>where Self: [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
Notable traits for [Rev](../iter/struct.rev "struct std::iter::Rev")<I>
```
impl<I> Iterator for Rev<I>where
I: DoubleEndedIterator,
type Item = <I as Iterator>::Item;
```
Reverses an iterator’s direction. [Read more](../iter/trait.iterator#method.rev)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)#### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](../iter/trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](../iter/struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](../iter/trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)#### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](../iter/struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](../iter/trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](../iter/struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](../iter/trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](../iter/trait.sum "trait std::iter::Sum")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](../iter/trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](../iter/trait.product "trait std::iter::Product")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](../iter/trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another. [Read more](../iter/trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another. [Read more](../iter/trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](../iter/trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are unequal to those of another. [Read more](../iter/trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](../iter/trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](../iter/trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](../iter/trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](../iter/trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](../iter/trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](../iter/trait.iterator#method.is_sorted_by_key)
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1779)1.26.0 · ### impl<T> FusedIterator for ChunksMut<'\_, T>
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1792)### impl<T> Send for ChunksMut<'\_, T>where T: [Send](../marker/trait.send "trait std::marker::Send"),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1795)### impl<T> Sync for ChunksMut<'\_, T>where T: [Sync](../marker/trait.sync "trait std::marker::Sync"),
[source](https://doc.rust-lang.org/src/core/slice/iter.rs.html#1776)### impl<T> TrustedLen for ChunksMut<'\_, T>
Auto Trait Implementations
--------------------------
### impl<'a, T> RefUnwindSafe for ChunksMut<'a, T>where T: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<'a, T> Unpin for ChunksMut<'a, T>
### impl<'a, T> !UnwindSafe for ChunksMut<'a, T>
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](../iter/trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](../iter/trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Enum std::path::Prefix Enum std::path::Prefix
======================
```
pub enum Prefix<'a> {
Verbatim(&'a OsStr),
VerbatimUNC(&'a OsStr, &'a OsStr),
VerbatimDisk(u8),
DeviceNS(&'a OsStr),
UNC(&'a OsStr, &'a OsStr),
Disk(u8),
}
```
Windows path prefixes, e.g., `C:` or `\\server\share`.
Windows uses a variety of path prefix styles, including references to drive volumes (like `C:`), network shared folders (like `\\server\share`), and others. In addition, some path prefixes are “verbatim” (i.e., prefixed with `\\?\`), in which case `/` is *not* treated as a separator and essentially no normalization is performed.
Examples
--------
```
use std::path::{Component, Path, Prefix};
use std::path::Prefix::*;
use std::ffi::OsStr;
fn get_path_prefix(s: &str) -> Prefix {
let path = Path::new(s);
match path.components().next().unwrap() {
Component::Prefix(prefix_component) => prefix_component.kind(),
_ => panic!(),
}
}
assert_eq!(Verbatim(OsStr::new("pictures")),
get_path_prefix(r"\\?\pictures\kittens"));
assert_eq!(VerbatimUNC(OsStr::new("server"), OsStr::new("share")),
get_path_prefix(r"\\?\UNC\server\share"));
assert_eq!(VerbatimDisk(b'C'), get_path_prefix(r"\\?\c:\"));
assert_eq!(DeviceNS(OsStr::new("BrainInterface")),
get_path_prefix(r"\\.\BrainInterface"));
assert_eq!(UNC(OsStr::new("server"), OsStr::new("share")),
get_path_prefix(r"\\server\share"));
assert_eq!(Disk(b'C'), get_path_prefix(r"C:\Users\Rust\Pictures\Ferris"));
```
Variants
--------
### `Verbatim(&'a [OsStr](../ffi/struct.osstr "struct std::ffi::OsStr"))`
Verbatim prefix, e.g., `\\?\cat_pics`.
Verbatim prefixes consist of `\\?\` immediately followed by the given component.
### `VerbatimUNC(&'a [OsStr](../ffi/struct.osstr "struct std::ffi::OsStr"), &'a [OsStr](../ffi/struct.osstr "struct std::ffi::OsStr"))`
Verbatim prefix using Windows’ ***U**niform **N**aming **C**onvention*, e.g., `\\?\UNC\server\share`.
Verbatim UNC prefixes consist of `\\?\UNC\` immediately followed by the server’s hostname and a share name.
### `VerbatimDisk([u8](../primitive.u8))`
Verbatim disk prefix, e.g., `\\?\C:`.
Verbatim disk prefixes consist of `\\?\` immediately followed by the drive letter and `:`.
### `DeviceNS(&'a [OsStr](../ffi/struct.osstr "struct std::ffi::OsStr"))`
Device namespace prefix, e.g., `\\.\COM42`.
Device namespace prefixes consist of `\\.\` (possibly using `/` instead of `\`), immediately followed by the device name.
### `UNC(&'a [OsStr](../ffi/struct.osstr "struct std::ffi::OsStr"), &'a [OsStr](../ffi/struct.osstr "struct std::ffi::OsStr"))`
Prefix using Windows’ ***U**niform **N**aming **C**onvention*, e.g. `\\server\share`.
UNC prefixes consist of the server’s hostname and a share name.
### `Disk([u8](../primitive.u8))`
Prefix `C:` for the given disk drive.
Implementations
---------------
[source](https://doc.rust-lang.org/src/std/path.rs.html#191-242)### impl<'a> Prefix<'a>
[source](https://doc.rust-lang.org/src/std/path.rs.html#228-231)#### pub fn is\_verbatim(&self) -> bool
Determines if the prefix is verbatim, i.e., begins with `\\?\`.
##### Examples
```
use std::path::Prefix::*;
use std::ffi::OsStr;
assert!(Verbatim(OsStr::new("pictures")).is_verbatim());
assert!(VerbatimUNC(OsStr::new("server"), OsStr::new("share")).is_verbatim());
assert!(VerbatimDisk(b'C').is_verbatim());
assert!(!DeviceNS(OsStr::new("BrainInterface")).is_verbatim());
assert!(!UNC(OsStr::new("server"), OsStr::new("share")).is_verbatim());
assert!(!Disk(b'C').is_verbatim());
```
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/std/path.rs.html#141)### impl<'a> Clone for Prefix<'a>
[source](https://doc.rust-lang.org/src/std/path.rs.html#141)#### fn clone(&self) -> Prefix<'a>
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)#### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/std/path.rs.html#141)### impl<'a> Debug for Prefix<'a>
[source](https://doc.rust-lang.org/src/std/path.rs.html#141)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/std/path.rs.html#141)### impl<'a> Hash for Prefix<'a>
[source](https://doc.rust-lang.org/src/std/path.rs.html#141)#### fn hash<\_\_H: Hasher>(&self, state: &mut \_\_H)
Feeds this value into the given [`Hasher`](../hash/trait.hasher "Hasher"). [Read more](../hash/trait.hash#tymethod.hash)
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#237-239)1.3.0 · #### fn hash\_slice<H>(data: &[Self], state: &mut H)where H: [Hasher](../hash/trait.hasher "trait std::hash::Hasher"),
Feeds a slice of this type into the given [`Hasher`](../hash/trait.hasher "Hasher"). [Read more](../hash/trait.hash#method.hash_slice)
[source](https://doc.rust-lang.org/src/std/path.rs.html#141)### impl<'a> Ord for Prefix<'a>
[source](https://doc.rust-lang.org/src/std/path.rs.html#141)#### fn cmp(&self, other: &Prefix<'a>) -> Ordering
This method returns an [`Ordering`](../cmp/enum.ordering "Ordering") between `self` and `other`. [Read more](../cmp/trait.ord#tymethod.cmp)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#804-807)1.21.0 · #### fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. [Read more](../cmp/trait.ord#method.max)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#831-834)1.21.0 · #### fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. [Read more](../cmp/trait.ord#method.min)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#863-867)1.50.0 · #### fn clamp(self, min: Self, max: Self) -> Selfwhere Self: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<Self>,
Restrict a value to a certain interval. [Read more](../cmp/trait.ord#method.clamp)
[source](https://doc.rust-lang.org/src/std/path.rs.html#141)### impl<'a> PartialEq<Prefix<'a>> for Prefix<'a>
[source](https://doc.rust-lang.org/src/std/path.rs.html#141)#### fn eq(&self, other: &Prefix<'a>) -> bool
This method tests for `self` and `other` values to be equal, and is used by `==`. [Read more](../cmp/trait.partialeq#tymethod.eq)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#236)#### fn ne(&self, other: &Rhs) -> bool
This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. [Read more](../cmp/trait.partialeq#method.ne)
[source](https://doc.rust-lang.org/src/std/path.rs.html#141)### impl<'a> PartialOrd<Prefix<'a>> for Prefix<'a>
[source](https://doc.rust-lang.org/src/std/path.rs.html#141)#### fn partial\_cmp(&self, other: &Prefix<'a>) -> Option<Ordering>
This method returns an ordering between `self` and `other` values if one exists. [Read more](../cmp/trait.partialord#tymethod.partial_cmp)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1138)#### fn lt(&self, other: &Rhs) -> bool
This method tests less than (for `self` and `other`) and is used by the `<` operator. [Read more](../cmp/trait.partialord#method.lt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1157)#### fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for `self` and `other`) and is used by the `<=` operator. [Read more](../cmp/trait.partialord#method.le)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1175)#### fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for `self` and `other`) and is used by the `>` operator. [Read more](../cmp/trait.partialord#method.gt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1194)#### fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for `self` and `other`) and is used by the `>=` operator. [Read more](../cmp/trait.partialord#method.ge)
[source](https://doc.rust-lang.org/src/std/path.rs.html#141)### impl<'a> Copy for Prefix<'a>
[source](https://doc.rust-lang.org/src/std/path.rs.html#141)### impl<'a> Eq for Prefix<'a>
[source](https://doc.rust-lang.org/src/std/path.rs.html#141)### impl<'a> StructuralEq for Prefix<'a>
[source](https://doc.rust-lang.org/src/std/path.rs.html#141)### impl<'a> StructuralPartialEq for Prefix<'a>
Auto Trait Implementations
--------------------------
### impl<'a> RefUnwindSafe for Prefix<'a>
### impl<'a> Send for Prefix<'a>
### impl<'a> Sync for Prefix<'a>
### impl<'a> Unpin for Prefix<'a>
### impl<'a> UnwindSafe for Prefix<'a>
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
rust Function std::path::is_separator Function std::path::is\_separator
=================================
```
pub fn is_separator(c: char) -> bool
```
Determines whether the character is one of the permitted path separators for the current platform.
Examples
--------
```
use std::path;
assert!(path::is_separator('/')); // '/' works for both Unix and Windows
assert!(!path::is_separator('❤'));
```
rust Module std::path Module std::path
================
Cross-platform path manipulation.
This module provides two types, [`PathBuf`](struct.pathbuf "PathBuf") and [`Path`](struct.path "Path") (akin to [`String`](../string/struct.string "String") and [`str`](../primitive.str "str")), for working with paths abstractly. These types are thin wrappers around [`OsString`](../ffi/struct.osstring "OsString") and [`OsStr`](../ffi/struct.osstr "OsStr") respectively, meaning that they work directly on strings according to the local platform’s path syntax.
Paths can be parsed into [`Component`](enum.component "Component")s by iterating over the structure returned by the [`components`](struct.path#method.components) method on [`Path`](struct.path "Path"). [`Component`](enum.component "Component")s roughly correspond to the substrings between path separators (`/` or `\`). You can reconstruct an equivalent path from components with the [`push`](struct.pathbuf#method.push) method on [`PathBuf`](struct.pathbuf "PathBuf"); note that the paths may differ syntactically by the normalization described in the documentation for the [`components`](struct.path#method.components) method.
### Case sensitivity
Unless otherwise indicated path methods that do not access the filesystem, such as [`Path::starts_with`](struct.path#method.starts_with "Path::starts_with") and [`Path::ends_with`](struct.path#method.ends_with "Path::ends_with"), are case sensitive no matter the platform or filesystem. An exception to this is made for Windows drive letters.
### Simple usage
Path manipulation includes both parsing components from slices and building new owned paths.
To parse a path, you can create a [`Path`](struct.path "Path") slice from a [`str`](../primitive.str "str") slice and start asking questions:
```
use std::path::Path;
use std::ffi::OsStr;
let path = Path::new("/tmp/foo/bar.txt");
let parent = path.parent();
assert_eq!(parent, Some(Path::new("/tmp/foo")));
let file_stem = path.file_stem();
assert_eq!(file_stem, Some(OsStr::new("bar")));
let extension = path.extension();
assert_eq!(extension, Some(OsStr::new("txt")));
```
To build or modify paths, use [`PathBuf`](struct.pathbuf "PathBuf"):
```
use std::path::PathBuf;
// This way works...
let mut path = PathBuf::from("c:\\");
path.push("windows");
path.push("system32");
path.set_extension("dll");
// ... but push is best used if you don't know everything up
// front. If you do, this way is better:
let path: PathBuf = ["c:\\", "windows", "system32.dll"].iter().collect();
```
Structs
-------
[Ancestors](struct.ancestors "std::path::Ancestors struct")
An iterator over [`Path`](struct.path "Path") and its ancestors.
[Components](struct.components "std::path::Components struct")
An iterator over the [`Component`](enum.component "Component")s of a [`Path`](struct.path "Path").
[Display](struct.display "std::path::Display struct")
Helper struct for safely printing paths with [`format!`](../macro.format) and `{}`.
[Iter](struct.iter "std::path::Iter struct")
An iterator over the [`Component`](enum.component "Component")s of a [`Path`](struct.path "Path"), as [`OsStr`](../ffi/struct.osstr "OsStr") slices.
[Path](struct.path "std::path::Path struct")
A slice of a path (akin to [`str`](../primitive.str "str")).
[PathBuf](struct.pathbuf "std::path::PathBuf struct")
An owned, mutable path (akin to [`String`](../string/struct.string "String")).
[PrefixComponent](struct.prefixcomponent "std::path::PrefixComponent struct")
A structure wrapping a Windows path prefix as well as its unparsed string representation.
[StripPrefixError](struct.stripprefixerror "std::path::StripPrefixError struct")
An error returned from [`Path::strip_prefix`](struct.path#method.strip_prefix "Path::strip_prefix") if the prefix was not found.
Enums
-----
[Component](enum.component "std::path::Component enum")
A single component of a path.
[Prefix](enum.prefix "std::path::Prefix enum")
Windows path prefixes, e.g., `C:` or `\\server\share`.
Constants
---------
[MAIN\_SEPARATOR\_STR](constant.main_separator_str "std::path::MAIN_SEPARATOR_STR constant")Experimental
The primary separator of path components for the current platform.
[MAIN\_SEPARATOR](constant.main_separator "std::path::MAIN_SEPARATOR constant")
The primary separator of path components for the current platform.
Functions
---------
[absolute](fn.absolute "std::path::absolute fn")Experimental
Makes the path absolute without accessing the filesystem.
[is\_separator](fn.is_separator "std::path::is_separator fn")
Determines whether the character is one of the permitted path separators for the current platform.
rust Struct std::path::StripPrefixError Struct std::path::StripPrefixError
==================================
```
pub struct StripPrefixError(_);
```
An error returned from [`Path::strip_prefix`](struct.path#method.strip_prefix "Path::strip_prefix") if the prefix was not found.
This `struct` is created by the [`strip_prefix`](struct.path#method.strip_prefix) method on [`Path`](struct.path "Path"). See its documentation for more.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/std/path.rs.html#1937)### impl Clone for StripPrefixError
[source](https://doc.rust-lang.org/src/std/path.rs.html#1937)#### fn clone(&self) -> StripPrefixError
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)1.0.0 · #### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/std/path.rs.html#1937)### impl Debug for StripPrefixError
[source](https://doc.rust-lang.org/src/std/path.rs.html#1937)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3170-3175)### impl Display for StripPrefixError
[source](https://doc.rust-lang.org/src/std/path.rs.html#3172-3174)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result
Formats the value using the given formatter. [Read more](../fmt/trait.display#tymethod.fmt)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3178-3183)### impl Error for StripPrefixError
[source](https://doc.rust-lang.org/src/std/path.rs.html#3180-3182)#### fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to\_string()
[Read more](../error/trait.error#method.description)
[source](https://doc.rust-lang.org/src/core/error.rs.html#83)1.30.0 · #### fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. [Read more](../error/trait.error#method.source)
[source](https://doc.rust-lang.org/src/core/error.rs.html#119)1.0.0 · #### fn cause(&self) -> Option<&dyn Error>
👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
[source](https://doc.rust-lang.org/src/core/error.rs.html#193)#### fn provide(&'a self, demand: &mut Demand<'a>)
🔬This is a nightly-only experimental API. (`error_generic_member_access` [#99301](https://github.com/rust-lang/rust/issues/99301))
Provides type based access to context intended for error reports. [Read more](../error/trait.error#method.provide)
[source](https://doc.rust-lang.org/src/std/path.rs.html#1937)### impl PartialEq<StripPrefixError> for StripPrefixError
[source](https://doc.rust-lang.org/src/std/path.rs.html#1937)#### fn eq(&self, other: &StripPrefixError) -> bool
This method tests for `self` and `other` values to be equal, and is used by `==`. [Read more](../cmp/trait.partialeq#tymethod.eq)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#236)1.0.0 · #### fn ne(&self, other: &Rhs) -> bool
This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. [Read more](../cmp/trait.partialeq#method.ne)
[source](https://doc.rust-lang.org/src/std/path.rs.html#1937)### impl Eq for StripPrefixError
[source](https://doc.rust-lang.org/src/std/path.rs.html#1937)### impl StructuralEq for StripPrefixError
[source](https://doc.rust-lang.org/src/std/path.rs.html#1937)### impl StructuralPartialEq for StripPrefixError
Auto Trait Implementations
--------------------------
### impl RefUnwindSafe for StripPrefixError
### impl Send for StripPrefixError
### impl Sync for StripPrefixError
### impl Unpin for StripPrefixError
### impl UnwindSafe for StripPrefixError
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/error.rs.html#197)### impl<E> Provider for Ewhere E: [Error](../error/trait.error "trait std::error::Error") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/error.rs.html#201)#### fn provide(&'a self, demand: &mut Demand<'a>)
🔬This is a nightly-only experimental API. (`provide_any` [#96024](https://github.com/rust-lang/rust/issues/96024))
Data providers should implement this method to provide *all* values they are able to provide by using `demand`. [Read more](../any/trait.provider#tymethod.provide)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/alloc/string.rs.html#2500)### impl<T> ToString for Twhere T: [Display](../fmt/trait.display "trait std::fmt::Display") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/alloc/string.rs.html#2506)#### default fn to\_string(&self) -> String
Converts the given value to a `String`. [Read more](../string/trait.tostring#tymethod.to_string)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Struct std::path::PrefixComponent Struct std::path::PrefixComponent
=================================
```
pub struct PrefixComponent<'a> { /* private fields */ }
```
A structure wrapping a Windows path prefix as well as its unparsed string representation.
In addition to the parsed [`Prefix`](enum.prefix "Prefix") information returned by [`kind`](struct.prefixcomponent#method.kind), `PrefixComponent` also holds the raw and unparsed [`OsStr`](../ffi/struct.osstr "OsStr") slice, returned by [`as_os_str`](struct.prefixcomponent#method.as_os_str).
Instances of this `struct` can be obtained by matching against the [`Prefix` variant](enum.component#variant.Prefix) on [`Component`](enum.component "Component").
Does not occur on Unix.
Examples
--------
```
use std::path::{Component, Path, Prefix};
use std::ffi::OsStr;
let path = Path::new(r"c:\you\later\");
match path.components().next().unwrap() {
Component::Prefix(prefix_component) => {
assert_eq!(Prefix::Disk(b'C'), prefix_component.kind());
assert_eq!(OsStr::new("c:"), prefix_component.as_os_str());
}
_ => unreachable!(),
}
```
Implementations
---------------
[source](https://doc.rust-lang.org/src/std/path.rs.html#431-450)### impl<'a> PrefixComponent<'a>
[source](https://doc.rust-lang.org/src/std/path.rs.html#439-441)#### pub fn kind(&self) -> Prefix<'a>
Returns the parsed prefix data.
See [`Prefix`](enum.prefix "Prefix")’s documentation for more information on the different kinds of prefixes.
[source](https://doc.rust-lang.org/src/std/path.rs.html#447-449)#### pub fn as\_os\_str(&self) -> &'a OsStr
Returns the raw [`OsStr`](../ffi/struct.osstr "OsStr") slice for this prefix.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/std/path.rs.html#422)### impl<'a> Clone for PrefixComponent<'a>
[source](https://doc.rust-lang.org/src/std/path.rs.html#422)#### fn clone(&self) -> PrefixComponent<'a>
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)#### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/std/path.rs.html#422)### impl<'a> Debug for PrefixComponent<'a>
[source](https://doc.rust-lang.org/src/std/path.rs.html#422)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/std/path.rs.html#477-481)### impl Hash for PrefixComponent<'\_>
[source](https://doc.rust-lang.org/src/std/path.rs.html#478-480)#### fn hash<H: Hasher>(&self, h: &mut H)
Feeds this value into the given [`Hasher`](../hash/trait.hasher "Hasher"). [Read more](../hash/trait.hash#tymethod.hash)
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#237-239)1.3.0 · #### fn hash\_slice<H>(data: &[Self], state: &mut H)where H: [Hasher](../hash/trait.hasher "trait std::hash::Hasher"),
Feeds a slice of this type into the given [`Hasher`](../hash/trait.hasher "Hasher"). [Read more](../hash/trait.hash#method.hash_slice)
[source](https://doc.rust-lang.org/src/std/path.rs.html#469-474)### impl Ord for PrefixComponent<'\_>
[source](https://doc.rust-lang.org/src/std/path.rs.html#471-473)#### fn cmp(&self, other: &Self) -> Ordering
This method returns an [`Ordering`](../cmp/enum.ordering "Ordering") between `self` and `other`. [Read more](../cmp/trait.ord#tymethod.cmp)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#804-807)1.21.0 · #### fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. [Read more](../cmp/trait.ord#method.max)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#831-834)1.21.0 · #### fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. [Read more](../cmp/trait.ord#method.min)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#863-867)1.50.0 · #### fn clamp(self, min: Self, max: Self) -> Selfwhere Self: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<Self>,
Restrict a value to a certain interval. [Read more](../cmp/trait.ord#method.clamp)
[source](https://doc.rust-lang.org/src/std/path.rs.html#453-458)### impl<'a> PartialEq<PrefixComponent<'a>> for PrefixComponent<'a>
[source](https://doc.rust-lang.org/src/std/path.rs.html#455-457)#### fn eq(&self, other: &PrefixComponent<'a>) -> bool
This method tests for `self` and `other` values to be equal, and is used by `==`. [Read more](../cmp/trait.partialeq#tymethod.eq)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#236)#### fn ne(&self, other: &Rhs) -> bool
This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. [Read more](../cmp/trait.partialeq#method.ne)
[source](https://doc.rust-lang.org/src/std/path.rs.html#461-466)### impl<'a> PartialOrd<PrefixComponent<'a>> for PrefixComponent<'a>
[source](https://doc.rust-lang.org/src/std/path.rs.html#463-465)#### fn partial\_cmp(&self, other: &PrefixComponent<'a>) -> Option<Ordering>
This method returns an ordering between `self` and `other` values if one exists. [Read more](../cmp/trait.partialord#tymethod.partial_cmp)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1138)#### fn lt(&self, other: &Rhs) -> bool
This method tests less than (for `self` and `other`) and is used by the `<` operator. [Read more](../cmp/trait.partialord#method.lt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1157)#### fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for `self` and `other`) and is used by the `<=` operator. [Read more](../cmp/trait.partialord#method.le)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1175)#### fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for `self` and `other`) and is used by the `>` operator. [Read more](../cmp/trait.partialord#method.gt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1194)#### fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for `self` and `other`) and is used by the `>=` operator. [Read more](../cmp/trait.partialord#method.ge)
[source](https://doc.rust-lang.org/src/std/path.rs.html#422)### impl<'a> Copy for PrefixComponent<'a>
[source](https://doc.rust-lang.org/src/std/path.rs.html#422)### impl<'a> Eq for PrefixComponent<'a>
[source](https://doc.rust-lang.org/src/std/path.rs.html#422)### impl<'a> StructuralEq for PrefixComponent<'a>
Auto Trait Implementations
--------------------------
### impl<'a> RefUnwindSafe for PrefixComponent<'a>
### impl<'a> Send for PrefixComponent<'a>
### impl<'a> Sync for PrefixComponent<'a>
### impl<'a> Unpin for PrefixComponent<'a>
### impl<'a> UnwindSafe for PrefixComponent<'a>
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
rust Struct std::path::Display Struct std::path::Display
=========================
```
pub struct Display<'a> { /* private fields */ }
```
Helper struct for safely printing paths with [`format!`](../macro.format) and `{}`.
A [`Path`](struct.path "Path") might contain non-Unicode data. This `struct` implements the [`Display`](../fmt/trait.display) trait in a way that mitigates that. It is created by the [`display`](struct.path#method.display) method on [`Path`](struct.path "Path"). This may perform lossy conversion, depending on the platform. If you would like an implementation which escapes the path please use [`Debug`](../fmt/macro.debug "Debug") instead.
Examples
--------
```
use std::path::Path;
let path = Path::new("/tmp/foo.rs");
println!("{}", path.display());
```
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/std/path.rs.html#2909-2913)### impl Debug for Display<'\_>
[source](https://doc.rust-lang.org/src/std/path.rs.html#2910-2912)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/std/path.rs.html#2916-2920)### impl Display for Display<'\_>
[source](https://doc.rust-lang.org/src/std/path.rs.html#2917-2919)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result
Formats the value using the given formatter. [Read more](../fmt/trait.display#tymethod.fmt)
Auto Trait Implementations
--------------------------
### impl<'a> RefUnwindSafe for Display<'a>
### impl<'a> Send for Display<'a>
### impl<'a> Sync for Display<'a>
### impl<'a> Unpin for Display<'a>
### impl<'a> UnwindSafe for Display<'a>
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/alloc/string.rs.html#2500)### impl<T> ToString for Twhere T: [Display](../fmt/trait.display "trait std::fmt::Display") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/alloc/string.rs.html#2506)#### default fn to\_string(&self) -> String
Converts the given value to a `String`. [Read more](../string/trait.tostring#tymethod.to_string)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
rust Struct std::path::Components Struct std::path::Components
============================
```
pub struct Components<'a> { /* private fields */ }
```
An iterator over the [`Component`](enum.component "Component")s of a [`Path`](struct.path "Path").
This `struct` is created by the [`components`](struct.path#method.components) method on [`Path`](struct.path "Path"). See its documentation for more.
Examples
--------
```
use std::path::Path;
let path = Path::new("/tmp/foo/bar.txt");
for component in path.components() {
println!("{component:?}");
}
```
Implementations
---------------
[source](https://doc.rust-lang.org/src/std/path.rs.html#647-795)### impl<'a> Components<'a>
[source](https://doc.rust-lang.org/src/std/path.rs.html#699-708)#### pub fn as\_path(&self) -> &'a Path
Extracts a slice corresponding to the portion of the path remaining for iteration.
##### Examples
```
use std::path::Path;
let mut components = Path::new("/tmp/foo/bar.txt").components();
components.next();
components.next();
assert_eq!(Path::new("foo/bar.txt"), components.as_path());
```
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/std/path.rs.html#806-811)### impl AsRef<OsStr> for Components<'\_>
[source](https://doc.rust-lang.org/src/std/path.rs.html#808-810)#### fn as\_ref(&self) -> &OsStr
Converts this type into a shared reference of the (usually inferred) input type.
[source](https://doc.rust-lang.org/src/std/path.rs.html#798-803)### impl AsRef<Path> for Components<'\_>
[source](https://doc.rust-lang.org/src/std/path.rs.html#800-802)#### fn as\_ref(&self) -> &Path
Converts this type into a shared reference of the (usually inferred) input type.
[source](https://doc.rust-lang.org/src/std/path.rs.html#598)### impl<'a> Clone for Components<'a>
[source](https://doc.rust-lang.org/src/std/path.rs.html#598)#### fn clone(&self) -> Components<'a>
Notable traits for [Components](struct.components "struct std::path::Components")<'a>
```
impl<'a> Iterator for Components<'a>
type Item = Component<'a>;
```
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)#### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/std/path.rs.html#633-645)1.13.0 · ### impl Debug for Components<'\_>
[source](https://doc.rust-lang.org/src/std/path.rs.html#634-644)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/std/path.rs.html#941-985)### impl<'a> DoubleEndedIterator for Components<'a>
[source](https://doc.rust-lang.org/src/std/path.rs.html#942-984)#### fn next\_back(&mut self) -> Option<Component<'a>>
Removes and returns an element from the end of the iterator. [Read more](../iter/trait.doubleendediterator#tymethod.next_back)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#134)#### fn advance\_back\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator from the back by `n` elements. [Read more](../iter/trait.doubleendediterator#method.advance_back_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#184)1.37.0 · #### fn nth\_back(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element from the end of the iterator. [Read more](../iter/trait.doubleendediterator#method.nth_back)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#221-225)1.27.0 · #### fn try\_rfold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
This is the reverse version of [`Iterator::try_fold()`](../iter/trait.iterator#method.try_fold "Iterator::try_fold()"): it takes elements starting from the back of the iterator. [Read more](../iter/trait.doubleendediterator#method.try_rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#292-295)1.27.0 · #### fn rfold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
An iterator method that reduces the iterator’s elements to a single, final value, starting from the back. [Read more](../iter/trait.doubleendediterator#method.rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#347-350)1.27.0 · #### fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator from the back that satisfies a predicate. [Read more](../iter/trait.doubleendediterator#method.rfind)
[source](https://doc.rust-lang.org/src/std/path.rs.html#888-938)### impl<'a> Iterator for Components<'a>
#### type Item = Component<'a>
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/std/path.rs.html#891-937)#### fn next(&mut self) -> Option<Component<'a>>
Advances the iterator and returns the next value. [Read more](../iter/trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](../iter/trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#215)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](../iter/trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#252-254)#### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](../iter/trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#282-284)#### fn last(self) -> Option<Self::Item>
Consumes the iterator, returning the last element. [Read more](../iter/trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#328)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](../iter/trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#376)#### fn nth(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element of the iterator. [Read more](../iter/trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](../iter/struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](../iter/trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)#### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](../iter/struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](../iter/trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)#### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](../iter/struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](../iter/trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](../iter/struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](../iter/trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)#### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](../iter/struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](../iter/trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](../iter/trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)#### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](../iter/struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](../iter/trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)#### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](../iter/struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](../iter/trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)#### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](../iter/struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](../iter/trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)#### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](../iter/struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](../iter/struct.peekable#method.peek) and [`peek_mut`](../iter/struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](../iter/trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)#### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](../iter/struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](../iter/trait.iterator#method.skip)s elements based on a predicate. [Read more](../iter/trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)#### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](../iter/struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](../iter/trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](../iter/struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](../iter/trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)#### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](../iter/struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](../iter/trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)#### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](../iter/struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](../iter/trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)#### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](../iter/struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](../iter/trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](../iter/trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)#### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](../iter/struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](../iter/trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)#### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](../iter/struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](../iter/trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)#### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](../iter/struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](../iter/trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)#### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](../iter/trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)#### fn collect<B>(self) -> Bwhere B: [FromIterator](../iter/trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](../iter/trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](../iter/trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)#### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](../iter/trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2079-2082)#### fn partition\_in\_place<'a, T, P>(self, predicate: P) -> usizewhere T: 'a, Self: [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator")<Item = [&'a mut](../primitive.reference) T>, P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_partition_in_place` [#62543](https://github.com/rust-lang/rust/issues/62543))
Reorders the elements of this iterator *in-place* according to the given predicate, such that all those that return `true` precede all those that return `false`. Returns the number of `true` elements found. [Read more](../iter/trait.iterator#method.partition_in_place)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](../iter/trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2230-2234)1.27.0 · #### fn try\_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](../iter/trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](../iter/trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2407-2410)#### fn fold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](../iter/trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](../iter/trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](../iter/trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)#### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)#### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)#### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](../iter/trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](../iter/trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](../iter/trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)#### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](../iter/trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](../iter/trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](../iter/trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3161-3163)#### fn rev(self) -> Rev<Self>where Self: [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
Notable traits for [Rev](../iter/struct.rev "struct std::iter::Rev")<I>
```
impl<I> Iterator for Rev<I>where
I: DoubleEndedIterator,
type Item = <I as Iterator>::Item;
```
Reverses an iterator’s direction. [Read more](../iter/trait.iterator#method.rev)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)#### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](../iter/trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](../iter/struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](../iter/trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)#### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](../iter/struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](../iter/trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3312-3314)#### fn cycle(self) -> Cycle<Self>where Self: [Clone](../clone/trait.clone "trait std::clone::Clone"),
Notable traits for [Cycle](../iter/struct.cycle "struct std::iter::Cycle")<I>
```
impl<I> Iterator for Cycle<I>where
I: Clone + Iterator,
type Item = <I as Iterator>::Item;
```
Repeats an iterator endlessly. [Read more](../iter/trait.iterator#method.cycle)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](../iter/struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](../iter/trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](../iter/trait.sum "trait std::iter::Sum")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](../iter/trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](../iter/trait.product "trait std::iter::Product")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](../iter/trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another. [Read more](../iter/trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another. [Read more](../iter/trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](../iter/trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are unequal to those of another. [Read more](../iter/trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](../iter/trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](../iter/trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](../iter/trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](../iter/trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](../iter/trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](../iter/trait.iterator#method.is_sorted_by_key)
[source](https://doc.rust-lang.org/src/std/path.rs.html#1029-1034)### impl Ord for Components<'\_>
[source](https://doc.rust-lang.org/src/std/path.rs.html#1031-1033)#### fn cmp(&self, other: &Self) -> Ordering
This method returns an [`Ordering`](../cmp/enum.ordering "Ordering") between `self` and `other`. [Read more](../cmp/trait.ord#tymethod.cmp)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#804-807)1.21.0 · #### fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. [Read more](../cmp/trait.ord#method.max)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#831-834)1.21.0 · #### fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. [Read more](../cmp/trait.ord#method.min)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#863-867)1.50.0 · #### fn clamp(self, min: Self, max: Self) -> Selfwhere Self: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<Self>,
Restrict a value to a certain interval. [Read more](../cmp/trait.ord#method.clamp)
[source](https://doc.rust-lang.org/src/std/path.rs.html#991-1015)### impl<'a> PartialEq<Components<'a>> for Components<'a>
[source](https://doc.rust-lang.org/src/std/path.rs.html#993-1014)#### fn eq(&self, other: &Components<'a>) -> bool
This method tests for `self` and `other` values to be equal, and is used by `==`. [Read more](../cmp/trait.partialeq#tymethod.eq)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#236)#### fn ne(&self, other: &Rhs) -> bool
This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. [Read more](../cmp/trait.partialeq#method.ne)
[source](https://doc.rust-lang.org/src/std/path.rs.html#1021-1026)### impl<'a> PartialOrd<Components<'a>> for Components<'a>
[source](https://doc.rust-lang.org/src/std/path.rs.html#1023-1025)#### fn partial\_cmp(&self, other: &Components<'a>) -> Option<Ordering>
This method returns an ordering between `self` and `other` values if one exists. [Read more](../cmp/trait.partialord#tymethod.partial_cmp)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1138)#### fn lt(&self, other: &Rhs) -> bool
This method tests less than (for `self` and `other`) and is used by the `<` operator. [Read more](../cmp/trait.partialord#method.lt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1157)#### fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for `self` and `other`) and is used by the `<=` operator. [Read more](../cmp/trait.partialord#method.le)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1175)#### fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for `self` and `other`) and is used by the `>` operator. [Read more](../cmp/trait.partialord#method.gt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1194)#### fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for `self` and `other`) and is used by the `>=` operator. [Read more](../cmp/trait.partialord#method.ge)
[source](https://doc.rust-lang.org/src/std/path.rs.html#1018)### impl Eq for Components<'\_>
[source](https://doc.rust-lang.org/src/std/path.rs.html#988)1.26.0 · ### impl FusedIterator for Components<'\_>
Auto Trait Implementations
--------------------------
### impl<'a> RefUnwindSafe for Components<'a>
### impl<'a> Send for Components<'a>
### impl<'a> Sync for Components<'a>
### impl<'a> Unpin for Components<'a>
### impl<'a> UnwindSafe for Components<'a>
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](../iter/trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](../iter/trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Struct std::path::PathBuf Struct std::path::PathBuf
=========================
```
pub struct PathBuf { /* private fields */ }
```
An owned, mutable path (akin to [`String`](../string/struct.string "String")).
This type provides methods like [`push`](struct.pathbuf#method.push) and [`set_extension`](struct.pathbuf#method.set_extension) that mutate the path in place. It also implements [`Deref`](../ops/trait.deref "Deref") to [`Path`](struct.path "Path"), meaning that all methods on [`Path`](struct.path "Path") slices are available on `PathBuf` values as well.
More details about the overall approach can be found in the [module documentation](index).
Examples
--------
You can use [`push`](struct.pathbuf#method.push) to build up a `PathBuf` from components:
```
use std::path::PathBuf;
let mut path = PathBuf::new();
path.push(r"C:\");
path.push("windows");
path.push("system32");
path.set_extension("dll");
```
However, [`push`](struct.pathbuf#method.push) is best used for dynamic situations. This is a better way to do this when you know all of the components ahead of time:
```
use std::path::PathBuf;
let path: PathBuf = [r"C:\", "windows", "system32.dll"].iter().collect();
```
We can still do better than this! Since these are all strings, we can use `From::from`:
```
use std::path::PathBuf;
let path = PathBuf::from(r"C:\windows\system32.dll");
```
Which method works best depends on what kind of situation you’re in.
Implementations
---------------
[source](https://doc.rust-lang.org/src/std/path.rs.html#1172-1564)### impl PathBuf
[source](https://doc.rust-lang.org/src/std/path.rs.html#1190-1192)#### pub fn new() -> PathBuf
Allocates an empty `PathBuf`.
##### Examples
```
use std::path::PathBuf;
let path = PathBuf::new();
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#1215-1217)1.44.0 · #### pub fn with\_capacity(capacity: usize) -> PathBuf
Creates a new `PathBuf` with a given capacity used to create the internal [`OsString`](../ffi/struct.osstring "OsString"). See [`with_capacity`](../ffi/struct.osstring#method.with_capacity) defined on [`OsString`](../ffi/struct.osstring "OsString").
##### Examples
```
use std::path::PathBuf;
let mut path = PathBuf::with_capacity(10);
let capacity = path.capacity();
// This push is done without reallocating
path.push(r"C:\");
assert_eq!(capacity, path.capacity());
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#1232-1234)#### pub fn as\_path(&self) -> &Path
Coerces to a [`Path`](struct.path "Path") slice.
##### Examples
```
use std::path::{Path, PathBuf};
let p = PathBuf::from("/test");
assert_eq!(Path::new("/test"), p.as_path());
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#1271-1273)#### pub fn push<P: AsRef<Path>>(&mut self, path: P)
Extends `self` with `path`.
If `path` is absolute, it replaces the current path.
On Windows:
* if `path` has a root but no prefix (e.g., `\windows`), it replaces everything except for the prefix (if any) of `self`.
* if `path` has a prefix but no root, it replaces `self`.
* if `self` has a verbatim prefix (e.g. `\\?\C:\windows`) and `path` is not empty, the new path is normalized: all references to `.` and `..` are removed.
##### Examples
Pushing a relative path extends the existing path:
```
use std::path::PathBuf;
let mut path = PathBuf::from("/tmp");
path.push("file.bk");
assert_eq!(path, PathBuf::from("/tmp/file.bk"));
```
Pushing an absolute path replaces the existing path:
```
use std::path::PathBuf;
let mut path = PathBuf::from("/tmp");
path.push("/etc");
assert_eq!(path, PathBuf::from("/etc"));
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#1366-1374)#### pub fn pop(&mut self) -> bool
Truncates `self` to [`self.parent`](struct.path#method.parent).
Returns `false` and does nothing if [`self.parent`](struct.path#method.parent) is [`None`](../option/enum.option#variant.None "None"). Otherwise, returns `true`.
##### Examples
```
use std::path::{Path, PathBuf};
let mut p = PathBuf::from("/spirited/away.rs");
p.pop();
assert_eq!(Path::new("/spirited"), p);
p.pop();
assert_eq!(Path::new("/"), p);
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#1402-1404)#### pub fn set\_file\_name<S: AsRef<OsStr>>(&mut self, file\_name: S)
Updates [`self.file_name`](struct.path#method.file_name) to `file_name`.
If [`self.file_name`](struct.path#method.file_name) was [`None`](../option/enum.option#variant.None "None"), this is equivalent to pushing `file_name`.
Otherwise it is equivalent to calling [`pop`](struct.pathbuf#method.pop) and then pushing `file_name`. The new path will be a sibling of the original path. (That is, it will have the same parent.)
##### Examples
```
use std::path::PathBuf;
let mut buf = PathBuf::from("/");
assert!(buf.file_name() == None);
buf.set_file_name("bar");
assert!(buf == PathBuf::from("/bar"));
assert!(buf.file_name().is_some());
buf.set_file_name("baz.txt");
assert!(buf == PathBuf::from("/baz.txt"));
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#1439-1441)#### pub fn set\_extension<S: AsRef<OsStr>>(&mut self, extension: S) -> bool
Updates [`self.extension`](struct.path#method.extension) to `extension`.
Returns `false` and does nothing if [`self.file_name`](struct.path#method.file_name) is [`None`](../option/enum.option#variant.None "None"), returns `true` and updates the extension otherwise.
If [`self.extension`](struct.path#method.extension) is [`None`](../option/enum.option#variant.None "None"), the extension is added; otherwise it is replaced.
##### Examples
```
use std::path::{Path, PathBuf};
let mut p = PathBuf::from("/feel/the");
p.set_extension("force");
assert_eq!(Path::new("/feel/the.force"), p.as_path());
p.set_extension("dark_side");
assert_eq!(Path::new("/feel/the.dark_side"), p.as_path());
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#1479-1481)#### pub fn into\_os\_string(self) -> OsString
Consumes the `PathBuf`, yielding its internal [`OsString`](../ffi/struct.osstring "OsString") storage.
##### Examples
```
use std::path::PathBuf;
let p = PathBuf::from("/the/head");
let os_str = p.into_os_string();
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#1487-1490)1.20.0 · #### pub fn into\_boxed\_path(self) -> Box<Path>
Notable traits for [Box](../boxed/struct.box "struct std::boxed::Box")<I, A>
```
impl<I, A> Iterator for Box<I, A>where
I: Iterator + ?Sized,
A: Allocator,
type Item = <I as Iterator>::Item;
impl<F, A> Future for Box<F, A>where
F: Future + Unpin + ?Sized,
A: Allocator + 'static,
type Output = <F as Future>::Output;
impl<R: Read + ?Sized> Read for Box<R>
impl<W: Write + ?Sized> Write for Box<W>
```
Converts this `PathBuf` into a [boxed](../boxed/struct.box) [`Path`](struct.path "Path").
[source](https://doc.rust-lang.org/src/std/path.rs.html#1498-1500)1.44.0 · #### pub fn capacity(&self) -> usize
Invokes [`capacity`](../ffi/struct.osstring#method.capacity) on the underlying instance of [`OsString`](../ffi/struct.osstring "OsString").
[source](https://doc.rust-lang.org/src/std/path.rs.html#1507-1509)1.44.0 · #### pub fn clear(&mut self)
Invokes [`clear`](../ffi/struct.osstring#method.clear) on the underlying instance of [`OsString`](../ffi/struct.osstring "OsString").
[source](https://doc.rust-lang.org/src/std/path.rs.html#1516-1518)1.44.0 · #### pub fn reserve(&mut self, additional: usize)
Invokes [`reserve`](../ffi/struct.osstring#method.reserve) on the underlying instance of [`OsString`](../ffi/struct.osstring "OsString").
[source](https://doc.rust-lang.org/src/std/path.rs.html#1525-1527)1.63.0 · #### pub fn try\_reserve(&mut self, additional: usize) -> Result<(), TryReserveError>
Invokes [`try_reserve`](../ffi/struct.osstring#method.try_reserve) on the underlying instance of [`OsString`](../ffi/struct.osstring "OsString").
[source](https://doc.rust-lang.org/src/std/path.rs.html#1534-1536)1.44.0 · #### pub fn reserve\_exact(&mut self, additional: usize)
Invokes [`reserve_exact`](../ffi/struct.osstring#method.reserve_exact) on the underlying instance of [`OsString`](../ffi/struct.osstring "OsString").
[source](https://doc.rust-lang.org/src/std/path.rs.html#1543-1545)1.63.0 · #### pub fn try\_reserve\_exact( &mut self, additional: usize) -> Result<(), TryReserveError>
Invokes [`try_reserve_exact`](../ffi/struct.osstring#method.try_reserve_exact) on the underlying instance of [`OsString`](../ffi/struct.osstring "OsString").
[source](https://doc.rust-lang.org/src/std/path.rs.html#1552-1554)1.44.0 · #### pub fn shrink\_to\_fit(&mut self)
Invokes [`shrink_to_fit`](../ffi/struct.osstring#method.shrink_to_fit) on the underlying instance of [`OsString`](../ffi/struct.osstring "OsString").
[source](https://doc.rust-lang.org/src/std/path.rs.html#1561-1563)1.56.0 · #### pub fn shrink\_to(&mut self, min\_capacity: usize)
Invokes [`shrink_to`](../ffi/struct.osstring#method.shrink_to) on the underlying instance of [`OsString`](../ffi/struct.osstring "OsString").
Methods from [Deref](../ops/trait.deref "trait std::ops::Deref")<Target = [Path](struct.path "struct std::path::Path")>
-----------------------------------------------------------------------------------------------------------------------
[source](https://doc.rust-lang.org/src/std/path.rs.html#1992-1994)#### pub fn as\_os\_str(&self) -> &OsStr
Yields the underlying [`OsStr`](../ffi/struct.osstr "OsStr") slice.
##### Examples
```
use std::path::Path;
let os_str = Path::new("foo.txt").as_os_str();
assert_eq!(os_str, std::ffi::OsStr::new("foo.txt"));
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#2016-2018)#### pub fn to\_str(&self) -> Option<&str>
Yields a [`&str`](../primitive.str) slice if the `Path` is valid unicode.
This conversion may entail doing a check for UTF-8 validity. Note that validation is performed because non-UTF-8 strings are perfectly valid for some OS.
##### Examples
```
use std::path::Path;
let path = Path::new("foo.txt");
assert_eq!(path.to_str(), Some("foo.txt"));
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#2044-2046)#### pub fn to\_string\_lossy(&self) -> Cow<'\_, str>
Converts a `Path` to a [`Cow<str>`](../borrow/enum.cow "Cow<str>").
Any non-Unicode sequences are replaced with [`U+FFFD REPLACEMENT CHARACTER`](../char/constant.replacement_character).
##### Examples
Calling `to_string_lossy` on a `Path` with valid unicode:
```
use std::path::Path;
let path = Path::new("foo.txt");
assert_eq!(path.to_string_lossy(), "foo.txt");
```
Had `path` contained invalid unicode, the `to_string_lossy` call might have returned `"fo�.txt"`.
[source](https://doc.rust-lang.org/src/std/path.rs.html#2062-2064)#### pub fn to\_path\_buf(&self) -> PathBuf
Converts a `Path` to an owned [`PathBuf`](struct.pathbuf "PathBuf").
##### Examples
```
use std::path::Path;
let path_buf = Path::new("foo.txt").to_path_buf();
assert_eq!(path_buf, std::path::PathBuf::from("foo.txt"));
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#2087-2094)#### pub fn is\_absolute(&self) -> bool
Returns `true` if the `Path` is absolute, i.e., if it is independent of the current directory.
* On Unix, a path is absolute if it starts with the root, so `is_absolute` and [`has_root`](struct.path#method.has_root) are equivalent.
* On Windows, a path is absolute if it has a prefix and starts with the root: `c:\windows` is absolute, while `c:temp` and `\temp` are not.
##### Examples
```
use std::path::Path;
assert!(!Path::new("foo.txt").is_absolute());
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#2112-2114)#### pub fn is\_relative(&self) -> bool
Returns `true` if the `Path` is relative, i.e., not absolute.
See [`is_absolute`](struct.path#method.is_absolute)’s documentation for more details.
##### Examples
```
use std::path::Path;
assert!(Path::new("foo.txt").is_relative());
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#2139-2141)#### pub fn has\_root(&self) -> bool
Returns `true` if the `Path` has a root.
* On Unix, a path has a root if it begins with `/`.
* On Windows, a path has a root if it:
+ has no prefix and begins with a separator, e.g., `\windows`
+ has a prefix followed by a separator, e.g., `c:\windows` but not `c:windows`
+ has any non-disk prefix, e.g., `\\server\share`
##### Examples
```
use std::path::Path;
assert!(Path::new("/etc/passwd").has_root());
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#2162-2171)#### pub fn parent(&self) -> Option<&Path>
Returns the `Path` without its final component, if there is one.
Returns [`None`](../option/enum.option#variant.None "None") if the path terminates in a root or prefix.
##### Examples
```
use std::path::Path;
let path = Path::new("/foo/bar");
let parent = path.parent().unwrap();
assert_eq!(parent, Path::new("/foo"));
let grand_parent = parent.parent().unwrap();
assert_eq!(grand_parent, Path::new("/"));
assert_eq!(grand_parent.parent(), None);
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#2203-2205)1.28.0 · #### pub fn ancestors(&self) -> Ancestors<'\_>
Notable traits for [Ancestors](struct.ancestors "struct std::path::Ancestors")<'a>
```
impl<'a> Iterator for Ancestors<'a>
type Item = &'a Path;
```
Produces an iterator over `Path` and its ancestors.
The iterator will yield the `Path` that is returned if the [`parent`](struct.path#method.parent) method is used zero or more times. That means, the iterator will yield `&self`, `&self.parent().unwrap()`, `&self.parent().unwrap().parent().unwrap()` and so on. If the [`parent`](struct.path#method.parent) method returns [`None`](../option/enum.option#variant.None "None"), the iterator will do likewise. The iterator will always yield at least one value, namely `&self`.
##### Examples
```
use std::path::Path;
let mut ancestors = Path::new("/foo/bar").ancestors();
assert_eq!(ancestors.next(), Some(Path::new("/foo/bar")));
assert_eq!(ancestors.next(), Some(Path::new("/foo")));
assert_eq!(ancestors.next(), Some(Path::new("/")));
assert_eq!(ancestors.next(), None);
let mut ancestors = Path::new("../foo/bar").ancestors();
assert_eq!(ancestors.next(), Some(Path::new("../foo/bar")));
assert_eq!(ancestors.next(), Some(Path::new("../foo")));
assert_eq!(ancestors.next(), Some(Path::new("..")));
assert_eq!(ancestors.next(), Some(Path::new("")));
assert_eq!(ancestors.next(), None);
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#2229-2234)#### pub fn file\_name(&self) -> Option<&OsStr>
Returns the final component of the `Path`, if there is one.
If the path is a normal file, this is the file name. If it’s the path of a directory, this is the directory name.
Returns [`None`](../option/enum.option#variant.None "None") if the path terminates in `..`.
##### Examples
```
use std::path::Path;
use std::ffi::OsStr;
assert_eq!(Some(OsStr::new("bin")), Path::new("/usr/bin/").file_name());
assert_eq!(Some(OsStr::new("foo.txt")), Path::new("tmp/foo.txt").file_name());
assert_eq!(Some(OsStr::new("foo.txt")), Path::new("foo.txt/.").file_name());
assert_eq!(Some(OsStr::new("foo.txt")), Path::new("foo.txt/.//").file_name());
assert_eq!(None, Path::new("foo.txt/..").file_name());
assert_eq!(None, Path::new("/").file_name());
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#2265-2270)1.7.0 · #### pub fn strip\_prefix<P>(&self, base: P) -> Result<&Path, StripPrefixError>where P: [AsRef](../convert/trait.asref "trait std::convert::AsRef")<[Path](struct.path "struct std::path::Path")>,
Returns a path that, when joined onto `base`, yields `self`.
##### Errors
If `base` is not a prefix of `self` (i.e., [`starts_with`](struct.path#method.starts_with) returns `false`), returns [`Err`](../result/enum.result#variant.Err "Err").
##### Examples
```
use std::path::{Path, PathBuf};
let path = Path::new("/test/haha/foo.txt");
assert_eq!(path.strip_prefix("/"), Ok(Path::new("test/haha/foo.txt")));
assert_eq!(path.strip_prefix("/test"), Ok(Path::new("haha/foo.txt")));
assert_eq!(path.strip_prefix("/test/"), Ok(Path::new("haha/foo.txt")));
assert_eq!(path.strip_prefix("/test/haha/foo.txt"), Ok(Path::new("")));
assert_eq!(path.strip_prefix("/test/haha/foo.txt/"), Ok(Path::new("")));
assert!(path.strip_prefix("test").is_err());
assert!(path.strip_prefix("/haha").is_err());
let prefix = PathBuf::from("/test/");
assert_eq!(path.strip_prefix(prefix), Ok(Path::new("haha/foo.txt")));
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#2302-2304)#### pub fn starts\_with<P: AsRef<Path>>(&self, base: P) -> bool
Determines whether `base` is a prefix of `self`.
Only considers whole path components to match.
##### Examples
```
use std::path::Path;
let path = Path::new("/etc/passwd");
assert!(path.starts_with("/etc"));
assert!(path.starts_with("/etc/"));
assert!(path.starts_with("/etc/passwd"));
assert!(path.starts_with("/etc/passwd/")); // extra slash is okay
assert!(path.starts_with("/etc/passwd///")); // multiple extra slashes are okay
assert!(!path.starts_with("/e"));
assert!(!path.starts_with("/etc/passwd.txt"));
assert!(!Path::new("/etc/foo.rs").starts_with("/etc/foo"));
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#2330-2332)#### pub fn ends\_with<P: AsRef<Path>>(&self, child: P) -> bool
Determines whether `child` is a suffix of `self`.
Only considers whole path components to match.
##### Examples
```
use std::path::Path;
let path = Path::new("/etc/resolv.conf");
assert!(path.ends_with("resolv.conf"));
assert!(path.ends_with("etc/resolv.conf"));
assert!(path.ends_with("/etc/resolv.conf"));
assert!(!path.ends_with("/resolv.conf"));
assert!(!path.ends_with("conf")); // use .extension() instead
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#2366-2368)#### pub fn file\_stem(&self) -> Option<&OsStr>
Extracts the stem (non-extension) portion of [`self.file_name`](struct.path#method.file_name).
The stem is:
* [`None`](../option/enum.option#variant.None "None"), if there is no file name;
* The entire file name if there is no embedded `.`;
* The entire file name if the file name begins with `.` and has no other `.`s within;
* Otherwise, the portion of the file name before the final `.`
##### Examples
```
use std::path::Path;
assert_eq!("foo", Path::new("foo.rs").file_stem().unwrap());
assert_eq!("foo.tar", Path::new("foo.tar.gz").file_stem().unwrap());
```
##### See Also
This method is similar to [`Path::file_prefix`](struct.path#method.file_prefix), which extracts the portion of the file name before the *first* `.`
[source](https://doc.rust-lang.org/src/std/path.rs.html#2400-2402)#### pub fn file\_prefix(&self) -> Option<&OsStr>
🔬This is a nightly-only experimental API. (`path_file_prefix` [#86319](https://github.com/rust-lang/rust/issues/86319))
Extracts the prefix of [`self.file_name`](struct.path#method.file_name).
The prefix is:
* [`None`](../option/enum.option#variant.None "None"), if there is no file name;
* The entire file name if there is no embedded `.`;
* The portion of the file name before the first non-beginning `.`;
* The entire file name if the file name begins with `.` and has no other `.`s within;
* The portion of the file name before the second `.` if the file name begins with `.`
##### Examples
```
use std::path::Path;
assert_eq!("foo", Path::new("foo.rs").file_prefix().unwrap());
assert_eq!("foo", Path::new("foo.tar.gz").file_prefix().unwrap());
```
##### See Also
This method is similar to [`Path::file_stem`](struct.path#method.file_stem), which extracts the portion of the file name before the *last* `.`
[source](https://doc.rust-lang.org/src/std/path.rs.html#2425-2427)#### pub fn extension(&self) -> Option<&OsStr>
Extracts the extension of [`self.file_name`](struct.path#method.file_name), if possible.
The extension is:
* [`None`](../option/enum.option#variant.None "None"), if there is no file name;
* [`None`](../option/enum.option#variant.None "None"), if there is no embedded `.`;
* [`None`](../option/enum.option#variant.None "None"), if the file name begins with `.` and has no other `.`s within;
* Otherwise, the portion of the file name after the final `.`
##### Examples
```
use std::path::Path;
assert_eq!("rs", Path::new("foo.rs").extension().unwrap());
assert_eq!("gz", Path::new("foo.tar.gz").extension().unwrap());
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#2442-2444)#### pub fn join<P: AsRef<Path>>(&self, path: P) -> PathBuf
Creates an owned [`PathBuf`](struct.pathbuf "PathBuf") with `path` adjoined to `self`.
See [`PathBuf::push`](struct.pathbuf#method.push "PathBuf::push") for more details on what it means to adjoin a path.
##### Examples
```
use std::path::{Path, PathBuf};
assert_eq!(Path::new("/etc").join("passwd"), PathBuf::from("/etc/passwd"));
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#2469-2471)#### pub fn with\_file\_name<S: AsRef<OsStr>>(&self, file\_name: S) -> PathBuf
Creates an owned [`PathBuf`](struct.pathbuf "PathBuf") like `self` but with the given file name.
See [`PathBuf::set_file_name`](struct.pathbuf#method.set_file_name "PathBuf::set_file_name") for more details.
##### Examples
```
use std::path::{Path, PathBuf};
let path = Path::new("/tmp/foo.txt");
assert_eq!(path.with_file_name("bar.txt"), PathBuf::from("/tmp/bar.txt"));
let path = Path::new("/tmp");
assert_eq!(path.with_file_name("var"), PathBuf::from("/var"));
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#2497-2499)#### pub fn with\_extension<S: AsRef<OsStr>>(&self, extension: S) -> PathBuf
Creates an owned [`PathBuf`](struct.pathbuf "PathBuf") like `self` but with the given extension.
See [`PathBuf::set_extension`](struct.pathbuf#method.set_extension "PathBuf::set_extension") for more details.
##### Examples
```
use std::path::{Path, PathBuf};
let path = Path::new("foo.rs");
assert_eq!(path.with_extension("txt"), PathBuf::from("foo.txt"));
let path = Path::new("foo.tar.gz");
assert_eq!(path.with_extension(""), PathBuf::from("foo.tar"));
assert_eq!(path.with_extension("xz"), PathBuf::from("foo.tar.xz"));
assert_eq!(path.with_extension("").with_extension("txt"), PathBuf::from("foo.txt"));
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#2541-2551)#### pub fn components(&self) -> Components<'\_>
Notable traits for [Components](struct.components "struct std::path::Components")<'a>
```
impl<'a> Iterator for Components<'a>
type Item = Component<'a>;
```
Produces an iterator over the [`Component`](enum.component "Component")s of the path.
When parsing the path, there is a small amount of normalization:
* Repeated separators are ignored, so `a/b` and `a//b` both have `a` and `b` as components.
* Occurrences of `.` are normalized away, except if they are at the beginning of the path. For example, `a/./b`, `a/b/`, `a/b/.` and `a/b` all have `a` and `b` as components, but `./a/b` starts with an additional [`CurDir`](enum.component#variant.CurDir) component.
* A trailing slash is normalized away, `/a/b` and `/a/b/` are equivalent.
Note that no other normalization takes place; in particular, `a/c` and `a/b/../c` are distinct, to account for the possibility that `b` is a symbolic link (so its parent isn’t `a`).
##### Examples
```
use std::path::{Path, Component};
use std::ffi::OsStr;
let mut components = Path::new("/tmp/foo.txt").components();
assert_eq!(components.next(), Some(Component::RootDir));
assert_eq!(components.next(), Some(Component::Normal(OsStr::new("tmp"))));
assert_eq!(components.next(), Some(Component::Normal(OsStr::new("foo.txt"))));
assert_eq!(components.next(), None)
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#2575-2577)#### pub fn iter(&self) -> Iter<'\_>
Notable traits for [Iter](struct.iter "struct std::path::Iter")<'a>
```
impl<'a> Iterator for Iter<'a>
type Item = &'a OsStr;
```
Produces an iterator over the path’s components viewed as [`OsStr`](../ffi/struct.osstr "OsStr") slices.
For more information about the particulars of how the path is separated into components, see [`components`](struct.path#method.components).
##### Examples
```
use std::path::{self, Path};
use std::ffi::OsStr;
let mut it = Path::new("/tmp/foo.txt").iter();
assert_eq!(it.next(), Some(OsStr::new(&path::MAIN_SEPARATOR.to_string())));
assert_eq!(it.next(), Some(OsStr::new("tmp")));
assert_eq!(it.next(), Some(OsStr::new("foo.txt")));
assert_eq!(it.next(), None)
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#2599-2601)#### pub fn display(&self) -> Display<'\_>
Returns an object that implements [`Display`](../fmt/trait.display) for safely printing paths that may contain non-Unicode data. This may perform lossy conversion, depending on the platform. If you would like an implementation which escapes the path please use [`Debug`](../fmt/macro.debug "Debug") instead.
##### Examples
```
use std::path::Path;
let path = Path::new("/tmp/foo.rs");
println!("{}", path.display());
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#2621-2623)1.5.0 · #### pub fn metadata(&self) -> Result<Metadata>
Queries the file system to get information about a file, directory, etc.
This function will traverse symbolic links to query information about the destination file.
This is an alias to [`fs::metadata`](../fs/fn.metadata "fs::metadata").
##### Examples
```
use std::path::Path;
let path = Path::new("/Minas/tirith");
let metadata = path.metadata().expect("metadata call failed");
println!("{:?}", metadata.file_type());
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#2640-2642)1.5.0 · #### pub fn symlink\_metadata(&self) -> Result<Metadata>
Queries the metadata about a file without following symlinks.
This is an alias to [`fs::symlink_metadata`](../fs/fn.symlink_metadata "fs::symlink_metadata").
##### Examples
```
use std::path::Path;
let path = Path::new("/Minas/tirith");
let metadata = path.symlink_metadata().expect("symlink_metadata call failed");
println!("{:?}", metadata.file_type());
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#2659-2661)1.5.0 · #### pub fn canonicalize(&self) -> Result<PathBuf>
Returns the canonical, absolute form of the path with all intermediate components normalized and symbolic links resolved.
This is an alias to [`fs::canonicalize`](../fs/fn.canonicalize "fs::canonicalize").
##### Examples
```
use std::path::{Path, PathBuf};
let path = Path::new("/foo/test/../test/bar.rs");
assert_eq!(path.canonicalize().unwrap(), PathBuf::from("/foo/test/bar.rs"));
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#2677-2679)1.5.0 · #### pub fn read\_link(&self) -> Result<PathBuf>
Reads a symbolic link, returning the file that the link points to.
This is an alias to [`fs::read_link`](../fs/fn.read_link "fs::read_link").
##### Examples
```
use std::path::Path;
let path = Path::new("/laputa/sky_castle.rs");
let path_link = path.read_link().expect("read_link call failed");
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#2702-2704)1.5.0 · #### pub fn read\_dir(&self) -> Result<ReadDir>
Returns an iterator over the entries within a directory.
The iterator will yield instances of `[io::Result](../io/type.result "io::Result")<[fs::DirEntry](../fs/struct.direntry "fs::DirEntry")>`. New errors may be encountered after an iterator is initially constructed.
This is an alias to [`fs::read_dir`](../fs/fn.read_dir "fs::read_dir").
##### Examples
```
use std::path::Path;
let path = Path::new("/laputa");
for entry in path.read_dir().expect("read_dir call failed") {
if let Ok(entry) = entry {
println!("{:?}", entry.path());
}
}
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#2733-2735)1.5.0 · #### pub fn exists(&self) -> bool
Returns `true` if the path points at an existing entity.
Warning: this method may be error-prone, consider using [`try_exists()`](struct.path#method.try_exists) instead! It also has a risk of introducing time-of-check to time-of-use (TOCTOU) bugs.
This function will traverse symbolic links to query information about the destination file.
If you cannot access the metadata of the file, e.g. because of a permission error or broken symbolic links, this will return `false`.
##### Examples
```
use std::path::Path;
assert!(!Path::new("does_not_exist.txt").exists());
```
##### See Also
This is a convenience function that coerces errors to false. If you want to check errors, call [`Path::try_exists`](struct.path#method.try_exists "Path::try_exists").
[source](https://doc.rust-lang.org/src/std/path.rs.html#2761-2763)1.63.0 · #### pub fn try\_exists(&self) -> Result<bool>
Returns `Ok(true)` if the path points at an existing entity.
This function will traverse symbolic links to query information about the destination file. In case of broken symbolic links this will return `Ok(false)`.
As opposed to the [`exists()`](struct.path#method.exists) method, this one doesn’t silently ignore errors unrelated to the path not existing. (E.g. it will return `Err(_)` in case of permission denied on some of the parent directories.)
Note that while this avoids some pitfalls of the `exists()` method, it still can not prevent time-of-check to time-of-use (TOCTOU) bugs. You should only use it in scenarios where those bugs are not an issue.
##### Examples
```
use std::path::Path;
assert!(!Path::new("does_not_exist.txt").try_exists().expect("Can't check existence of file does_not_exist.txt"));
assert!(Path::new("/root/secret_file.txt").try_exists().is_err());
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#2794-2796)1.5.0 · #### pub fn is\_file(&self) -> bool
Returns `true` if the path exists on disk and is pointing at a regular file.
This function will traverse symbolic links to query information about the destination file.
If you cannot access the metadata of the file, e.g. because of a permission error or broken symbolic links, this will return `false`.
##### Examples
```
use std::path::Path;
assert_eq!(Path::new("./is_a_directory/").is_file(), false);
assert_eq!(Path::new("a_file.txt").is_file(), true);
```
##### See Also
This is a convenience function that coerces errors to false. If you want to check errors, call [`fs::metadata`](../fs/fn.metadata "fs::metadata") and handle its [`Result`](../result/enum.result "Result"). Then call [`fs::Metadata::is_file`](../fs/struct.metadata#method.is_file "fs::Metadata::is_file") if it was [`Ok`](../result/enum.result#variant.Ok "Ok").
When the goal is simply to read from (or write to) the source, the most reliable way to test the source can be read (or written to) is to open it. Only using `is_file` can break workflows like `diff <( prog_a )` on a Unix-like system for example. See [`fs::File::open`](../fs/struct.file#method.open "fs::File::open") or [`fs::OpenOptions::open`](../fs/struct.openoptions#method.open "fs::OpenOptions::open") for more information.
[source](https://doc.rust-lang.org/src/std/path.rs.html#2821-2823)1.5.0 · #### pub fn is\_dir(&self) -> bool
Returns `true` if the path exists on disk and is pointing at a directory.
This function will traverse symbolic links to query information about the destination file.
If you cannot access the metadata of the file, e.g. because of a permission error or broken symbolic links, this will return `false`.
##### Examples
```
use std::path::Path;
assert_eq!(Path::new("./is_a_directory/").is_dir(), true);
assert_eq!(Path::new("a_file.txt").is_dir(), false);
```
##### See Also
This is a convenience function that coerces errors to false. If you want to check errors, call [`fs::metadata`](../fs/fn.metadata "fs::metadata") and handle its [`Result`](../result/enum.result "Result"). Then call [`fs::Metadata::is_dir`](../fs/struct.metadata#method.is_dir "fs::Metadata::is_dir") if it was [`Ok`](../result/enum.result#variant.Ok "Ok").
[source](https://doc.rust-lang.org/src/std/path.rs.html#2853-2855)1.58.0 · #### pub fn is\_symlink(&self) -> bool
Returns `true` if the path exists on disk and is pointing at a symbolic link.
This function will not traverse symbolic links. In case of a broken symbolic link this will also return true.
If you cannot access the directory containing the file, e.g., because of a permission error, this will return false.
##### Examples
```
use std::path::Path;
use std::os::unix::fs::symlink;
let link_path = Path::new("link");
symlink("/origin_does_not_exist/", link_path).unwrap();
assert_eq!(link_path.is_symlink(), true);
assert_eq!(link_path.exists(), false);
```
##### See Also
This is a convenience function that coerces errors to false. If you want to check errors, call [`fs::symlink_metadata`](../fs/fn.symlink_metadata "fs::symlink_metadata") and handle its [`Result`](../result/enum.result "Result"). Then call [`fs::Metadata::is_symlink`](../fs/struct.metadata#method.is_symlink "fs::Metadata::is_symlink") if it was [`Ok`](../result/enum.result#variant.Ok "Ok").
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/std/path.rs.html#1880-1885)### impl AsRef<OsStr> for PathBuf
[source](https://doc.rust-lang.org/src/std/path.rs.html#1882-1884)#### fn as\_ref(&self) -> &OsStr
Converts this type into a shared reference of the (usually inferred) input type.
[source](https://doc.rust-lang.org/src/std/path.rs.html#3049-3054)### impl AsRef<Path> for PathBuf
[source](https://doc.rust-lang.org/src/std/path.rs.html#3051-3053)#### fn as\_ref(&self) -> &Path
Converts this type into a shared reference of the (usually inferred) input type.
[source](https://doc.rust-lang.org/src/std/path.rs.html#1728-1733)### impl Borrow<Path> for PathBuf
[source](https://doc.rust-lang.org/src/std/path.rs.html#1730-1732)#### fn borrow(&self) -> &Path
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/std/path.rs.html#1567-1577)### impl Clone for PathBuf
[source](https://doc.rust-lang.org/src/std/path.rs.html#1569-1571)#### fn clone(&self) -> Self
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/std/path.rs.html#1574-1576)#### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/std/path.rs.html#1712-1716)### impl Debug for PathBuf
[source](https://doc.rust-lang.org/src/std/path.rs.html#1713-1715)#### fn fmt(&self, formatter: &mut Formatter<'\_>) -> Result
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/std/path.rs.html#1736-1741)1.17.0 · ### impl Default for PathBuf
[source](https://doc.rust-lang.org/src/std/path.rs.html#1738-1740)#### fn default() -> Self
Returns the “default value” for a type. [Read more](../default/trait.default#tymethod.default)
[source](https://doc.rust-lang.org/src/std/path.rs.html#1719-1725)### impl Deref for PathBuf
#### type Target = Path
The resulting type after dereferencing.
[source](https://doc.rust-lang.org/src/std/path.rs.html#1722-1724)#### fn deref(&self) -> &Path
Dereferences the value.
[source](https://doc.rust-lang.org/src/std/path.rs.html#1700-1709)### impl<P: AsRef<Path>> Extend<P> for PathBuf
[source](https://doc.rust-lang.org/src/std/path.rs.html#1701-1703)#### fn extend<I: IntoIterator<Item = P>>(&mut self, iter: I)
Extends a collection with the contents of an iterator. [Read more](../iter/trait.extend#tymethod.extend)
[source](https://doc.rust-lang.org/src/std/path.rs.html#1706-1708)#### fn extend\_one(&mut self, p: P)
🔬This is a nightly-only experimental API. (`extend_one` [#72631](https://github.com/rust-lang/rust/issues/72631))
Extends a collection with exactly one element.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#379)#### fn extend\_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (`extend_one` [#72631](https://github.com/rust-lang/rust/issues/72631))
Reserves capacity in a collection for the given number of additional elements. [Read more](../iter/trait.extend#method.extend_reserve)
[source](https://doc.rust-lang.org/src/std/path.rs.html#1768-1777)1.28.0 · ### impl<'a> From<&'a PathBuf> for Cow<'a, Path>
[source](https://doc.rust-lang.org/src/std/path.rs.html#1774-1776)#### fn from(p: &'a PathBuf) -> Cow<'a, Path>
Creates a clone-on-write pointer from a reference to [`PathBuf`](struct.pathbuf "PathBuf").
This conversion does not clone or allocate.
[source](https://doc.rust-lang.org/src/std/path.rs.html#1637-1645)### impl<T: ?Sized + AsRef<OsStr>> From<&T> for PathBuf
[source](https://doc.rust-lang.org/src/std/path.rs.html#1642-1644)#### fn from(s: &T) -> PathBuf
Converts a borrowed [`OsStr`](../ffi/struct.osstr "OsStr") to a [`PathBuf`](struct.pathbuf "PathBuf").
Allocates a [`PathBuf`](struct.pathbuf "PathBuf") and copies the data into it.
[source](https://doc.rust-lang.org/src/std/path.rs.html#1606-1614)1.18.0 · ### impl From<Box<Path, Global>> for PathBuf
[source](https://doc.rust-lang.org/src/std/path.rs.html#1611-1613)#### fn from(boxed: Box<Path>) -> PathBuf
Converts a `[Box](../boxed/struct.box "Box")<[Path](struct.path "Path")>` into a [`PathBuf`](struct.pathbuf "PathBuf").
This conversion does not allocate or copy memory.
[source](https://doc.rust-lang.org/src/std/path.rs.html#1780-1788)1.28.0 · ### impl<'a> From<Cow<'a, Path>> for PathBuf
[source](https://doc.rust-lang.org/src/std/path.rs.html#1785-1787)#### fn from(p: Cow<'a, Path>) -> Self
Converts a clone-on-write pointer to an owned path.
Converting from a `Cow::Owned` does not clone or allocate.
[source](https://doc.rust-lang.org/src/std/path.rs.html#1648-1656)### impl From<OsString> for PathBuf
[source](https://doc.rust-lang.org/src/std/path.rs.html#1653-1655)#### fn from(s: OsString) -> PathBuf
Converts an [`OsString`](../ffi/struct.osstring "OsString") into a [`PathBuf`](struct.pathbuf "PathBuf")
This conversion does not allocate or copy memory.
[source](https://doc.rust-lang.org/src/std/path.rs.html#1791-1799)1.24.0 · ### impl From<PathBuf> for Arc<Path>
[source](https://doc.rust-lang.org/src/std/path.rs.html#1795-1798)#### fn from(s: PathBuf) -> Arc<Path>
Converts a [`PathBuf`](struct.pathbuf "PathBuf") into an `[Arc](../sync/struct.arc "Arc")<[Path](struct.path "Path")>` by moving the [`PathBuf`](struct.pathbuf "PathBuf") data into a new [`Arc`](../sync/struct.arc "Arc") buffer.
[source](https://doc.rust-lang.org/src/std/path.rs.html#1617-1626)1.20.0 · ### impl From<PathBuf> for Box<Path>
[source](https://doc.rust-lang.org/src/std/path.rs.html#1623-1625)#### fn from(p: PathBuf) -> Box<Path>
Notable traits for [Box](../boxed/struct.box "struct std::boxed::Box")<I, A>
```
impl<I, A> Iterator for Box<I, A>where
I: Iterator + ?Sized,
A: Allocator,
type Item = <I as Iterator>::Item;
impl<F, A> Future for Box<F, A>where
F: Future + Unpin + ?Sized,
A: Allocator + 'static,
type Output = <F as Future>::Output;
impl<R: Read + ?Sized> Read for Box<R>
impl<W: Write + ?Sized> Write for Box<W>
```
Converts a [`PathBuf`](struct.pathbuf "PathBuf") into a `[Box](../boxed/struct.box "Box")<[Path](struct.path "Path")>`.
This conversion currently should not allocate memory, but this behavior is not guaranteed on all platforms or in all future versions.
[source](https://doc.rust-lang.org/src/std/path.rs.html#1756-1765)1.6.0 · ### impl<'a> From<PathBuf> for Cow<'a, Path>
[source](https://doc.rust-lang.org/src/std/path.rs.html#1762-1764)#### fn from(s: PathBuf) -> Cow<'a, Path>
Creates a clone-on-write pointer from an owned instance of [`PathBuf`](struct.pathbuf "PathBuf").
This conversion does not clone or allocate.
[source](https://doc.rust-lang.org/src/std/path.rs.html#1659-1667)1.14.0 · ### impl From<PathBuf> for OsString
[source](https://doc.rust-lang.org/src/std/path.rs.html#1664-1666)#### fn from(path\_buf: PathBuf) -> OsString
Converts a [`PathBuf`](struct.pathbuf "PathBuf") into an [`OsString`](../ffi/struct.osstring "OsString")
This conversion does not allocate or copy memory.
[source](https://doc.rust-lang.org/src/std/path.rs.html#1812-1820)1.24.0 · ### impl From<PathBuf> for Rc<Path>
[source](https://doc.rust-lang.org/src/std/path.rs.html#1816-1819)#### fn from(s: PathBuf) -> Rc<Path>
Converts a [`PathBuf`](struct.pathbuf "PathBuf") into an `[Rc](../rc/struct.rc "Rc")<[Path](struct.path "Path")>` by moving the [`PathBuf`](struct.pathbuf "PathBuf") data into a new [`Rc`](../rc/struct.rc "Rc") buffer.
[source](https://doc.rust-lang.org/src/std/path.rs.html#1670-1678)### impl From<String> for PathBuf
[source](https://doc.rust-lang.org/src/std/path.rs.html#1675-1677)#### fn from(s: String) -> PathBuf
Converts a [`String`](../string/struct.string "String") into a [`PathBuf`](struct.pathbuf "PathBuf")
This conversion does not allocate or copy memory.
[source](https://doc.rust-lang.org/src/std/path.rs.html#1691-1697)### impl<P: AsRef<Path>> FromIterator<P> for PathBuf
[source](https://doc.rust-lang.org/src/std/path.rs.html#1692-1696)#### fn from\_iter<I: IntoIterator<Item = P>>(iter: I) -> PathBuf
Creates a value from an iterator. [Read more](../iter/trait.fromiterator#tymethod.from_iter)
[source](https://doc.rust-lang.org/src/std/path.rs.html#1681-1688)1.32.0 · ### impl FromStr for PathBuf
#### type Err = Infallible
The associated error which can be returned from parsing.
[source](https://doc.rust-lang.org/src/std/path.rs.html#1685-1687)#### fn from\_str(s: &str) -> Result<Self, Self::Err>
Parses a string `s` to return a value of this type. [Read more](../str/trait.fromstr#tymethod.from_str)
[source](https://doc.rust-lang.org/src/std/path.rs.html#1854-1858)### impl Hash for PathBuf
[source](https://doc.rust-lang.org/src/std/path.rs.html#1855-1857)#### fn hash<H: Hasher>(&self, h: &mut H)
Feeds this value into the given [`Hasher`](../hash/trait.hasher "Hasher"). [Read more](../hash/trait.hash#tymethod.hash)
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#237-239)1.3.0 · #### fn hash\_slice<H>(data: &[Self], state: &mut H)where H: [Hasher](../hash/trait.hasher "trait std::hash::Hasher"),
Feeds a slice of this type into the given [`Hasher`](../hash/trait.hasher "Hasher"). [Read more](../hash/trait.hash#method.hash_slice)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3057-3064)1.6.0 · ### impl<'a> IntoIterator for &'a PathBuf
#### type Item = &'a OsStr
The type of the elements being iterated over.
#### type IntoIter = Iter<'a>
Which kind of iterator are we turning this into?
[source](https://doc.rust-lang.org/src/std/path.rs.html#3061-3063)#### fn into\_iter(self) -> Iter<'a>
Notable traits for [Iter](struct.iter "struct std::path::Iter")<'a>
```
impl<'a> Iterator for Iter<'a>
type Item = &'a OsStr;
```
Creates an iterator from a value. [Read more](../iter/trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/std/path.rs.html#1872-1877)### impl Ord for PathBuf
[source](https://doc.rust-lang.org/src/std/path.rs.html#1874-1876)#### fn cmp(&self, other: &PathBuf) -> Ordering
This method returns an [`Ordering`](../cmp/enum.ordering "Ordering") between `self` and `other`. [Read more](../cmp/trait.ord#tymethod.cmp)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#804-807)1.21.0 · #### fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. [Read more](../cmp/trait.ord#method.max)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#831-834)1.21.0 · #### fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. [Read more](../cmp/trait.ord#method.min)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#863-867)1.50.0 · #### fn clamp(self, min: Self, max: Self) -> Selfwhere Self: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<Self>,
Restrict a value to a certain interval. [Read more](../cmp/trait.ord#method.clamp)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3155)1.8.0 · ### impl<'a, 'b> PartialEq<&'a OsStr> for PathBuf
[source](https://doc.rust-lang.org/src/std/path.rs.html#3155)#### fn eq(&self, other: &&'a OsStr) -> bool
This method tests for `self` and `other` values to be equal, and is used by `==`. [Read more](../cmp/trait.partialeq#tymethod.eq)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#236)#### fn ne(&self, other: &Rhs) -> bool
This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. [Read more](../cmp/trait.partialeq#method.ne)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3113)1.6.0 · ### impl<'a, 'b> PartialEq<&'a Path> for PathBuf
[source](https://doc.rust-lang.org/src/std/path.rs.html#3113)#### fn eq(&self, other: &&'a Path) -> bool
This method tests for `self` and `other` values to be equal, and is used by `==`. [Read more](../cmp/trait.partialeq#tymethod.eq)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#236)#### fn ne(&self, other: &Rhs) -> bool
This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. [Read more](../cmp/trait.partialeq#method.ne)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3156)1.8.0 · ### impl<'a, 'b> PartialEq<Cow<'a, OsStr>> for PathBuf
[source](https://doc.rust-lang.org/src/std/path.rs.html#3156)#### fn eq(&self, other: &Cow<'a, OsStr>) -> bool
This method tests for `self` and `other` values to be equal, and is used by `==`. [Read more](../cmp/trait.partialeq#tymethod.eq)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#236)#### fn ne(&self, other: &Rhs) -> bool
This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. [Read more](../cmp/trait.partialeq#method.ne)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3116)1.6.0 · ### impl<'a, 'b> PartialEq<Cow<'a, Path>> for PathBuf
[source](https://doc.rust-lang.org/src/std/path.rs.html#3116)#### fn eq(&self, other: &Cow<'a, Path>) -> bool
This method tests for `self` and `other` values to be equal, and is used by `==`. [Read more](../cmp/trait.partialeq#tymethod.eq)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#236)#### fn ne(&self, other: &Rhs) -> bool
This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. [Read more](../cmp/trait.partialeq#method.ne)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3154)1.8.0 · ### impl<'a, 'b> PartialEq<OsStr> for PathBuf
[source](https://doc.rust-lang.org/src/std/path.rs.html#3154)#### fn eq(&self, other: &OsStr) -> bool
This method tests for `self` and `other` values to be equal, and is used by `==`. [Read more](../cmp/trait.partialeq#tymethod.eq)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#236)#### fn ne(&self, other: &Rhs) -> bool
This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. [Read more](../cmp/trait.partialeq#method.ne)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3157)1.8.0 · ### impl<'a, 'b> PartialEq<OsString> for PathBuf
[source](https://doc.rust-lang.org/src/std/path.rs.html#3157)#### fn eq(&self, other: &OsString) -> bool
This method tests for `self` and `other` values to be equal, and is used by `==`. [Read more](../cmp/trait.partialeq#tymethod.eq)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#236)#### fn ne(&self, other: &Rhs) -> bool
This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. [Read more](../cmp/trait.partialeq#method.ne)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3112)1.6.0 · ### impl<'a, 'b> PartialEq<Path> for PathBuf
[source](https://doc.rust-lang.org/src/std/path.rs.html#3112)#### fn eq(&self, other: &Path) -> bool
This method tests for `self` and `other` values to be equal, and is used by `==`. [Read more](../cmp/trait.partialeq#tymethod.eq)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#236)#### fn ne(&self, other: &Rhs) -> bool
This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. [Read more](../cmp/trait.partialeq#method.ne)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3155)1.8.0 · ### impl<'a, 'b> PartialEq<PathBuf> for &'a OsStr
[source](https://doc.rust-lang.org/src/std/path.rs.html#3155)#### fn eq(&self, other: &PathBuf) -> bool
This method tests for `self` and `other` values to be equal, and is used by `==`. [Read more](../cmp/trait.partialeq#tymethod.eq)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#236)#### fn ne(&self, other: &Rhs) -> bool
This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. [Read more](../cmp/trait.partialeq#method.ne)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3113)1.6.0 · ### impl<'a, 'b> PartialEq<PathBuf> for &'a Path
[source](https://doc.rust-lang.org/src/std/path.rs.html#3113)#### fn eq(&self, other: &PathBuf) -> bool
This method tests for `self` and `other` values to be equal, and is used by `==`. [Read more](../cmp/trait.partialeq#tymethod.eq)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#236)#### fn ne(&self, other: &Rhs) -> bool
This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. [Read more](../cmp/trait.partialeq#method.ne)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3156)1.8.0 · ### impl<'a, 'b> PartialEq<PathBuf> for Cow<'a, OsStr>
[source](https://doc.rust-lang.org/src/std/path.rs.html#3156)#### fn eq(&self, other: &PathBuf) -> bool
This method tests for `self` and `other` values to be equal, and is used by `==`. [Read more](../cmp/trait.partialeq#tymethod.eq)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#236)#### fn ne(&self, other: &Rhs) -> bool
This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. [Read more](../cmp/trait.partialeq#method.ne)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3116)1.6.0 · ### impl<'a, 'b> PartialEq<PathBuf> for Cow<'a, Path>
[source](https://doc.rust-lang.org/src/std/path.rs.html#3116)#### fn eq(&self, other: &PathBuf) -> bool
This method tests for `self` and `other` values to be equal, and is used by `==`. [Read more](../cmp/trait.partialeq#tymethod.eq)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#236)#### fn ne(&self, other: &Rhs) -> bool
This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. [Read more](../cmp/trait.partialeq#method.ne)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3154)1.8.0 · ### impl<'a, 'b> PartialEq<PathBuf> for OsStr
[source](https://doc.rust-lang.org/src/std/path.rs.html#3154)#### fn eq(&self, other: &PathBuf) -> bool
This method tests for `self` and `other` values to be equal, and is used by `==`. [Read more](../cmp/trait.partialeq#tymethod.eq)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#236)#### fn ne(&self, other: &Rhs) -> bool
This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. [Read more](../cmp/trait.partialeq#method.ne)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3157)1.8.0 · ### impl<'a, 'b> PartialEq<PathBuf> for OsString
[source](https://doc.rust-lang.org/src/std/path.rs.html#3157)#### fn eq(&self, other: &PathBuf) -> bool
This method tests for `self` and `other` values to be equal, and is used by `==`. [Read more](../cmp/trait.partialeq#tymethod.eq)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#236)#### fn ne(&self, other: &Rhs) -> bool
This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. [Read more](../cmp/trait.partialeq#method.ne)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3112)1.6.0 · ### impl<'a, 'b> PartialEq<PathBuf> for Path
[source](https://doc.rust-lang.org/src/std/path.rs.html#3112)#### fn eq(&self, other: &PathBuf) -> bool
This method tests for `self` and `other` values to be equal, and is used by `==`. [Read more](../cmp/trait.partialeq#tymethod.eq)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#236)#### fn ne(&self, other: &Rhs) -> bool
This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. [Read more](../cmp/trait.partialeq#method.ne)
[source](https://doc.rust-lang.org/src/std/path.rs.html#1846-1851)### impl PartialEq<PathBuf> for PathBuf
[source](https://doc.rust-lang.org/src/std/path.rs.html#1848-1850)#### fn eq(&self, other: &PathBuf) -> bool
This method tests for `self` and `other` values to be equal, and is used by `==`. [Read more](../cmp/trait.partialeq#tymethod.eq)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#236)#### fn ne(&self, other: &Rhs) -> bool
This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. [Read more](../cmp/trait.partialeq#method.ne)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3155)1.8.0 · ### impl<'a, 'b> PartialOrd<&'a OsStr> for PathBuf
[source](https://doc.rust-lang.org/src/std/path.rs.html#3155)#### fn partial\_cmp(&self, other: &&'a OsStr) -> Option<Ordering>
This method returns an ordering between `self` and `other` values if one exists. [Read more](../cmp/trait.partialord#tymethod.partial_cmp)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1138)#### fn lt(&self, other: &Rhs) -> bool
This method tests less than (for `self` and `other`) and is used by the `<` operator. [Read more](../cmp/trait.partialord#method.lt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1157)#### fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for `self` and `other`) and is used by the `<=` operator. [Read more](../cmp/trait.partialord#method.le)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1175)#### fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for `self` and `other`) and is used by the `>` operator. [Read more](../cmp/trait.partialord#method.gt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1194)#### fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for `self` and `other`) and is used by the `>=` operator. [Read more](../cmp/trait.partialord#method.ge)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3113)1.8.0 · ### impl<'a, 'b> PartialOrd<&'a Path> for PathBuf
[source](https://doc.rust-lang.org/src/std/path.rs.html#3113)#### fn partial\_cmp(&self, other: &&'a Path) -> Option<Ordering>
This method returns an ordering between `self` and `other` values if one exists. [Read more](../cmp/trait.partialord#tymethod.partial_cmp)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1138)#### fn lt(&self, other: &Rhs) -> bool
This method tests less than (for `self` and `other`) and is used by the `<` operator. [Read more](../cmp/trait.partialord#method.lt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1157)#### fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for `self` and `other`) and is used by the `<=` operator. [Read more](../cmp/trait.partialord#method.le)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1175)#### fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for `self` and `other`) and is used by the `>` operator. [Read more](../cmp/trait.partialord#method.gt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1194)#### fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for `self` and `other`) and is used by the `>=` operator. [Read more](../cmp/trait.partialord#method.ge)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3156)1.8.0 · ### impl<'a, 'b> PartialOrd<Cow<'a, OsStr>> for PathBuf
[source](https://doc.rust-lang.org/src/std/path.rs.html#3156)#### fn partial\_cmp(&self, other: &Cow<'a, OsStr>) -> Option<Ordering>
This method returns an ordering between `self` and `other` values if one exists. [Read more](../cmp/trait.partialord#tymethod.partial_cmp)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1138)#### fn lt(&self, other: &Rhs) -> bool
This method tests less than (for `self` and `other`) and is used by the `<` operator. [Read more](../cmp/trait.partialord#method.lt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1157)#### fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for `self` and `other`) and is used by the `<=` operator. [Read more](../cmp/trait.partialord#method.le)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1175)#### fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for `self` and `other`) and is used by the `>` operator. [Read more](../cmp/trait.partialord#method.gt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1194)#### fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for `self` and `other`) and is used by the `>=` operator. [Read more](../cmp/trait.partialord#method.ge)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3116)1.8.0 · ### impl<'a, 'b> PartialOrd<Cow<'a, Path>> for PathBuf
[source](https://doc.rust-lang.org/src/std/path.rs.html#3116)#### fn partial\_cmp(&self, other: &Cow<'a, Path>) -> Option<Ordering>
This method returns an ordering between `self` and `other` values if one exists. [Read more](../cmp/trait.partialord#tymethod.partial_cmp)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1138)#### fn lt(&self, other: &Rhs) -> bool
This method tests less than (for `self` and `other`) and is used by the `<` operator. [Read more](../cmp/trait.partialord#method.lt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1157)#### fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for `self` and `other`) and is used by the `<=` operator. [Read more](../cmp/trait.partialord#method.le)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1175)#### fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for `self` and `other`) and is used by the `>` operator. [Read more](../cmp/trait.partialord#method.gt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1194)#### fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for `self` and `other`) and is used by the `>=` operator. [Read more](../cmp/trait.partialord#method.ge)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3154)1.8.0 · ### impl<'a, 'b> PartialOrd<OsStr> for PathBuf
[source](https://doc.rust-lang.org/src/std/path.rs.html#3154)#### fn partial\_cmp(&self, other: &OsStr) -> Option<Ordering>
This method returns an ordering between `self` and `other` values if one exists. [Read more](../cmp/trait.partialord#tymethod.partial_cmp)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1138)#### fn lt(&self, other: &Rhs) -> bool
This method tests less than (for `self` and `other`) and is used by the `<` operator. [Read more](../cmp/trait.partialord#method.lt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1157)#### fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for `self` and `other`) and is used by the `<=` operator. [Read more](../cmp/trait.partialord#method.le)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1175)#### fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for `self` and `other`) and is used by the `>` operator. [Read more](../cmp/trait.partialord#method.gt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1194)#### fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for `self` and `other`) and is used by the `>=` operator. [Read more](../cmp/trait.partialord#method.ge)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3157)1.8.0 · ### impl<'a, 'b> PartialOrd<OsString> for PathBuf
[source](https://doc.rust-lang.org/src/std/path.rs.html#3157)#### fn partial\_cmp(&self, other: &OsString) -> Option<Ordering>
This method returns an ordering between `self` and `other` values if one exists. [Read more](../cmp/trait.partialord#tymethod.partial_cmp)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1138)#### fn lt(&self, other: &Rhs) -> bool
This method tests less than (for `self` and `other`) and is used by the `<` operator. [Read more](../cmp/trait.partialord#method.lt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1157)#### fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for `self` and `other`) and is used by the `<=` operator. [Read more](../cmp/trait.partialord#method.le)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1175)#### fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for `self` and `other`) and is used by the `>` operator. [Read more](../cmp/trait.partialord#method.gt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1194)#### fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for `self` and `other`) and is used by the `>=` operator. [Read more](../cmp/trait.partialord#method.ge)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3112)1.8.0 · ### impl<'a, 'b> PartialOrd<Path> for PathBuf
[source](https://doc.rust-lang.org/src/std/path.rs.html#3112)#### fn partial\_cmp(&self, other: &Path) -> Option<Ordering>
This method returns an ordering between `self` and `other` values if one exists. [Read more](../cmp/trait.partialord#tymethod.partial_cmp)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1138)#### fn lt(&self, other: &Rhs) -> bool
This method tests less than (for `self` and `other`) and is used by the `<` operator. [Read more](../cmp/trait.partialord#method.lt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1157)#### fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for `self` and `other`) and is used by the `<=` operator. [Read more](../cmp/trait.partialord#method.le)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1175)#### fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for `self` and `other`) and is used by the `>` operator. [Read more](../cmp/trait.partialord#method.gt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1194)#### fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for `self` and `other`) and is used by the `>=` operator. [Read more](../cmp/trait.partialord#method.ge)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3155)1.8.0 · ### impl<'a, 'b> PartialOrd<PathBuf> for &'a OsStr
[source](https://doc.rust-lang.org/src/std/path.rs.html#3155)#### fn partial\_cmp(&self, other: &PathBuf) -> Option<Ordering>
This method returns an ordering between `self` and `other` values if one exists. [Read more](../cmp/trait.partialord#tymethod.partial_cmp)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1138)#### fn lt(&self, other: &Rhs) -> bool
This method tests less than (for `self` and `other`) and is used by the `<` operator. [Read more](../cmp/trait.partialord#method.lt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1157)#### fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for `self` and `other`) and is used by the `<=` operator. [Read more](../cmp/trait.partialord#method.le)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1175)#### fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for `self` and `other`) and is used by the `>` operator. [Read more](../cmp/trait.partialord#method.gt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1194)#### fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for `self` and `other`) and is used by the `>=` operator. [Read more](../cmp/trait.partialord#method.ge)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3113)1.8.0 · ### impl<'a, 'b> PartialOrd<PathBuf> for &'a Path
[source](https://doc.rust-lang.org/src/std/path.rs.html#3113)#### fn partial\_cmp(&self, other: &PathBuf) -> Option<Ordering>
This method returns an ordering between `self` and `other` values if one exists. [Read more](../cmp/trait.partialord#tymethod.partial_cmp)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1138)#### fn lt(&self, other: &Rhs) -> bool
This method tests less than (for `self` and `other`) and is used by the `<` operator. [Read more](../cmp/trait.partialord#method.lt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1157)#### fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for `self` and `other`) and is used by the `<=` operator. [Read more](../cmp/trait.partialord#method.le)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1175)#### fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for `self` and `other`) and is used by the `>` operator. [Read more](../cmp/trait.partialord#method.gt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1194)#### fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for `self` and `other`) and is used by the `>=` operator. [Read more](../cmp/trait.partialord#method.ge)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3156)1.8.0 · ### impl<'a, 'b> PartialOrd<PathBuf> for Cow<'a, OsStr>
[source](https://doc.rust-lang.org/src/std/path.rs.html#3156)#### fn partial\_cmp(&self, other: &PathBuf) -> Option<Ordering>
This method returns an ordering between `self` and `other` values if one exists. [Read more](../cmp/trait.partialord#tymethod.partial_cmp)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1138)#### fn lt(&self, other: &Rhs) -> bool
This method tests less than (for `self` and `other`) and is used by the `<` operator. [Read more](../cmp/trait.partialord#method.lt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1157)#### fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for `self` and `other`) and is used by the `<=` operator. [Read more](../cmp/trait.partialord#method.le)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1175)#### fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for `self` and `other`) and is used by the `>` operator. [Read more](../cmp/trait.partialord#method.gt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1194)#### fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for `self` and `other`) and is used by the `>=` operator. [Read more](../cmp/trait.partialord#method.ge)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3116)1.8.0 · ### impl<'a, 'b> PartialOrd<PathBuf> for Cow<'a, Path>
[source](https://doc.rust-lang.org/src/std/path.rs.html#3116)#### fn partial\_cmp(&self, other: &PathBuf) -> Option<Ordering>
This method returns an ordering between `self` and `other` values if one exists. [Read more](../cmp/trait.partialord#tymethod.partial_cmp)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1138)#### fn lt(&self, other: &Rhs) -> bool
This method tests less than (for `self` and `other`) and is used by the `<` operator. [Read more](../cmp/trait.partialord#method.lt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1157)#### fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for `self` and `other`) and is used by the `<=` operator. [Read more](../cmp/trait.partialord#method.le)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1175)#### fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for `self` and `other`) and is used by the `>` operator. [Read more](../cmp/trait.partialord#method.gt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1194)#### fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for `self` and `other`) and is used by the `>=` operator. [Read more](../cmp/trait.partialord#method.ge)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3154)1.8.0 · ### impl<'a, 'b> PartialOrd<PathBuf> for OsStr
[source](https://doc.rust-lang.org/src/std/path.rs.html#3154)#### fn partial\_cmp(&self, other: &PathBuf) -> Option<Ordering>
This method returns an ordering between `self` and `other` values if one exists. [Read more](../cmp/trait.partialord#tymethod.partial_cmp)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1138)#### fn lt(&self, other: &Rhs) -> bool
This method tests less than (for `self` and `other`) and is used by the `<` operator. [Read more](../cmp/trait.partialord#method.lt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1157)#### fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for `self` and `other`) and is used by the `<=` operator. [Read more](../cmp/trait.partialord#method.le)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1175)#### fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for `self` and `other`) and is used by the `>` operator. [Read more](../cmp/trait.partialord#method.gt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1194)#### fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for `self` and `other`) and is used by the `>=` operator. [Read more](../cmp/trait.partialord#method.ge)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3157)1.8.0 · ### impl<'a, 'b> PartialOrd<PathBuf> for OsString
[source](https://doc.rust-lang.org/src/std/path.rs.html#3157)#### fn partial\_cmp(&self, other: &PathBuf) -> Option<Ordering>
This method returns an ordering between `self` and `other` values if one exists. [Read more](../cmp/trait.partialord#tymethod.partial_cmp)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1138)#### fn lt(&self, other: &Rhs) -> bool
This method tests less than (for `self` and `other`) and is used by the `<` operator. [Read more](../cmp/trait.partialord#method.lt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1157)#### fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for `self` and `other`) and is used by the `<=` operator. [Read more](../cmp/trait.partialord#method.le)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1175)#### fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for `self` and `other`) and is used by the `>` operator. [Read more](../cmp/trait.partialord#method.gt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1194)#### fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for `self` and `other`) and is used by the `>=` operator. [Read more](../cmp/trait.partialord#method.ge)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3112)1.8.0 · ### impl<'a, 'b> PartialOrd<PathBuf> for Path
[source](https://doc.rust-lang.org/src/std/path.rs.html#3112)#### fn partial\_cmp(&self, other: &PathBuf) -> Option<Ordering>
This method returns an ordering between `self` and `other` values if one exists. [Read more](../cmp/trait.partialord#tymethod.partial_cmp)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1138)#### fn lt(&self, other: &Rhs) -> bool
This method tests less than (for `self` and `other`) and is used by the `<` operator. [Read more](../cmp/trait.partialord#method.lt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1157)#### fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for `self` and `other`) and is used by the `<=` operator. [Read more](../cmp/trait.partialord#method.le)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1175)#### fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for `self` and `other`) and is used by the `>` operator. [Read more](../cmp/trait.partialord#method.gt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1194)#### fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for `self` and `other`) and is used by the `>=` operator. [Read more](../cmp/trait.partialord#method.ge)
[source](https://doc.rust-lang.org/src/std/path.rs.html#1864-1869)### impl PartialOrd<PathBuf> for PathBuf
[source](https://doc.rust-lang.org/src/std/path.rs.html#1866-1868)#### fn partial\_cmp(&self, other: &PathBuf) -> Option<Ordering>
This method returns an ordering between `self` and `other` values if one exists. [Read more](../cmp/trait.partialord#tymethod.partial_cmp)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1138)#### fn lt(&self, other: &Rhs) -> bool
This method tests less than (for `self` and `other`) and is used by the `<` operator. [Read more](../cmp/trait.partialord#method.lt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1157)#### fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for `self` and `other`) and is used by the `<=` operator. [Read more](../cmp/trait.partialord#method.le)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1175)#### fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for `self` and `other`) and is used by the `>` operator. [Read more](../cmp/trait.partialord#method.gt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1194)#### fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for `self` and `other`) and is used by the `>=` operator. [Read more](../cmp/trait.partialord#method.ge)
[source](https://doc.rust-lang.org/src/std/path.rs.html#1861)### impl Eq for PathBuf
Auto Trait Implementations
--------------------------
### impl RefUnwindSafe for PathBuf
### impl Send for PathBuf
### impl Sync for PathBuf
### impl Unpin for PathBuf
### impl UnwindSafe for PathBuf
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Constant std::path::MAIN_SEPARATOR_STR Constant std::path::MAIN\_SEPARATOR\_STR
========================================
```
pub const MAIN_SEPARATOR_STR: &'static str;
```
🔬This is a nightly-only experimental API. (`main_separator_str` [#94071](https://github.com/rust-lang/rust/issues/94071))
The primary separator of path components for the current platform.
For example, `/` on Unix and `\` on Windows.
rust Struct std::path::Path Struct std::path::Path
======================
```
pub struct Path { /* private fields */ }
```
A slice of a path (akin to [`str`](../primitive.str "str")).
This type supports a number of operations for inspecting a path, including breaking the path into its components (separated by `/` on Unix and by either `/` or `\` on Windows), extracting the file name, determining whether the path is absolute, and so on.
This is an *unsized* type, meaning that it must always be used behind a pointer like `&` or [`Box`](../boxed/struct.box "Box"). For an owned version of this type, see [`PathBuf`](struct.pathbuf "PathBuf").
More details about the overall approach can be found in the [module documentation](index).
Examples
--------
```
use std::path::Path;
use std::ffi::OsStr;
// Note: this example does work on Windows
let path = Path::new("./foo/bar.txt");
let parent = path.parent();
assert_eq!(parent, Some(Path::new("./foo")));
let file_stem = path.file_stem();
assert_eq!(file_stem, Some(OsStr::new("bar")));
let extension = path.extension();
assert_eq!(extension, Some(OsStr::new("txt")));
```
Implementations
---------------
[source](https://doc.rust-lang.org/src/std/path.rs.html#1941-2866)### impl Path
[source](https://doc.rust-lang.org/src/std/path.rs.html#1975-1977)#### pub fn new<S: AsRef<OsStr> + ?Sized>(s: &S) -> &Path
Directly wraps a string slice as a `Path` slice.
This is a cost-free conversion.
##### Examples
```
use std::path::Path;
Path::new("foo.txt");
```
You can create `Path`s from `String`s, or even other `Path`s:
```
use std::path::Path;
let string = String::from("foo.txt");
let from_string = Path::new(&string);
let from_path = Path::new(&from_string);
assert_eq!(from_string, from_path);
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#1992-1994)#### pub fn as\_os\_str(&self) -> &OsStr
Yields the underlying [`OsStr`](../ffi/struct.osstr "OsStr") slice.
##### Examples
```
use std::path::Path;
let os_str = Path::new("foo.txt").as_os_str();
assert_eq!(os_str, std::ffi::OsStr::new("foo.txt"));
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#2016-2018)#### pub fn to\_str(&self) -> Option<&str>
Yields a [`&str`](../primitive.str) slice if the `Path` is valid unicode.
This conversion may entail doing a check for UTF-8 validity. Note that validation is performed because non-UTF-8 strings are perfectly valid for some OS.
##### Examples
```
use std::path::Path;
let path = Path::new("foo.txt");
assert_eq!(path.to_str(), Some("foo.txt"));
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#2044-2046)#### pub fn to\_string\_lossy(&self) -> Cow<'\_, str>
Converts a `Path` to a [`Cow<str>`](../borrow/enum.cow "Cow<str>").
Any non-Unicode sequences are replaced with [`U+FFFD REPLACEMENT CHARACTER`](../char/constant.replacement_character).
##### Examples
Calling `to_string_lossy` on a `Path` with valid unicode:
```
use std::path::Path;
let path = Path::new("foo.txt");
assert_eq!(path.to_string_lossy(), "foo.txt");
```
Had `path` contained invalid unicode, the `to_string_lossy` call might have returned `"fo�.txt"`.
[source](https://doc.rust-lang.org/src/std/path.rs.html#2062-2064)#### pub fn to\_path\_buf(&self) -> PathBuf
Converts a `Path` to an owned [`PathBuf`](struct.pathbuf "PathBuf").
##### Examples
```
use std::path::Path;
let path_buf = Path::new("foo.txt").to_path_buf();
assert_eq!(path_buf, std::path::PathBuf::from("foo.txt"));
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#2087-2094)#### pub fn is\_absolute(&self) -> bool
Returns `true` if the `Path` is absolute, i.e., if it is independent of the current directory.
* On Unix, a path is absolute if it starts with the root, so `is_absolute` and [`has_root`](struct.path#method.has_root) are equivalent.
* On Windows, a path is absolute if it has a prefix and starts with the root: `c:\windows` is absolute, while `c:temp` and `\temp` are not.
##### Examples
```
use std::path::Path;
assert!(!Path::new("foo.txt").is_absolute());
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#2112-2114)#### pub fn is\_relative(&self) -> bool
Returns `true` if the `Path` is relative, i.e., not absolute.
See [`is_absolute`](struct.path#method.is_absolute)’s documentation for more details.
##### Examples
```
use std::path::Path;
assert!(Path::new("foo.txt").is_relative());
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#2139-2141)#### pub fn has\_root(&self) -> bool
Returns `true` if the `Path` has a root.
* On Unix, a path has a root if it begins with `/`.
* On Windows, a path has a root if it:
+ has no prefix and begins with a separator, e.g., `\windows`
+ has a prefix followed by a separator, e.g., `c:\windows` but not `c:windows`
+ has any non-disk prefix, e.g., `\\server\share`
##### Examples
```
use std::path::Path;
assert!(Path::new("/etc/passwd").has_root());
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#2162-2171)#### pub fn parent(&self) -> Option<&Path>
Returns the `Path` without its final component, if there is one.
Returns [`None`](../option/enum.option#variant.None "None") if the path terminates in a root or prefix.
##### Examples
```
use std::path::Path;
let path = Path::new("/foo/bar");
let parent = path.parent().unwrap();
assert_eq!(parent, Path::new("/foo"));
let grand_parent = parent.parent().unwrap();
assert_eq!(grand_parent, Path::new("/"));
assert_eq!(grand_parent.parent(), None);
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#2203-2205)1.28.0 · #### pub fn ancestors(&self) -> Ancestors<'\_>
Notable traits for [Ancestors](struct.ancestors "struct std::path::Ancestors")<'a>
```
impl<'a> Iterator for Ancestors<'a>
type Item = &'a Path;
```
Produces an iterator over `Path` and its ancestors.
The iterator will yield the `Path` that is returned if the [`parent`](struct.path#method.parent) method is used zero or more times. That means, the iterator will yield `&self`, `&self.parent().unwrap()`, `&self.parent().unwrap().parent().unwrap()` and so on. If the [`parent`](struct.path#method.parent) method returns [`None`](../option/enum.option#variant.None "None"), the iterator will do likewise. The iterator will always yield at least one value, namely `&self`.
##### Examples
```
use std::path::Path;
let mut ancestors = Path::new("/foo/bar").ancestors();
assert_eq!(ancestors.next(), Some(Path::new("/foo/bar")));
assert_eq!(ancestors.next(), Some(Path::new("/foo")));
assert_eq!(ancestors.next(), Some(Path::new("/")));
assert_eq!(ancestors.next(), None);
let mut ancestors = Path::new("../foo/bar").ancestors();
assert_eq!(ancestors.next(), Some(Path::new("../foo/bar")));
assert_eq!(ancestors.next(), Some(Path::new("../foo")));
assert_eq!(ancestors.next(), Some(Path::new("..")));
assert_eq!(ancestors.next(), Some(Path::new("")));
assert_eq!(ancestors.next(), None);
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#2229-2234)#### pub fn file\_name(&self) -> Option<&OsStr>
Returns the final component of the `Path`, if there is one.
If the path is a normal file, this is the file name. If it’s the path of a directory, this is the directory name.
Returns [`None`](../option/enum.option#variant.None "None") if the path terminates in `..`.
##### Examples
```
use std::path::Path;
use std::ffi::OsStr;
assert_eq!(Some(OsStr::new("bin")), Path::new("/usr/bin/").file_name());
assert_eq!(Some(OsStr::new("foo.txt")), Path::new("tmp/foo.txt").file_name());
assert_eq!(Some(OsStr::new("foo.txt")), Path::new("foo.txt/.").file_name());
assert_eq!(Some(OsStr::new("foo.txt")), Path::new("foo.txt/.//").file_name());
assert_eq!(None, Path::new("foo.txt/..").file_name());
assert_eq!(None, Path::new("/").file_name());
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#2265-2270)1.7.0 · #### pub fn strip\_prefix<P>(&self, base: P) -> Result<&Path, StripPrefixError>where P: [AsRef](../convert/trait.asref "trait std::convert::AsRef")<[Path](struct.path "struct std::path::Path")>,
Returns a path that, when joined onto `base`, yields `self`.
##### Errors
If `base` is not a prefix of `self` (i.e., [`starts_with`](struct.path#method.starts_with) returns `false`), returns [`Err`](../result/enum.result#variant.Err "Err").
##### Examples
```
use std::path::{Path, PathBuf};
let path = Path::new("/test/haha/foo.txt");
assert_eq!(path.strip_prefix("/"), Ok(Path::new("test/haha/foo.txt")));
assert_eq!(path.strip_prefix("/test"), Ok(Path::new("haha/foo.txt")));
assert_eq!(path.strip_prefix("/test/"), Ok(Path::new("haha/foo.txt")));
assert_eq!(path.strip_prefix("/test/haha/foo.txt"), Ok(Path::new("")));
assert_eq!(path.strip_prefix("/test/haha/foo.txt/"), Ok(Path::new("")));
assert!(path.strip_prefix("test").is_err());
assert!(path.strip_prefix("/haha").is_err());
let prefix = PathBuf::from("/test/");
assert_eq!(path.strip_prefix(prefix), Ok(Path::new("haha/foo.txt")));
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#2302-2304)#### pub fn starts\_with<P: AsRef<Path>>(&self, base: P) -> bool
Determines whether `base` is a prefix of `self`.
Only considers whole path components to match.
##### Examples
```
use std::path::Path;
let path = Path::new("/etc/passwd");
assert!(path.starts_with("/etc"));
assert!(path.starts_with("/etc/"));
assert!(path.starts_with("/etc/passwd"));
assert!(path.starts_with("/etc/passwd/")); // extra slash is okay
assert!(path.starts_with("/etc/passwd///")); // multiple extra slashes are okay
assert!(!path.starts_with("/e"));
assert!(!path.starts_with("/etc/passwd.txt"));
assert!(!Path::new("/etc/foo.rs").starts_with("/etc/foo"));
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#2330-2332)#### pub fn ends\_with<P: AsRef<Path>>(&self, child: P) -> bool
Determines whether `child` is a suffix of `self`.
Only considers whole path components to match.
##### Examples
```
use std::path::Path;
let path = Path::new("/etc/resolv.conf");
assert!(path.ends_with("resolv.conf"));
assert!(path.ends_with("etc/resolv.conf"));
assert!(path.ends_with("/etc/resolv.conf"));
assert!(!path.ends_with("/resolv.conf"));
assert!(!path.ends_with("conf")); // use .extension() instead
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#2366-2368)#### pub fn file\_stem(&self) -> Option<&OsStr>
Extracts the stem (non-extension) portion of [`self.file_name`](struct.path#method.file_name).
The stem is:
* [`None`](../option/enum.option#variant.None "None"), if there is no file name;
* The entire file name if there is no embedded `.`;
* The entire file name if the file name begins with `.` and has no other `.`s within;
* Otherwise, the portion of the file name before the final `.`
##### Examples
```
use std::path::Path;
assert_eq!("foo", Path::new("foo.rs").file_stem().unwrap());
assert_eq!("foo.tar", Path::new("foo.tar.gz").file_stem().unwrap());
```
##### See Also
This method is similar to [`Path::file_prefix`](struct.path#method.file_prefix), which extracts the portion of the file name before the *first* `.`
[source](https://doc.rust-lang.org/src/std/path.rs.html#2400-2402)#### pub fn file\_prefix(&self) -> Option<&OsStr>
🔬This is a nightly-only experimental API. (`path_file_prefix` [#86319](https://github.com/rust-lang/rust/issues/86319))
Extracts the prefix of [`self.file_name`](struct.path#method.file_name).
The prefix is:
* [`None`](../option/enum.option#variant.None "None"), if there is no file name;
* The entire file name if there is no embedded `.`;
* The portion of the file name before the first non-beginning `.`;
* The entire file name if the file name begins with `.` and has no other `.`s within;
* The portion of the file name before the second `.` if the file name begins with `.`
##### Examples
```
use std::path::Path;
assert_eq!("foo", Path::new("foo.rs").file_prefix().unwrap());
assert_eq!("foo", Path::new("foo.tar.gz").file_prefix().unwrap());
```
##### See Also
This method is similar to [`Path::file_stem`](struct.path#method.file_stem), which extracts the portion of the file name before the *last* `.`
[source](https://doc.rust-lang.org/src/std/path.rs.html#2425-2427)#### pub fn extension(&self) -> Option<&OsStr>
Extracts the extension of [`self.file_name`](struct.path#method.file_name), if possible.
The extension is:
* [`None`](../option/enum.option#variant.None "None"), if there is no file name;
* [`None`](../option/enum.option#variant.None "None"), if there is no embedded `.`;
* [`None`](../option/enum.option#variant.None "None"), if the file name begins with `.` and has no other `.`s within;
* Otherwise, the portion of the file name after the final `.`
##### Examples
```
use std::path::Path;
assert_eq!("rs", Path::new("foo.rs").extension().unwrap());
assert_eq!("gz", Path::new("foo.tar.gz").extension().unwrap());
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#2442-2444)#### pub fn join<P: AsRef<Path>>(&self, path: P) -> PathBuf
Creates an owned [`PathBuf`](struct.pathbuf "PathBuf") with `path` adjoined to `self`.
See [`PathBuf::push`](struct.pathbuf#method.push "PathBuf::push") for more details on what it means to adjoin a path.
##### Examples
```
use std::path::{Path, PathBuf};
assert_eq!(Path::new("/etc").join("passwd"), PathBuf::from("/etc/passwd"));
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#2469-2471)#### pub fn with\_file\_name<S: AsRef<OsStr>>(&self, file\_name: S) -> PathBuf
Creates an owned [`PathBuf`](struct.pathbuf "PathBuf") like `self` but with the given file name.
See [`PathBuf::set_file_name`](struct.pathbuf#method.set_file_name "PathBuf::set_file_name") for more details.
##### Examples
```
use std::path::{Path, PathBuf};
let path = Path::new("/tmp/foo.txt");
assert_eq!(path.with_file_name("bar.txt"), PathBuf::from("/tmp/bar.txt"));
let path = Path::new("/tmp");
assert_eq!(path.with_file_name("var"), PathBuf::from("/var"));
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#2497-2499)#### pub fn with\_extension<S: AsRef<OsStr>>(&self, extension: S) -> PathBuf
Creates an owned [`PathBuf`](struct.pathbuf "PathBuf") like `self` but with the given extension.
See [`PathBuf::set_extension`](struct.pathbuf#method.set_extension "PathBuf::set_extension") for more details.
##### Examples
```
use std::path::{Path, PathBuf};
let path = Path::new("foo.rs");
assert_eq!(path.with_extension("txt"), PathBuf::from("foo.txt"));
let path = Path::new("foo.tar.gz");
assert_eq!(path.with_extension(""), PathBuf::from("foo.tar"));
assert_eq!(path.with_extension("xz"), PathBuf::from("foo.tar.xz"));
assert_eq!(path.with_extension("").with_extension("txt"), PathBuf::from("foo.txt"));
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#2541-2551)#### pub fn components(&self) -> Components<'\_>
Notable traits for [Components](struct.components "struct std::path::Components")<'a>
```
impl<'a> Iterator for Components<'a>
type Item = Component<'a>;
```
Produces an iterator over the [`Component`](enum.component "Component")s of the path.
When parsing the path, there is a small amount of normalization:
* Repeated separators are ignored, so `a/b` and `a//b` both have `a` and `b` as components.
* Occurrences of `.` are normalized away, except if they are at the beginning of the path. For example, `a/./b`, `a/b/`, `a/b/.` and `a/b` all have `a` and `b` as components, but `./a/b` starts with an additional [`CurDir`](enum.component#variant.CurDir) component.
* A trailing slash is normalized away, `/a/b` and `/a/b/` are equivalent.
Note that no other normalization takes place; in particular, `a/c` and `a/b/../c` are distinct, to account for the possibility that `b` is a symbolic link (so its parent isn’t `a`).
##### Examples
```
use std::path::{Path, Component};
use std::ffi::OsStr;
let mut components = Path::new("/tmp/foo.txt").components();
assert_eq!(components.next(), Some(Component::RootDir));
assert_eq!(components.next(), Some(Component::Normal(OsStr::new("tmp"))));
assert_eq!(components.next(), Some(Component::Normal(OsStr::new("foo.txt"))));
assert_eq!(components.next(), None)
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#2575-2577)#### pub fn iter(&self) -> Iter<'\_>
Notable traits for [Iter](struct.iter "struct std::path::Iter")<'a>
```
impl<'a> Iterator for Iter<'a>
type Item = &'a OsStr;
```
Produces an iterator over the path’s components viewed as [`OsStr`](../ffi/struct.osstr "OsStr") slices.
For more information about the particulars of how the path is separated into components, see [`components`](struct.path#method.components).
##### Examples
```
use std::path::{self, Path};
use std::ffi::OsStr;
let mut it = Path::new("/tmp/foo.txt").iter();
assert_eq!(it.next(), Some(OsStr::new(&path::MAIN_SEPARATOR.to_string())));
assert_eq!(it.next(), Some(OsStr::new("tmp")));
assert_eq!(it.next(), Some(OsStr::new("foo.txt")));
assert_eq!(it.next(), None)
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#2599-2601)#### pub fn display(&self) -> Display<'\_>
Returns an object that implements [`Display`](../fmt/trait.display) for safely printing paths that may contain non-Unicode data. This may perform lossy conversion, depending on the platform. If you would like an implementation which escapes the path please use [`Debug`](../fmt/macro.debug "Debug") instead.
##### Examples
```
use std::path::Path;
let path = Path::new("/tmp/foo.rs");
println!("{}", path.display());
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#2621-2623)1.5.0 · #### pub fn metadata(&self) -> Result<Metadata>
Queries the file system to get information about a file, directory, etc.
This function will traverse symbolic links to query information about the destination file.
This is an alias to [`fs::metadata`](../fs/fn.metadata "fs::metadata").
##### Examples
```
use std::path::Path;
let path = Path::new("/Minas/tirith");
let metadata = path.metadata().expect("metadata call failed");
println!("{:?}", metadata.file_type());
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#2640-2642)1.5.0 · #### pub fn symlink\_metadata(&self) -> Result<Metadata>
Queries the metadata about a file without following symlinks.
This is an alias to [`fs::symlink_metadata`](../fs/fn.symlink_metadata "fs::symlink_metadata").
##### Examples
```
use std::path::Path;
let path = Path::new("/Minas/tirith");
let metadata = path.symlink_metadata().expect("symlink_metadata call failed");
println!("{:?}", metadata.file_type());
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#2659-2661)1.5.0 · #### pub fn canonicalize(&self) -> Result<PathBuf>
Returns the canonical, absolute form of the path with all intermediate components normalized and symbolic links resolved.
This is an alias to [`fs::canonicalize`](../fs/fn.canonicalize "fs::canonicalize").
##### Examples
```
use std::path::{Path, PathBuf};
let path = Path::new("/foo/test/../test/bar.rs");
assert_eq!(path.canonicalize().unwrap(), PathBuf::from("/foo/test/bar.rs"));
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#2677-2679)1.5.0 · #### pub fn read\_link(&self) -> Result<PathBuf>
Reads a symbolic link, returning the file that the link points to.
This is an alias to [`fs::read_link`](../fs/fn.read_link "fs::read_link").
##### Examples
```
use std::path::Path;
let path = Path::new("/laputa/sky_castle.rs");
let path_link = path.read_link().expect("read_link call failed");
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#2702-2704)1.5.0 · #### pub fn read\_dir(&self) -> Result<ReadDir>
Returns an iterator over the entries within a directory.
The iterator will yield instances of `[io::Result](../io/type.result "io::Result")<[fs::DirEntry](../fs/struct.direntry "fs::DirEntry")>`. New errors may be encountered after an iterator is initially constructed.
This is an alias to [`fs::read_dir`](../fs/fn.read_dir "fs::read_dir").
##### Examples
```
use std::path::Path;
let path = Path::new("/laputa");
for entry in path.read_dir().expect("read_dir call failed") {
if let Ok(entry) = entry {
println!("{:?}", entry.path());
}
}
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#2733-2735)1.5.0 · #### pub fn exists(&self) -> bool
Returns `true` if the path points at an existing entity.
Warning: this method may be error-prone, consider using [`try_exists()`](struct.path#method.try_exists) instead! It also has a risk of introducing time-of-check to time-of-use (TOCTOU) bugs.
This function will traverse symbolic links to query information about the destination file.
If you cannot access the metadata of the file, e.g. because of a permission error or broken symbolic links, this will return `false`.
##### Examples
```
use std::path::Path;
assert!(!Path::new("does_not_exist.txt").exists());
```
##### See Also
This is a convenience function that coerces errors to false. If you want to check errors, call [`Path::try_exists`](struct.path#method.try_exists "Path::try_exists").
[source](https://doc.rust-lang.org/src/std/path.rs.html#2761-2763)1.63.0 · #### pub fn try\_exists(&self) -> Result<bool>
Returns `Ok(true)` if the path points at an existing entity.
This function will traverse symbolic links to query information about the destination file. In case of broken symbolic links this will return `Ok(false)`.
As opposed to the [`exists()`](struct.path#method.exists) method, this one doesn’t silently ignore errors unrelated to the path not existing. (E.g. it will return `Err(_)` in case of permission denied on some of the parent directories.)
Note that while this avoids some pitfalls of the `exists()` method, it still can not prevent time-of-check to time-of-use (TOCTOU) bugs. You should only use it in scenarios where those bugs are not an issue.
##### Examples
```
use std::path::Path;
assert!(!Path::new("does_not_exist.txt").try_exists().expect("Can't check existence of file does_not_exist.txt"));
assert!(Path::new("/root/secret_file.txt").try_exists().is_err());
```
[source](https://doc.rust-lang.org/src/std/path.rs.html#2794-2796)1.5.0 · #### pub fn is\_file(&self) -> bool
Returns `true` if the path exists on disk and is pointing at a regular file.
This function will traverse symbolic links to query information about the destination file.
If you cannot access the metadata of the file, e.g. because of a permission error or broken symbolic links, this will return `false`.
##### Examples
```
use std::path::Path;
assert_eq!(Path::new("./is_a_directory/").is_file(), false);
assert_eq!(Path::new("a_file.txt").is_file(), true);
```
##### See Also
This is a convenience function that coerces errors to false. If you want to check errors, call [`fs::metadata`](../fs/fn.metadata "fs::metadata") and handle its [`Result`](../result/enum.result "Result"). Then call [`fs::Metadata::is_file`](../fs/struct.metadata#method.is_file "fs::Metadata::is_file") if it was [`Ok`](../result/enum.result#variant.Ok "Ok").
When the goal is simply to read from (or write to) the source, the most reliable way to test the source can be read (or written to) is to open it. Only using `is_file` can break workflows like `diff <( prog_a )` on a Unix-like system for example. See [`fs::File::open`](../fs/struct.file#method.open "fs::File::open") or [`fs::OpenOptions::open`](../fs/struct.openoptions#method.open "fs::OpenOptions::open") for more information.
[source](https://doc.rust-lang.org/src/std/path.rs.html#2821-2823)1.5.0 · #### pub fn is\_dir(&self) -> bool
Returns `true` if the path exists on disk and is pointing at a directory.
This function will traverse symbolic links to query information about the destination file.
If you cannot access the metadata of the file, e.g. because of a permission error or broken symbolic links, this will return `false`.
##### Examples
```
use std::path::Path;
assert_eq!(Path::new("./is_a_directory/").is_dir(), true);
assert_eq!(Path::new("a_file.txt").is_dir(), false);
```
##### See Also
This is a convenience function that coerces errors to false. If you want to check errors, call [`fs::metadata`](../fs/fn.metadata "fs::metadata") and handle its [`Result`](../result/enum.result "Result"). Then call [`fs::Metadata::is_dir`](../fs/struct.metadata#method.is_dir "fs::Metadata::is_dir") if it was [`Ok`](../result/enum.result#variant.Ok "Ok").
[source](https://doc.rust-lang.org/src/std/path.rs.html#2853-2855)1.58.0 · #### pub fn is\_symlink(&self) -> bool
Returns `true` if the path exists on disk and is pointing at a symbolic link.
This function will not traverse symbolic links. In case of a broken symbolic link this will also return true.
If you cannot access the directory containing the file, e.g., because of a permission error, this will return false.
##### Examples
```
use std::path::Path;
use std::os::unix::fs::symlink;
let link_path = Path::new("link");
symlink("/origin_does_not_exist/", link_path).unwrap();
assert_eq!(link_path.is_symlink(), true);
assert_eq!(link_path.exists(), false);
```
##### See Also
This is a convenience function that coerces errors to false. If you want to check errors, call [`fs::symlink_metadata`](../fs/fn.symlink_metadata "fs::symlink_metadata") and handle its [`Result`](../result/enum.result "Result"). Then call [`fs::Metadata::is_symlink`](../fs/struct.metadata#method.is_symlink "fs::Metadata::is_symlink") if it was [`Ok`](../result/enum.result#variant.Ok "Ok").
[source](https://doc.rust-lang.org/src/std/path.rs.html#2861-2865)1.20.0 · #### pub fn into\_path\_buf(self: Box<Path>) -> PathBuf
Converts a [`Box<Path>`](../boxed/struct.box) into a [`PathBuf`](struct.pathbuf "PathBuf") without copying or allocating.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/std/path.rs.html#2869-2874)### impl AsRef<OsStr> for Path
[source](https://doc.rust-lang.org/src/std/path.rs.html#2871-2873)#### fn as\_ref(&self) -> &OsStr
Converts this type into a shared reference of the (usually inferred) input type.
[source](https://doc.rust-lang.org/src/std/path.rs.html#573-578)1.25.0 · ### impl AsRef<Path> for Component<'\_>
[source](https://doc.rust-lang.org/src/std/path.rs.html#575-577)#### fn as\_ref(&self) -> &Path
Converts this type into a shared reference of the (usually inferred) input type.
[source](https://doc.rust-lang.org/src/std/path.rs.html#798-803)### impl AsRef<Path> for Components<'\_>
[source](https://doc.rust-lang.org/src/std/path.rs.html#800-802)#### fn as\_ref(&self) -> &Path
Converts this type into a shared reference of the (usually inferred) input type.
[source](https://doc.rust-lang.org/src/std/path.rs.html#3017-3022)1.8.0 · ### impl AsRef<Path> for Cow<'\_, OsStr>
[source](https://doc.rust-lang.org/src/std/path.rs.html#3019-3021)#### fn as\_ref(&self) -> &Path
Converts this type into a shared reference of the (usually inferred) input type.
[source](https://doc.rust-lang.org/src/std/path.rs.html#851-856)### impl AsRef<Path> for Iter<'\_>
[source](https://doc.rust-lang.org/src/std/path.rs.html#853-855)#### fn as\_ref(&self) -> &Path
Converts this type into a shared reference of the (usually inferred) input type.
[source](https://doc.rust-lang.org/src/std/path.rs.html#3009-3014)### impl AsRef<Path> for OsStr
[source](https://doc.rust-lang.org/src/std/path.rs.html#3011-3013)#### fn as\_ref(&self) -> &Path
Converts this type into a shared reference of the (usually inferred) input type.
[source](https://doc.rust-lang.org/src/std/path.rs.html#3025-3030)### impl AsRef<Path> for OsString
[source](https://doc.rust-lang.org/src/std/path.rs.html#3027-3029)#### fn as\_ref(&self) -> &Path
Converts this type into a shared reference of the (usually inferred) input type.
[source](https://doc.rust-lang.org/src/std/path.rs.html#3001-3006)### impl AsRef<Path> for Path
[source](https://doc.rust-lang.org/src/std/path.rs.html#3003-3005)#### fn as\_ref(&self) -> &Path
Converts this type into a shared reference of the (usually inferred) input type.
[source](https://doc.rust-lang.org/src/std/path.rs.html#3049-3054)### impl AsRef<Path> for PathBuf
[source](https://doc.rust-lang.org/src/std/path.rs.html#3051-3053)#### fn as\_ref(&self) -> &Path
Converts this type into a shared reference of the (usually inferred) input type.
[source](https://doc.rust-lang.org/src/std/path.rs.html#3041-3046)### impl AsRef<Path> for String
[source](https://doc.rust-lang.org/src/std/path.rs.html#3043-3045)#### fn as\_ref(&self) -> &Path
Converts this type into a shared reference of the (usually inferred) input type.
[source](https://doc.rust-lang.org/src/std/path.rs.html#3033-3038)### impl AsRef<Path> for str
[source](https://doc.rust-lang.org/src/std/path.rs.html#3035-3037)#### fn as\_ref(&self) -> &Path
Converts this type into a shared reference of the (usually inferred) input type.
[source](https://doc.rust-lang.org/src/std/path.rs.html#1728-1733)### impl Borrow<Path> for PathBuf
[source](https://doc.rust-lang.org/src/std/path.rs.html#1730-1732)#### fn borrow(&self) -> &Path
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/std/path.rs.html#1629-1634)1.29.0 · ### impl Clone for Box<Path>
[source](https://doc.rust-lang.org/src/std/path.rs.html#1631-1633)#### fn clone(&self) -> Self
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)#### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/std/path.rs.html#2877-2881)### impl Debug for Path
[source](https://doc.rust-lang.org/src/std/path.rs.html#2878-2880)#### fn fmt(&self, formatter: &mut Formatter<'\_>) -> Result
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/std/path.rs.html#1744-1753)1.6.0 · ### impl<'a> From<&'a Path> for Cow<'a, Path>
[source](https://doc.rust-lang.org/src/std/path.rs.html#1750-1752)#### fn from(s: &'a Path) -> Cow<'a, Path>
Creates a clone-on-write pointer from a reference to [`Path`](struct.path "Path").
This conversion does not clone or allocate.
[source](https://doc.rust-lang.org/src/std/path.rs.html#1802-1809)1.24.0 · ### impl From<&Path> for Arc<Path>
[source](https://doc.rust-lang.org/src/std/path.rs.html#1805-1808)#### fn from(s: &Path) -> Arc<Path>
Converts a [`Path`](struct.path "Path") into an [`Arc`](../sync/struct.arc "Arc") by copying the [`Path`](struct.path "Path") data into a new [`Arc`](../sync/struct.arc "Arc") buffer.
[source](https://doc.rust-lang.org/src/std/path.rs.html#1580-1589)1.17.0 · ### impl From<&Path> for Box<Path>
[source](https://doc.rust-lang.org/src/std/path.rs.html#1584-1588)#### fn from(path: &Path) -> Box<Path>
Notable traits for [Box](../boxed/struct.box "struct std::boxed::Box")<I, A>
```
impl<I, A> Iterator for Box<I, A>where
I: Iterator + ?Sized,
A: Allocator,
type Item = <I as Iterator>::Item;
impl<F, A> Future for Box<F, A>where
F: Future + Unpin + ?Sized,
A: Allocator + 'static,
type Output = <F as Future>::Output;
impl<R: Read + ?Sized> Read for Box<R>
impl<W: Write + ?Sized> Write for Box<W>
```
Creates a boxed [`Path`](struct.path "Path") from a reference.
This will allocate and clone `path` to it.
[source](https://doc.rust-lang.org/src/std/path.rs.html#1823-1830)1.24.0 · ### impl From<&Path> for Rc<Path>
[source](https://doc.rust-lang.org/src/std/path.rs.html#1826-1829)#### fn from(s: &Path) -> Rc<Path>
Converts a [`Path`](struct.path "Path") into an [`Rc`](../rc/struct.rc "Rc") by copying the [`Path`](struct.path "Path") data into a new [`Rc`](../rc/struct.rc "Rc") buffer.
[source](https://doc.rust-lang.org/src/std/path.rs.html#1592-1603)1.45.0 · ### impl From<Cow<'\_, Path>> for Box<Path>
[source](https://doc.rust-lang.org/src/std/path.rs.html#1597-1602)#### fn from(cow: Cow<'\_, Path>) -> Box<Path>
Notable traits for [Box](../boxed/struct.box "struct std::boxed::Box")<I, A>
```
impl<I, A> Iterator for Box<I, A>where
I: Iterator + ?Sized,
A: Allocator,
type Item = <I as Iterator>::Item;
impl<F, A> Future for Box<F, A>where
F: Future + Unpin + ?Sized,
A: Allocator + 'static,
type Output = <F as Future>::Output;
impl<R: Read + ?Sized> Read for Box<R>
impl<W: Write + ?Sized> Write for Box<W>
```
Creates a boxed [`Path`](struct.path "Path") from a clone-on-write pointer.
Converting from a `Cow::Owned` does not clone or allocate.
[source](https://doc.rust-lang.org/src/std/path.rs.html#1617-1626)1.20.0 · ### impl From<PathBuf> for Box<Path>
[source](https://doc.rust-lang.org/src/std/path.rs.html#1623-1625)#### fn from(p: PathBuf) -> Box<Path>
Notable traits for [Box](../boxed/struct.box "struct std::boxed::Box")<I, A>
```
impl<I, A> Iterator for Box<I, A>where
I: Iterator + ?Sized,
A: Allocator,
type Item = <I as Iterator>::Item;
impl<F, A> Future for Box<F, A>where
F: Future + Unpin + ?Sized,
A: Allocator + 'static,
type Output = <F as Future>::Output;
impl<R: Read + ?Sized> Read for Box<R>
impl<W: Write + ?Sized> Write for Box<W>
```
Converts a [`PathBuf`](struct.pathbuf "PathBuf") into a `[Box](../boxed/struct.box "Box")<[Path](struct.path "Path")>`.
This conversion currently should not allocate memory, but this behavior is not guaranteed on all platforms or in all future versions.
[source](https://doc.rust-lang.org/src/std/path.rs.html#2931-2979)### impl Hash for Path
[source](https://doc.rust-lang.org/src/std/path.rs.html#2932-2978)#### fn hash<H: Hasher>(&self, h: &mut H)
Feeds this value into the given [`Hasher`](../hash/trait.hasher "Hasher"). [Read more](../hash/trait.hash#tymethod.hash)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3067-3074)1.6.0 · ### impl<'a> IntoIterator for &'a Path
#### type Item = &'a OsStr
The type of the elements being iterated over.
#### type IntoIter = Iter<'a>
Which kind of iterator are we turning this into?
[source](https://doc.rust-lang.org/src/std/path.rs.html#3071-3073)#### fn into\_iter(self) -> Iter<'a>
Notable traits for [Iter](struct.iter "struct std::path::Iter")<'a>
```
impl<'a> Iterator for Iter<'a>
type Item = &'a OsStr;
```
Creates an iterator from a value. [Read more](../iter/trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/std/path.rs.html#2993-2998)### impl Ord for Path
[source](https://doc.rust-lang.org/src/std/path.rs.html#2995-2997)#### fn cmp(&self, other: &Path) -> Ordering
This method returns an [`Ordering`](../cmp/enum.ordering "Ordering") between `self` and `other`. [Read more](../cmp/trait.ord#tymethod.cmp)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3159)1.8.0 · ### impl<'a, 'b> PartialEq<&'a OsStr> for Path
[source](https://doc.rust-lang.org/src/std/path.rs.html#3159)#### fn eq(&self, other: &&'a OsStr) -> bool
This method tests for `self` and `other` values to be equal, and is used by `==`. [Read more](../cmp/trait.partialeq#tymethod.eq)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#236)#### fn ne(&self, other: &Rhs) -> bool
This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. [Read more](../cmp/trait.partialeq#method.ne)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3163)1.8.0 · ### impl<'a, 'b> PartialEq<&'a Path> for Cow<'b, OsStr>
[source](https://doc.rust-lang.org/src/std/path.rs.html#3163)#### fn eq(&self, other: &&'a Path) -> bool
This method tests for `self` and `other` values to be equal, and is used by `==`. [Read more](../cmp/trait.partialeq#tymethod.eq)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#236)#### fn ne(&self, other: &Rhs) -> bool
This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. [Read more](../cmp/trait.partialeq#method.ne)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3162)1.8.0 · ### impl<'a, 'b> PartialEq<&'a Path> for OsStr
[source](https://doc.rust-lang.org/src/std/path.rs.html#3162)#### fn eq(&self, other: &&'a Path) -> bool
This method tests for `self` and `other` values to be equal, and is used by `==`. [Read more](../cmp/trait.partialeq#tymethod.eq)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#236)#### fn ne(&self, other: &Rhs) -> bool
This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. [Read more](../cmp/trait.partialeq#method.ne)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3164)1.8.0 · ### impl<'a, 'b> PartialEq<&'a Path> for OsString
[source](https://doc.rust-lang.org/src/std/path.rs.html#3164)#### fn eq(&self, other: &&'a Path) -> bool
This method tests for `self` and `other` values to be equal, and is used by `==`. [Read more](../cmp/trait.partialeq#tymethod.eq)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#236)#### fn ne(&self, other: &Rhs) -> bool
This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. [Read more](../cmp/trait.partialeq#method.ne)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3113)1.6.0 · ### impl<'a, 'b> PartialEq<&'a Path> for PathBuf
[source](https://doc.rust-lang.org/src/std/path.rs.html#3113)#### fn eq(&self, other: &&'a Path) -> bool
This method tests for `self` and `other` values to be equal, and is used by `==`. [Read more](../cmp/trait.partialeq#tymethod.eq)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#236)#### fn ne(&self, other: &Rhs) -> bool
This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. [Read more](../cmp/trait.partialeq#method.ne)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3115)1.6.0 · ### impl<'a, 'b> PartialEq<&'b Path> for Cow<'a, Path>
[source](https://doc.rust-lang.org/src/std/path.rs.html#3115)#### fn eq(&self, other: &&'b Path) -> bool
This method tests for `self` and `other` values to be equal, and is used by `==`. [Read more](../cmp/trait.partialeq#tymethod.eq)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#236)#### fn ne(&self, other: &Rhs) -> bool
This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. [Read more](../cmp/trait.partialeq#method.ne)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3160)1.8.0 · ### impl<'a, 'b> PartialEq<Cow<'a, OsStr>> for Path
[source](https://doc.rust-lang.org/src/std/path.rs.html#3160)#### fn eq(&self, other: &Cow<'a, OsStr>) -> bool
This method tests for `self` and `other` values to be equal, and is used by `==`. [Read more](../cmp/trait.partialeq#tymethod.eq)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#236)#### fn ne(&self, other: &Rhs) -> bool
This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. [Read more](../cmp/trait.partialeq#method.ne)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3115)1.6.0 · ### impl<'a, 'b> PartialEq<Cow<'a, Path>> for &'b Path
[source](https://doc.rust-lang.org/src/std/path.rs.html#3115)#### fn eq(&self, other: &Cow<'a, Path>) -> bool
This method tests for `self` and `other` values to be equal, and is used by `==`. [Read more](../cmp/trait.partialeq#tymethod.eq)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#236)#### fn ne(&self, other: &Rhs) -> bool
This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. [Read more](../cmp/trait.partialeq#method.ne)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3114)1.6.0 · ### impl<'a, 'b> PartialEq<Cow<'a, Path>> for Path
[source](https://doc.rust-lang.org/src/std/path.rs.html#3114)#### fn eq(&self, other: &Cow<'a, Path>) -> bool
This method tests for `self` and `other` values to be equal, and is used by `==`. [Read more](../cmp/trait.partialeq#tymethod.eq)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#236)#### fn ne(&self, other: &Rhs) -> bool
This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. [Read more](../cmp/trait.partialeq#method.ne)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3163)1.8.0 · ### impl<'a, 'b> PartialEq<Cow<'b, OsStr>> for &'a Path
[source](https://doc.rust-lang.org/src/std/path.rs.html#3163)#### fn eq(&self, other: &Cow<'b, OsStr>) -> bool
This method tests for `self` and `other` values to be equal, and is used by `==`. [Read more](../cmp/trait.partialeq#tymethod.eq)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#236)#### fn ne(&self, other: &Rhs) -> bool
This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. [Read more](../cmp/trait.partialeq#method.ne)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3162)1.8.0 · ### impl<'a, 'b> PartialEq<OsStr> for &'a Path
[source](https://doc.rust-lang.org/src/std/path.rs.html#3162)#### fn eq(&self, other: &OsStr) -> bool
This method tests for `self` and `other` values to be equal, and is used by `==`. [Read more](../cmp/trait.partialeq#tymethod.eq)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#236)#### fn ne(&self, other: &Rhs) -> bool
This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. [Read more](../cmp/trait.partialeq#method.ne)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3158)1.8.0 · ### impl<'a, 'b> PartialEq<OsStr> for Path
[source](https://doc.rust-lang.org/src/std/path.rs.html#3158)#### fn eq(&self, other: &OsStr) -> bool
This method tests for `self` and `other` values to be equal, and is used by `==`. [Read more](../cmp/trait.partialeq#tymethod.eq)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#236)#### fn ne(&self, other: &Rhs) -> bool
This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. [Read more](../cmp/trait.partialeq#method.ne)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3164)1.8.0 · ### impl<'a, 'b> PartialEq<OsString> for &'a Path
[source](https://doc.rust-lang.org/src/std/path.rs.html#3164)#### fn eq(&self, other: &OsString) -> bool
This method tests for `self` and `other` values to be equal, and is used by `==`. [Read more](../cmp/trait.partialeq#tymethod.eq)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#236)#### fn ne(&self, other: &Rhs) -> bool
This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. [Read more](../cmp/trait.partialeq#method.ne)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3161)1.8.0 · ### impl<'a, 'b> PartialEq<OsString> for Path
[source](https://doc.rust-lang.org/src/std/path.rs.html#3161)#### fn eq(&self, other: &OsString) -> bool
This method tests for `self` and `other` values to be equal, and is used by `==`. [Read more](../cmp/trait.partialeq#tymethod.eq)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#236)#### fn ne(&self, other: &Rhs) -> bool
This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. [Read more](../cmp/trait.partialeq#method.ne)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3159)1.8.0 · ### impl<'a, 'b> PartialEq<Path> for &'a OsStr
[source](https://doc.rust-lang.org/src/std/path.rs.html#3159)#### fn eq(&self, other: &Path) -> bool
This method tests for `self` and `other` values to be equal, and is used by `==`. [Read more](../cmp/trait.partialeq#tymethod.eq)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#236)#### fn ne(&self, other: &Rhs) -> bool
This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. [Read more](../cmp/trait.partialeq#method.ne)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3160)1.8.0 · ### impl<'a, 'b> PartialEq<Path> for Cow<'a, OsStr>
[source](https://doc.rust-lang.org/src/std/path.rs.html#3160)#### fn eq(&self, other: &Path) -> bool
This method tests for `self` and `other` values to be equal, and is used by `==`. [Read more](../cmp/trait.partialeq#tymethod.eq)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#236)#### fn ne(&self, other: &Rhs) -> bool
This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. [Read more](../cmp/trait.partialeq#method.ne)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3114)1.6.0 · ### impl<'a, 'b> PartialEq<Path> for Cow<'a, Path>
[source](https://doc.rust-lang.org/src/std/path.rs.html#3114)#### fn eq(&self, other: &Path) -> bool
This method tests for `self` and `other` values to be equal, and is used by `==`. [Read more](../cmp/trait.partialeq#tymethod.eq)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#236)#### fn ne(&self, other: &Rhs) -> bool
This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. [Read more](../cmp/trait.partialeq#method.ne)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3158)1.8.0 · ### impl<'a, 'b> PartialEq<Path> for OsStr
[source](https://doc.rust-lang.org/src/std/path.rs.html#3158)#### fn eq(&self, other: &Path) -> bool
This method tests for `self` and `other` values to be equal, and is used by `==`. [Read more](../cmp/trait.partialeq#tymethod.eq)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#236)#### fn ne(&self, other: &Rhs) -> bool
This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. [Read more](../cmp/trait.partialeq#method.ne)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3161)1.8.0 · ### impl<'a, 'b> PartialEq<Path> for OsString
[source](https://doc.rust-lang.org/src/std/path.rs.html#3161)#### fn eq(&self, other: &Path) -> bool
This method tests for `self` and `other` values to be equal, and is used by `==`. [Read more](../cmp/trait.partialeq#tymethod.eq)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#236)#### fn ne(&self, other: &Rhs) -> bool
This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. [Read more](../cmp/trait.partialeq#method.ne)
[source](https://doc.rust-lang.org/src/std/path.rs.html#2923-2928)### impl PartialEq<Path> for Path
[source](https://doc.rust-lang.org/src/std/path.rs.html#2925-2927)#### fn eq(&self, other: &Path) -> bool
This method tests for `self` and `other` values to be equal, and is used by `==`. [Read more](../cmp/trait.partialeq#tymethod.eq)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#236)#### fn ne(&self, other: &Rhs) -> bool
This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. [Read more](../cmp/trait.partialeq#method.ne)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3112)1.6.0 · ### impl<'a, 'b> PartialEq<Path> for PathBuf
[source](https://doc.rust-lang.org/src/std/path.rs.html#3112)#### fn eq(&self, other: &Path) -> bool
This method tests for `self` and `other` values to be equal, and is used by `==`. [Read more](../cmp/trait.partialeq#tymethod.eq)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#236)#### fn ne(&self, other: &Rhs) -> bool
This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. [Read more](../cmp/trait.partialeq#method.ne)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3113)1.6.0 · ### impl<'a, 'b> PartialEq<PathBuf> for &'a Path
[source](https://doc.rust-lang.org/src/std/path.rs.html#3113)#### fn eq(&self, other: &PathBuf) -> bool
This method tests for `self` and `other` values to be equal, and is used by `==`. [Read more](../cmp/trait.partialeq#tymethod.eq)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#236)#### fn ne(&self, other: &Rhs) -> bool
This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. [Read more](../cmp/trait.partialeq#method.ne)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3112)1.6.0 · ### impl<'a, 'b> PartialEq<PathBuf> for Path
[source](https://doc.rust-lang.org/src/std/path.rs.html#3112)#### fn eq(&self, other: &PathBuf) -> bool
This method tests for `self` and `other` values to be equal, and is used by `==`. [Read more](../cmp/trait.partialeq#tymethod.eq)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#236)#### fn ne(&self, other: &Rhs) -> bool
This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. [Read more](../cmp/trait.partialeq#method.ne)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3159)1.8.0 · ### impl<'a, 'b> PartialOrd<&'a OsStr> for Path
[source](https://doc.rust-lang.org/src/std/path.rs.html#3159)#### fn partial\_cmp(&self, other: &&'a OsStr) -> Option<Ordering>
This method returns an ordering between `self` and `other` values if one exists. [Read more](../cmp/trait.partialord#tymethod.partial_cmp)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1138)#### fn lt(&self, other: &Rhs) -> bool
This method tests less than (for `self` and `other`) and is used by the `<` operator. [Read more](../cmp/trait.partialord#method.lt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1157)#### fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for `self` and `other`) and is used by the `<=` operator. [Read more](../cmp/trait.partialord#method.le)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1175)#### fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for `self` and `other`) and is used by the `>` operator. [Read more](../cmp/trait.partialord#method.gt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1194)#### fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for `self` and `other`) and is used by the `>=` operator. [Read more](../cmp/trait.partialord#method.ge)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3163)1.8.0 · ### impl<'a, 'b> PartialOrd<&'a Path> for Cow<'b, OsStr>
[source](https://doc.rust-lang.org/src/std/path.rs.html#3163)#### fn partial\_cmp(&self, other: &&'a Path) -> Option<Ordering>
This method returns an ordering between `self` and `other` values if one exists. [Read more](../cmp/trait.partialord#tymethod.partial_cmp)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1138)#### fn lt(&self, other: &Rhs) -> bool
This method tests less than (for `self` and `other`) and is used by the `<` operator. [Read more](../cmp/trait.partialord#method.lt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1157)#### fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for `self` and `other`) and is used by the `<=` operator. [Read more](../cmp/trait.partialord#method.le)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1175)#### fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for `self` and `other`) and is used by the `>` operator. [Read more](../cmp/trait.partialord#method.gt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1194)#### fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for `self` and `other`) and is used by the `>=` operator. [Read more](../cmp/trait.partialord#method.ge)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3162)1.8.0 · ### impl<'a, 'b> PartialOrd<&'a Path> for OsStr
[source](https://doc.rust-lang.org/src/std/path.rs.html#3162)#### fn partial\_cmp(&self, other: &&'a Path) -> Option<Ordering>
This method returns an ordering between `self` and `other` values if one exists. [Read more](../cmp/trait.partialord#tymethod.partial_cmp)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1138)#### fn lt(&self, other: &Rhs) -> bool
This method tests less than (for `self` and `other`) and is used by the `<` operator. [Read more](../cmp/trait.partialord#method.lt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1157)#### fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for `self` and `other`) and is used by the `<=` operator. [Read more](../cmp/trait.partialord#method.le)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1175)#### fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for `self` and `other`) and is used by the `>` operator. [Read more](../cmp/trait.partialord#method.gt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1194)#### fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for `self` and `other`) and is used by the `>=` operator. [Read more](../cmp/trait.partialord#method.ge)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3164)1.8.0 · ### impl<'a, 'b> PartialOrd<&'a Path> for OsString
[source](https://doc.rust-lang.org/src/std/path.rs.html#3164)#### fn partial\_cmp(&self, other: &&'a Path) -> Option<Ordering>
This method returns an ordering between `self` and `other` values if one exists. [Read more](../cmp/trait.partialord#tymethod.partial_cmp)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1138)#### fn lt(&self, other: &Rhs) -> bool
This method tests less than (for `self` and `other`) and is used by the `<` operator. [Read more](../cmp/trait.partialord#method.lt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1157)#### fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for `self` and `other`) and is used by the `<=` operator. [Read more](../cmp/trait.partialord#method.le)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1175)#### fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for `self` and `other`) and is used by the `>` operator. [Read more](../cmp/trait.partialord#method.gt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1194)#### fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for `self` and `other`) and is used by the `>=` operator. [Read more](../cmp/trait.partialord#method.ge)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3113)1.8.0 · ### impl<'a, 'b> PartialOrd<&'a Path> for PathBuf
[source](https://doc.rust-lang.org/src/std/path.rs.html#3113)#### fn partial\_cmp(&self, other: &&'a Path) -> Option<Ordering>
This method returns an ordering between `self` and `other` values if one exists. [Read more](../cmp/trait.partialord#tymethod.partial_cmp)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1138)#### fn lt(&self, other: &Rhs) -> bool
This method tests less than (for `self` and `other`) and is used by the `<` operator. [Read more](../cmp/trait.partialord#method.lt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1157)#### fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for `self` and `other`) and is used by the `<=` operator. [Read more](../cmp/trait.partialord#method.le)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1175)#### fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for `self` and `other`) and is used by the `>` operator. [Read more](../cmp/trait.partialord#method.gt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1194)#### fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for `self` and `other`) and is used by the `>=` operator. [Read more](../cmp/trait.partialord#method.ge)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3115)1.8.0 · ### impl<'a, 'b> PartialOrd<&'b Path> for Cow<'a, Path>
[source](https://doc.rust-lang.org/src/std/path.rs.html#3115)#### fn partial\_cmp(&self, other: &&'b Path) -> Option<Ordering>
This method returns an ordering between `self` and `other` values if one exists. [Read more](../cmp/trait.partialord#tymethod.partial_cmp)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1138)#### fn lt(&self, other: &Rhs) -> bool
This method tests less than (for `self` and `other`) and is used by the `<` operator. [Read more](../cmp/trait.partialord#method.lt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1157)#### fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for `self` and `other`) and is used by the `<=` operator. [Read more](../cmp/trait.partialord#method.le)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1175)#### fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for `self` and `other`) and is used by the `>` operator. [Read more](../cmp/trait.partialord#method.gt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1194)#### fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for `self` and `other`) and is used by the `>=` operator. [Read more](../cmp/trait.partialord#method.ge)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3160)1.8.0 · ### impl<'a, 'b> PartialOrd<Cow<'a, OsStr>> for Path
[source](https://doc.rust-lang.org/src/std/path.rs.html#3160)#### fn partial\_cmp(&self, other: &Cow<'a, OsStr>) -> Option<Ordering>
This method returns an ordering between `self` and `other` values if one exists. [Read more](../cmp/trait.partialord#tymethod.partial_cmp)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1138)#### fn lt(&self, other: &Rhs) -> bool
This method tests less than (for `self` and `other`) and is used by the `<` operator. [Read more](../cmp/trait.partialord#method.lt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1157)#### fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for `self` and `other`) and is used by the `<=` operator. [Read more](../cmp/trait.partialord#method.le)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1175)#### fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for `self` and `other`) and is used by the `>` operator. [Read more](../cmp/trait.partialord#method.gt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1194)#### fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for `self` and `other`) and is used by the `>=` operator. [Read more](../cmp/trait.partialord#method.ge)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3115)1.8.0 · ### impl<'a, 'b> PartialOrd<Cow<'a, Path>> for &'b Path
[source](https://doc.rust-lang.org/src/std/path.rs.html#3115)#### fn partial\_cmp(&self, other: &Cow<'a, Path>) -> Option<Ordering>
This method returns an ordering between `self` and `other` values if one exists. [Read more](../cmp/trait.partialord#tymethod.partial_cmp)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1138)#### fn lt(&self, other: &Rhs) -> bool
This method tests less than (for `self` and `other`) and is used by the `<` operator. [Read more](../cmp/trait.partialord#method.lt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1157)#### fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for `self` and `other`) and is used by the `<=` operator. [Read more](../cmp/trait.partialord#method.le)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1175)#### fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for `self` and `other`) and is used by the `>` operator. [Read more](../cmp/trait.partialord#method.gt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1194)#### fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for `self` and `other`) and is used by the `>=` operator. [Read more](../cmp/trait.partialord#method.ge)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3114)1.8.0 · ### impl<'a, 'b> PartialOrd<Cow<'a, Path>> for Path
[source](https://doc.rust-lang.org/src/std/path.rs.html#3114)#### fn partial\_cmp(&self, other: &Cow<'a, Path>) -> Option<Ordering>
This method returns an ordering between `self` and `other` values if one exists. [Read more](../cmp/trait.partialord#tymethod.partial_cmp)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1138)#### fn lt(&self, other: &Rhs) -> bool
This method tests less than (for `self` and `other`) and is used by the `<` operator. [Read more](../cmp/trait.partialord#method.lt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1157)#### fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for `self` and `other`) and is used by the `<=` operator. [Read more](../cmp/trait.partialord#method.le)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1175)#### fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for `self` and `other`) and is used by the `>` operator. [Read more](../cmp/trait.partialord#method.gt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1194)#### fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for `self` and `other`) and is used by the `>=` operator. [Read more](../cmp/trait.partialord#method.ge)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3163)1.8.0 · ### impl<'a, 'b> PartialOrd<Cow<'b, OsStr>> for &'a Path
[source](https://doc.rust-lang.org/src/std/path.rs.html#3163)#### fn partial\_cmp(&self, other: &Cow<'b, OsStr>) -> Option<Ordering>
This method returns an ordering between `self` and `other` values if one exists. [Read more](../cmp/trait.partialord#tymethod.partial_cmp)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1138)#### fn lt(&self, other: &Rhs) -> bool
This method tests less than (for `self` and `other`) and is used by the `<` operator. [Read more](../cmp/trait.partialord#method.lt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1157)#### fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for `self` and `other`) and is used by the `<=` operator. [Read more](../cmp/trait.partialord#method.le)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1175)#### fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for `self` and `other`) and is used by the `>` operator. [Read more](../cmp/trait.partialord#method.gt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1194)#### fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for `self` and `other`) and is used by the `>=` operator. [Read more](../cmp/trait.partialord#method.ge)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3162)1.8.0 · ### impl<'a, 'b> PartialOrd<OsStr> for &'a Path
[source](https://doc.rust-lang.org/src/std/path.rs.html#3162)#### fn partial\_cmp(&self, other: &OsStr) -> Option<Ordering>
This method returns an ordering between `self` and `other` values if one exists. [Read more](../cmp/trait.partialord#tymethod.partial_cmp)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1138)#### fn lt(&self, other: &Rhs) -> bool
This method tests less than (for `self` and `other`) and is used by the `<` operator. [Read more](../cmp/trait.partialord#method.lt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1157)#### fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for `self` and `other`) and is used by the `<=` operator. [Read more](../cmp/trait.partialord#method.le)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1175)#### fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for `self` and `other`) and is used by the `>` operator. [Read more](../cmp/trait.partialord#method.gt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1194)#### fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for `self` and `other`) and is used by the `>=` operator. [Read more](../cmp/trait.partialord#method.ge)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3158)1.8.0 · ### impl<'a, 'b> PartialOrd<OsStr> for Path
[source](https://doc.rust-lang.org/src/std/path.rs.html#3158)#### fn partial\_cmp(&self, other: &OsStr) -> Option<Ordering>
This method returns an ordering between `self` and `other` values if one exists. [Read more](../cmp/trait.partialord#tymethod.partial_cmp)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1138)#### fn lt(&self, other: &Rhs) -> bool
This method tests less than (for `self` and `other`) and is used by the `<` operator. [Read more](../cmp/trait.partialord#method.lt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1157)#### fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for `self` and `other`) and is used by the `<=` operator. [Read more](../cmp/trait.partialord#method.le)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1175)#### fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for `self` and `other`) and is used by the `>` operator. [Read more](../cmp/trait.partialord#method.gt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1194)#### fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for `self` and `other`) and is used by the `>=` operator. [Read more](../cmp/trait.partialord#method.ge)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3164)1.8.0 · ### impl<'a, 'b> PartialOrd<OsString> for &'a Path
[source](https://doc.rust-lang.org/src/std/path.rs.html#3164)#### fn partial\_cmp(&self, other: &OsString) -> Option<Ordering>
This method returns an ordering between `self` and `other` values if one exists. [Read more](../cmp/trait.partialord#tymethod.partial_cmp)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1138)#### fn lt(&self, other: &Rhs) -> bool
This method tests less than (for `self` and `other`) and is used by the `<` operator. [Read more](../cmp/trait.partialord#method.lt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1157)#### fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for `self` and `other`) and is used by the `<=` operator. [Read more](../cmp/trait.partialord#method.le)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1175)#### fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for `self` and `other`) and is used by the `>` operator. [Read more](../cmp/trait.partialord#method.gt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1194)#### fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for `self` and `other`) and is used by the `>=` operator. [Read more](../cmp/trait.partialord#method.ge)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3161)1.8.0 · ### impl<'a, 'b> PartialOrd<OsString> for Path
[source](https://doc.rust-lang.org/src/std/path.rs.html#3161)#### fn partial\_cmp(&self, other: &OsString) -> Option<Ordering>
This method returns an ordering between `self` and `other` values if one exists. [Read more](../cmp/trait.partialord#tymethod.partial_cmp)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1138)#### fn lt(&self, other: &Rhs) -> bool
This method tests less than (for `self` and `other`) and is used by the `<` operator. [Read more](../cmp/trait.partialord#method.lt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1157)#### fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for `self` and `other`) and is used by the `<=` operator. [Read more](../cmp/trait.partialord#method.le)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1175)#### fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for `self` and `other`) and is used by the `>` operator. [Read more](../cmp/trait.partialord#method.gt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1194)#### fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for `self` and `other`) and is used by the `>=` operator. [Read more](../cmp/trait.partialord#method.ge)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3159)1.8.0 · ### impl<'a, 'b> PartialOrd<Path> for &'a OsStr
[source](https://doc.rust-lang.org/src/std/path.rs.html#3159)#### fn partial\_cmp(&self, other: &Path) -> Option<Ordering>
This method returns an ordering between `self` and `other` values if one exists. [Read more](../cmp/trait.partialord#tymethod.partial_cmp)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1138)#### fn lt(&self, other: &Rhs) -> bool
This method tests less than (for `self` and `other`) and is used by the `<` operator. [Read more](../cmp/trait.partialord#method.lt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1157)#### fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for `self` and `other`) and is used by the `<=` operator. [Read more](../cmp/trait.partialord#method.le)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1175)#### fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for `self` and `other`) and is used by the `>` operator. [Read more](../cmp/trait.partialord#method.gt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1194)#### fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for `self` and `other`) and is used by the `>=` operator. [Read more](../cmp/trait.partialord#method.ge)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3160)1.8.0 · ### impl<'a, 'b> PartialOrd<Path> for Cow<'a, OsStr>
[source](https://doc.rust-lang.org/src/std/path.rs.html#3160)#### fn partial\_cmp(&self, other: &Path) -> Option<Ordering>
This method returns an ordering between `self` and `other` values if one exists. [Read more](../cmp/trait.partialord#tymethod.partial_cmp)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1138)#### fn lt(&self, other: &Rhs) -> bool
This method tests less than (for `self` and `other`) and is used by the `<` operator. [Read more](../cmp/trait.partialord#method.lt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1157)#### fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for `self` and `other`) and is used by the `<=` operator. [Read more](../cmp/trait.partialord#method.le)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1175)#### fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for `self` and `other`) and is used by the `>` operator. [Read more](../cmp/trait.partialord#method.gt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1194)#### fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for `self` and `other`) and is used by the `>=` operator. [Read more](../cmp/trait.partialord#method.ge)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3114)1.8.0 · ### impl<'a, 'b> PartialOrd<Path> for Cow<'a, Path>
[source](https://doc.rust-lang.org/src/std/path.rs.html#3114)#### fn partial\_cmp(&self, other: &Path) -> Option<Ordering>
This method returns an ordering between `self` and `other` values if one exists. [Read more](../cmp/trait.partialord#tymethod.partial_cmp)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1138)#### fn lt(&self, other: &Rhs) -> bool
This method tests less than (for `self` and `other`) and is used by the `<` operator. [Read more](../cmp/trait.partialord#method.lt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1157)#### fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for `self` and `other`) and is used by the `<=` operator. [Read more](../cmp/trait.partialord#method.le)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1175)#### fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for `self` and `other`) and is used by the `>` operator. [Read more](../cmp/trait.partialord#method.gt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1194)#### fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for `self` and `other`) and is used by the `>=` operator. [Read more](../cmp/trait.partialord#method.ge)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3158)1.8.0 · ### impl<'a, 'b> PartialOrd<Path> for OsStr
[source](https://doc.rust-lang.org/src/std/path.rs.html#3158)#### fn partial\_cmp(&self, other: &Path) -> Option<Ordering>
This method returns an ordering between `self` and `other` values if one exists. [Read more](../cmp/trait.partialord#tymethod.partial_cmp)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1138)#### fn lt(&self, other: &Rhs) -> bool
This method tests less than (for `self` and `other`) and is used by the `<` operator. [Read more](../cmp/trait.partialord#method.lt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1157)#### fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for `self` and `other`) and is used by the `<=` operator. [Read more](../cmp/trait.partialord#method.le)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1175)#### fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for `self` and `other`) and is used by the `>` operator. [Read more](../cmp/trait.partialord#method.gt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1194)#### fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for `self` and `other`) and is used by the `>=` operator. [Read more](../cmp/trait.partialord#method.ge)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3161)1.8.0 · ### impl<'a, 'b> PartialOrd<Path> for OsString
[source](https://doc.rust-lang.org/src/std/path.rs.html#3161)#### fn partial\_cmp(&self, other: &Path) -> Option<Ordering>
This method returns an ordering between `self` and `other` values if one exists. [Read more](../cmp/trait.partialord#tymethod.partial_cmp)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1138)#### fn lt(&self, other: &Rhs) -> bool
This method tests less than (for `self` and `other`) and is used by the `<` operator. [Read more](../cmp/trait.partialord#method.lt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1157)#### fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for `self` and `other`) and is used by the `<=` operator. [Read more](../cmp/trait.partialord#method.le)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1175)#### fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for `self` and `other`) and is used by the `>` operator. [Read more](../cmp/trait.partialord#method.gt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1194)#### fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for `self` and `other`) and is used by the `>=` operator. [Read more](../cmp/trait.partialord#method.ge)
[source](https://doc.rust-lang.org/src/std/path.rs.html#2985-2990)### impl PartialOrd<Path> for Path
[source](https://doc.rust-lang.org/src/std/path.rs.html#2987-2989)#### fn partial\_cmp(&self, other: &Path) -> Option<Ordering>
This method returns an ordering between `self` and `other` values if one exists. [Read more](../cmp/trait.partialord#tymethod.partial_cmp)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1138)#### fn lt(&self, other: &Rhs) -> bool
This method tests less than (for `self` and `other`) and is used by the `<` operator. [Read more](../cmp/trait.partialord#method.lt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1157)#### fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for `self` and `other`) and is used by the `<=` operator. [Read more](../cmp/trait.partialord#method.le)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1175)#### fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for `self` and `other`) and is used by the `>` operator. [Read more](../cmp/trait.partialord#method.gt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1194)#### fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for `self` and `other`) and is used by the `>=` operator. [Read more](../cmp/trait.partialord#method.ge)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3112)1.8.0 · ### impl<'a, 'b> PartialOrd<Path> for PathBuf
[source](https://doc.rust-lang.org/src/std/path.rs.html#3112)#### fn partial\_cmp(&self, other: &Path) -> Option<Ordering>
This method returns an ordering between `self` and `other` values if one exists. [Read more](../cmp/trait.partialord#tymethod.partial_cmp)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1138)#### fn lt(&self, other: &Rhs) -> bool
This method tests less than (for `self` and `other`) and is used by the `<` operator. [Read more](../cmp/trait.partialord#method.lt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1157)#### fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for `self` and `other`) and is used by the `<=` operator. [Read more](../cmp/trait.partialord#method.le)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1175)#### fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for `self` and `other`) and is used by the `>` operator. [Read more](../cmp/trait.partialord#method.gt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1194)#### fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for `self` and `other`) and is used by the `>=` operator. [Read more](../cmp/trait.partialord#method.ge)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3113)1.8.0 · ### impl<'a, 'b> PartialOrd<PathBuf> for &'a Path
[source](https://doc.rust-lang.org/src/std/path.rs.html#3113)#### fn partial\_cmp(&self, other: &PathBuf) -> Option<Ordering>
This method returns an ordering between `self` and `other` values if one exists. [Read more](../cmp/trait.partialord#tymethod.partial_cmp)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1138)#### fn lt(&self, other: &Rhs) -> bool
This method tests less than (for `self` and `other`) and is used by the `<` operator. [Read more](../cmp/trait.partialord#method.lt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1157)#### fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for `self` and `other`) and is used by the `<=` operator. [Read more](../cmp/trait.partialord#method.le)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1175)#### fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for `self` and `other`) and is used by the `>` operator. [Read more](../cmp/trait.partialord#method.gt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1194)#### fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for `self` and `other`) and is used by the `>=` operator. [Read more](../cmp/trait.partialord#method.ge)
[source](https://doc.rust-lang.org/src/std/path.rs.html#3112)1.8.0 · ### impl<'a, 'b> PartialOrd<PathBuf> for Path
[source](https://doc.rust-lang.org/src/std/path.rs.html#3112)#### fn partial\_cmp(&self, other: &PathBuf) -> Option<Ordering>
This method returns an ordering between `self` and `other` values if one exists. [Read more](../cmp/trait.partialord#tymethod.partial_cmp)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1138)#### fn lt(&self, other: &Rhs) -> bool
This method tests less than (for `self` and `other`) and is used by the `<` operator. [Read more](../cmp/trait.partialord#method.lt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1157)#### fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for `self` and `other`) and is used by the `<=` operator. [Read more](../cmp/trait.partialord#method.le)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1175)#### fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for `self` and `other`) and is used by the `>` operator. [Read more](../cmp/trait.partialord#method.gt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1194)#### fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for `self` and `other`) and is used by the `>=` operator. [Read more](../cmp/trait.partialord#method.ge)
[source](https://doc.rust-lang.org/src/std/path.rs.html#1833-1843)### impl ToOwned for Path
#### type Owned = PathBuf
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/std/path.rs.html#1836-1838)#### fn to\_owned(&self) -> PathBuf
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/std/path.rs.html#1840-1842)#### fn clone\_into(&self, target: &mut PathBuf)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/std/path.rs.html#2982)### impl Eq for Path
Auto Trait Implementations
--------------------------
### impl RefUnwindSafe for Path
### impl Send for Path
### impl !Sized for Path
### impl Sync for Path
### impl Unpin for Path
### impl UnwindSafe for Path
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
| programming_docs |
rust Struct std::path::Ancestors Struct std::path::Ancestors
===========================
```
pub struct Ancestors<'a> { /* private fields */ }
```
An iterator over [`Path`](struct.path "Path") and its ancestors.
This `struct` is created by the [`ancestors`](struct.path#method.ancestors) method on [`Path`](struct.path "Path"). See its documentation for more.
Examples
--------
```
use std::path::Path;
let path = Path::new("/foo/bar");
for ancestor in path.ancestors() {
println!("{}", ancestor.display());
}
```
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/std/path.rs.html#1086)### impl<'a> Clone for Ancestors<'a>
[source](https://doc.rust-lang.org/src/std/path.rs.html#1086)#### fn clone(&self) -> Ancestors<'a>
Notable traits for [Ancestors](struct.ancestors "struct std::path::Ancestors")<'a>
```
impl<'a> Iterator for Ancestors<'a>
type Item = &'a Path;
```
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)1.0.0 · #### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/std/path.rs.html#1086)### impl<'a> Debug for Ancestors<'a>
[source](https://doc.rust-lang.org/src/std/path.rs.html#1086)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/std/path.rs.html#1094-1103)### impl<'a> Iterator for Ancestors<'a>
#### type Item = &'a Path
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/std/path.rs.html#1098-1102)#### fn next(&mut self) -> Option<Self::Item>
Advances the iterator and returns the next value. [Read more](../iter/trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](../iter/trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#215)1.0.0 · #### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](../iter/trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#252-254)1.0.0 · #### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](../iter/trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#282-284)1.0.0 · #### fn last(self) -> Option<Self::Item>
Consumes the iterator, returning the last element. [Read more](../iter/trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#328)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](../iter/trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#376)1.0.0 · #### fn nth(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element of the iterator. [Read more](../iter/trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)#### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](../iter/struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](../iter/trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)1.0.0 · #### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](../iter/struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](../iter/trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)1.0.0 · #### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](../iter/struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](../iter/trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](../iter/struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](../iter/trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)1.0.0 · #### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](../iter/struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](../iter/trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](../iter/trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)1.0.0 · #### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](../iter/struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](../iter/trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)1.0.0 · #### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](../iter/struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](../iter/trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)1.0.0 · #### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](../iter/struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](../iter/trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)1.0.0 · #### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](../iter/struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](../iter/struct.peekable#method.peek) and [`peek_mut`](../iter/struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](../iter/trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)1.0.0 · #### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](../iter/struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](../iter/trait.iterator#method.skip)s elements based on a predicate. [Read more](../iter/trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)1.0.0 · #### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](../iter/struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](../iter/trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](../iter/struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](../iter/trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)1.0.0 · #### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](../iter/struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](../iter/trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)1.0.0 · #### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](../iter/struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](../iter/trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)1.0.0 · #### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](../iter/struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](../iter/trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](../iter/trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)1.0.0 · #### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](../iter/struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](../iter/trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)1.0.0 · #### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](../iter/struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](../iter/trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)1.0.0 · #### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](../iter/struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](../iter/trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)1.0.0 · #### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](../iter/trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)1.0.0 · #### fn collect<B>(self) -> Bwhere B: [FromIterator](../iter/trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](../iter/trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](../iter/trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)1.0.0 · #### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](../iter/trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](../iter/trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2230-2234)1.27.0 · #### fn try\_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](../iter/trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](../iter/trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2407-2410)1.0.0 · #### fn fold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](../iter/trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](../iter/trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](../iter/trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)1.0.0 · #### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)1.0.0 · #### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)1.0.0 · #### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](../iter/trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](../iter/trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](../iter/trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)1.0.0 · #### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](../iter/trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](../iter/trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](../iter/trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)1.0.0 · #### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](../iter/trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](../iter/struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](../iter/trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)1.0.0 · #### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](../iter/struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](../iter/trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3312-3314)1.0.0 · #### fn cycle(self) -> Cycle<Self>where Self: [Clone](../clone/trait.clone "trait std::clone::Clone"),
Notable traits for [Cycle](../iter/struct.cycle "struct std::iter::Cycle")<I>
```
impl<I> Iterator for Cycle<I>where
I: Clone + Iterator,
type Item = <I as Iterator>::Item;
```
Repeats an iterator endlessly. [Read more](../iter/trait.iterator#method.cycle)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](../iter/struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](../iter/trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](../iter/trait.sum "trait std::iter::Sum")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](../iter/trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](../iter/trait.product "trait std::iter::Product")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](../iter/trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another. [Read more](../iter/trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another. [Read more](../iter/trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](../iter/trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are unequal to those of another. [Read more](../iter/trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](../iter/trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](../iter/trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](../iter/trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](../iter/trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](../iter/trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](../iter/trait.iterator#method.is_sorted_by_key)
[source](https://doc.rust-lang.org/src/std/path.rs.html#1086)### impl<'a> Copy for Ancestors<'a>
[source](https://doc.rust-lang.org/src/std/path.rs.html#1106)### impl FusedIterator for Ancestors<'\_>
Auto Trait Implementations
--------------------------
### impl<'a> RefUnwindSafe for Ancestors<'a>
### impl<'a> Send for Ancestors<'a>
### impl<'a> Sync for Ancestors<'a>
### impl<'a> Unpin for Ancestors<'a>
### impl<'a> UnwindSafe for Ancestors<'a>
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](../iter/trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](../iter/trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Function std::path::absolute Function std::path::absolute
============================
```
pub fn absolute<P: AsRef<Path>>(path: P) -> Result<PathBuf>
```
🔬This is a nightly-only experimental API. (`absolute_path` [#92750](https://github.com/rust-lang/rust/issues/92750))
Makes the path absolute without accessing the filesystem.
If the path is relative, the current directory is used as the base directory. All intermediate components will be resolved according to platforms-specific rules but unlike [`canonicalize`](../fs/fn.canonicalize "crate::fs::canonicalize") this does not resolve symlinks and may succeed even if the path does not exist.
If the `path` is empty or getting the [current directory](../env/fn.current_dir "crate::env::current_dir") fails then an error will be returned.
Examples
--------
### Posix paths
```
#![feature(absolute_path)]
fn main() -> std::io::Result<()> {
use std::path::{self, Path};
// Relative to absolute
let absolute = path::absolute("foo/./bar")?;
assert!(absolute.ends_with("foo/bar"));
// Absolute to absolute
let absolute = path::absolute("/foo//test/.././bar.rs")?;
assert_eq!(absolute, Path::new("/foo/test/../bar.rs"));
Ok(())
}
```
The path is resolved using [POSIX semantics](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_13) except that it stops short of resolving symlinks. This means it will keep `..` components and trailing slashes.
### Windows paths
```
#![feature(absolute_path)]
fn main() -> std::io::Result<()> {
use std::path::{self, Path};
// Relative to absolute
let absolute = path::absolute("foo/./bar")?;
assert!(absolute.ends_with(r"foo\bar"));
// Absolute to absolute
let absolute = path::absolute(r"C:\foo//test\..\./bar.rs")?;
assert_eq!(absolute, Path::new(r"C:\foo\bar.rs"));
Ok(())
}
```
For verbatim paths this will simply return the path as given. For other paths this is currently equivalent to calling [`GetFullPathNameW`](https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getfullpathnamew) This may change in the future.
rust Constant std::path::MAIN_SEPARATOR Constant std::path::MAIN\_SEPARATOR
===================================
```
pub const MAIN_SEPARATOR: char = crate::sys::path::MAIN_SEP; // '/'
```
The primary separator of path components for the current platform.
For example, `/` on Unix and `\` on Windows.
rust Enum std::path::Component Enum std::path::Component
=========================
```
pub enum Component<'a> {
Prefix(PrefixComponent<'a>),
RootDir,
CurDir,
ParentDir,
Normal(&'a OsStr),
}
```
A single component of a path.
A `Component` roughly corresponds to a substring between path separators (`/` or `\`).
This `enum` is created by iterating over [`Components`](struct.components "Components"), which in turn is created by the [`components`](struct.path#method.components) method on [`Path`](struct.path "Path").
Examples
--------
```
use std::path::{Component, Path};
let path = Path::new("/tmp/foo/bar.txt");
let components = path.components().collect::<Vec<_>>();
assert_eq!(&components, &[
Component::RootDir,
Component::Normal("tmp".as_ref()),
Component::Normal("foo".as_ref()),
Component::Normal("bar.txt".as_ref()),
]);
```
Variants
--------
### `Prefix([PrefixComponent](struct.prefixcomponent "struct std::path::PrefixComponent")<'a>)`
A Windows path prefix, e.g., `C:` or `\\server\share`.
There is a large variety of prefix types, see [`Prefix`](enum.prefix "Prefix")’s documentation for more.
Does not occur on Unix.
### `RootDir`
The root directory component, appears after any prefix and before anything else.
It represents a separator that designates that a path starts from root.
### `CurDir`
A reference to the current directory, i.e., `.`.
### `ParentDir`
A reference to the parent directory, i.e., `..`.
### `Normal(&'a [OsStr](../ffi/struct.osstr "struct std::ffi::OsStr"))`
A normal component, e.g., `a` and `b` in `a/b`.
This variant is the most common one, it represents references to files or directories.
Implementations
---------------
[source](https://doc.rust-lang.org/src/std/path.rs.html#539-562)### impl<'a> Component<'a>
[source](https://doc.rust-lang.org/src/std/path.rs.html#553-561)#### pub fn as\_os\_str(self) -> &'a OsStr
Extracts the underlying [`OsStr`](../ffi/struct.osstr "OsStr") slice.
##### Examples
```
use std::path::Path;
let path = Path::new("./tmp/foo/bar.txt");
let components: Vec<_> = path.components().map(|comp| comp.as_os_str()).collect();
assert_eq!(&components, &[".", "tmp", "foo", "bar.txt"]);
```
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/std/path.rs.html#565-570)### impl AsRef<OsStr> for Component<'\_>
[source](https://doc.rust-lang.org/src/std/path.rs.html#567-569)#### fn as\_ref(&self) -> &OsStr
Converts this type into a shared reference of the (usually inferred) input type.
[source](https://doc.rust-lang.org/src/std/path.rs.html#573-578)1.25.0 · ### impl AsRef<Path> for Component<'\_>
[source](https://doc.rust-lang.org/src/std/path.rs.html#575-577)#### fn as\_ref(&self) -> &Path
Converts this type into a shared reference of the (usually inferred) input type.
[source](https://doc.rust-lang.org/src/std/path.rs.html#505)### impl<'a> Clone for Component<'a>
[source](https://doc.rust-lang.org/src/std/path.rs.html#505)#### fn clone(&self) -> Component<'a>
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)#### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/std/path.rs.html#505)### impl<'a> Debug for Component<'a>
[source](https://doc.rust-lang.org/src/std/path.rs.html#505)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/std/path.rs.html#505)### impl<'a> Hash for Component<'a>
[source](https://doc.rust-lang.org/src/std/path.rs.html#505)#### fn hash<\_\_H: Hasher>(&self, state: &mut \_\_H)
Feeds this value into the given [`Hasher`](../hash/trait.hasher "Hasher"). [Read more](../hash/trait.hash#tymethod.hash)
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#237-239)1.3.0 · #### fn hash\_slice<H>(data: &[Self], state: &mut H)where H: [Hasher](../hash/trait.hasher "trait std::hash::Hasher"),
Feeds a slice of this type into the given [`Hasher`](../hash/trait.hasher "Hasher"). [Read more](../hash/trait.hash#method.hash_slice)
[source](https://doc.rust-lang.org/src/std/path.rs.html#505)### impl<'a> Ord for Component<'a>
[source](https://doc.rust-lang.org/src/std/path.rs.html#505)#### fn cmp(&self, other: &Component<'a>) -> Ordering
This method returns an [`Ordering`](../cmp/enum.ordering "Ordering") between `self` and `other`. [Read more](../cmp/trait.ord#tymethod.cmp)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#804-807)1.21.0 · #### fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. [Read more](../cmp/trait.ord#method.max)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#831-834)1.21.0 · #### fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. [Read more](../cmp/trait.ord#method.min)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#863-867)1.50.0 · #### fn clamp(self, min: Self, max: Self) -> Selfwhere Self: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<Self>,
Restrict a value to a certain interval. [Read more](../cmp/trait.ord#method.clamp)
[source](https://doc.rust-lang.org/src/std/path.rs.html#505)### impl<'a> PartialEq<Component<'a>> for Component<'a>
[source](https://doc.rust-lang.org/src/std/path.rs.html#505)#### fn eq(&self, other: &Component<'a>) -> bool
This method tests for `self` and `other` values to be equal, and is used by `==`. [Read more](../cmp/trait.partialeq#tymethod.eq)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#236)#### fn ne(&self, other: &Rhs) -> bool
This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. [Read more](../cmp/trait.partialeq#method.ne)
[source](https://doc.rust-lang.org/src/std/path.rs.html#505)### impl<'a> PartialOrd<Component<'a>> for Component<'a>
[source](https://doc.rust-lang.org/src/std/path.rs.html#505)#### fn partial\_cmp(&self, other: &Component<'a>) -> Option<Ordering>
This method returns an ordering between `self` and `other` values if one exists. [Read more](../cmp/trait.partialord#tymethod.partial_cmp)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1138)#### fn lt(&self, other: &Rhs) -> bool
This method tests less than (for `self` and `other`) and is used by the `<` operator. [Read more](../cmp/trait.partialord#method.lt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1157)#### fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for `self` and `other`) and is used by the `<=` operator. [Read more](../cmp/trait.partialord#method.le)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1175)#### fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for `self` and `other`) and is used by the `>` operator. [Read more](../cmp/trait.partialord#method.gt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1194)#### fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for `self` and `other`) and is used by the `>=` operator. [Read more](../cmp/trait.partialord#method.ge)
[source](https://doc.rust-lang.org/src/std/path.rs.html#505)### impl<'a> Copy for Component<'a>
[source](https://doc.rust-lang.org/src/std/path.rs.html#505)### impl<'a> Eq for Component<'a>
[source](https://doc.rust-lang.org/src/std/path.rs.html#505)### impl<'a> StructuralEq for Component<'a>
[source](https://doc.rust-lang.org/src/std/path.rs.html#505)### impl<'a> StructuralPartialEq for Component<'a>
Auto Trait Implementations
--------------------------
### impl<'a> RefUnwindSafe for Component<'a>
### impl<'a> Send for Component<'a>
### impl<'a> Sync for Component<'a>
### impl<'a> Unpin for Component<'a>
### impl<'a> UnwindSafe for Component<'a>
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
rust Struct std::path::Iter Struct std::path::Iter
======================
```
pub struct Iter<'a> { /* private fields */ }
```
An iterator over the [`Component`](enum.component "Component")s of a [`Path`](struct.path "Path"), as [`OsStr`](../ffi/struct.osstr "OsStr") slices.
This `struct` is created by the [`iter`](struct.path#method.iter) method on [`Path`](struct.path "Path"). See its documentation for more.
Implementations
---------------
[source](https://doc.rust-lang.org/src/std/path.rs.html#828-848)### impl<'a> Iter<'a>
[source](https://doc.rust-lang.org/src/std/path.rs.html#845-847)#### pub fn as\_path(&self) -> &'a Path
Extracts a slice corresponding to the portion of the path remaining for iteration.
##### Examples
```
use std::path::Path;
let mut iter = Path::new("/tmp/foo/bar.txt").iter();
iter.next();
iter.next();
assert_eq!(Path::new("foo/bar.txt"), iter.as_path());
```
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/std/path.rs.html#859-864)### impl AsRef<OsStr> for Iter<'\_>
[source](https://doc.rust-lang.org/src/std/path.rs.html#861-863)#### fn as\_ref(&self) -> &OsStr
Converts this type into a shared reference of the (usually inferred) input type.
[source](https://doc.rust-lang.org/src/std/path.rs.html#851-856)### impl AsRef<Path> for Iter<'\_>
[source](https://doc.rust-lang.org/src/std/path.rs.html#853-855)#### fn as\_ref(&self) -> &Path
Converts this type into a shared reference of the (usually inferred) input type.
[source](https://doc.rust-lang.org/src/std/path.rs.html#625)### impl<'a> Clone for Iter<'a>
[source](https://doc.rust-lang.org/src/std/path.rs.html#625)#### fn clone(&self) -> Iter<'a>
Notable traits for [Iter](struct.iter "struct std::path::Iter")<'a>
```
impl<'a> Iterator for Iter<'a>
type Item = &'a OsStr;
```
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)#### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/std/path.rs.html#814-826)1.13.0 · ### impl Debug for Iter<'\_>
[source](https://doc.rust-lang.org/src/std/path.rs.html#815-825)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/std/path.rs.html#877-882)### impl<'a> DoubleEndedIterator for Iter<'a>
[source](https://doc.rust-lang.org/src/std/path.rs.html#879-881)#### fn next\_back(&mut self) -> Option<&'a OsStr>
Removes and returns an element from the end of the iterator. [Read more](../iter/trait.doubleendediterator#tymethod.next_back)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#134)#### fn advance\_back\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator from the back by `n` elements. [Read more](../iter/trait.doubleendediterator#method.advance_back_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#184)1.37.0 · #### fn nth\_back(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element from the end of the iterator. [Read more](../iter/trait.doubleendediterator#method.nth_back)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#221-225)1.27.0 · #### fn try\_rfold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
This is the reverse version of [`Iterator::try_fold()`](../iter/trait.iterator#method.try_fold "Iterator::try_fold()"): it takes elements starting from the back of the iterator. [Read more](../iter/trait.doubleendediterator#method.try_rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#292-295)1.27.0 · #### fn rfold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
An iterator method that reduces the iterator’s elements to a single, final value, starting from the back. [Read more](../iter/trait.doubleendediterator#method.rfold)
[source](https://doc.rust-lang.org/src/core/iter/traits/double_ended.rs.html#347-350)1.27.0 · #### fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator from the back that satisfies a predicate. [Read more](../iter/trait.doubleendediterator#method.rfind)
[source](https://doc.rust-lang.org/src/std/path.rs.html#867-874)### impl<'a> Iterator for Iter<'a>
#### type Item = &'a OsStr
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/std/path.rs.html#871-873)#### fn next(&mut self) -> Option<&'a OsStr>
Advances the iterator and returns the next value. [Read more](../iter/trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](../iter/trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#215)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](../iter/trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#252-254)#### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](../iter/trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#282-284)#### fn last(self) -> Option<Self::Item>
Consumes the iterator, returning the last element. [Read more](../iter/trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#328)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](../iter/trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#376)#### fn nth(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element of the iterator. [Read more](../iter/trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](../iter/struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](../iter/trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)#### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](../iter/struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](../iter/trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)#### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](../iter/struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](../iter/trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](../iter/struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](../iter/trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)#### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](../iter/struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](../iter/trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](../iter/trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)#### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](../iter/struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](../iter/trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)#### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](../iter/struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](../iter/trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)#### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](../iter/struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](../iter/trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)#### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](../iter/struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](../iter/struct.peekable#method.peek) and [`peek_mut`](../iter/struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](../iter/trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)#### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](../iter/struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](../iter/trait.iterator#method.skip)s elements based on a predicate. [Read more](../iter/trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)#### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](../iter/struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](../iter/trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](../iter/struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](../iter/trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)#### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](../iter/struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](../iter/trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)#### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](../iter/struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](../iter/trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)#### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](../iter/struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](../iter/trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](../iter/trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)#### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](../iter/struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](../iter/trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)#### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](../iter/struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](../iter/trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)#### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](../iter/struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](../iter/trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)#### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](../iter/trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)#### fn collect<B>(self) -> Bwhere B: [FromIterator](../iter/trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](../iter/trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](../iter/trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)#### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](../iter/trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2079-2082)#### fn partition\_in\_place<'a, T, P>(self, predicate: P) -> usizewhere T: 'a, Self: [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator")<Item = [&'a mut](../primitive.reference) T>, P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_partition_in_place` [#62543](https://github.com/rust-lang/rust/issues/62543))
Reorders the elements of this iterator *in-place* according to the given predicate, such that all those that return `true` precede all those that return `false`. Returns the number of `true` elements found. [Read more](../iter/trait.iterator#method.partition_in_place)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](../iter/trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2230-2234)1.27.0 · #### fn try\_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](../iter/trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](../iter/trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2407-2410)#### fn fold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](../iter/trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](../iter/trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](../iter/trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)#### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)#### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)#### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](../iter/trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](../iter/trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](../iter/trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)#### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](../iter/trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](../iter/trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](../iter/trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3161-3163)#### fn rev(self) -> Rev<Self>where Self: [DoubleEndedIterator](../iter/trait.doubleendediterator "trait std::iter::DoubleEndedIterator"),
Notable traits for [Rev](../iter/struct.rev "struct std::iter::Rev")<I>
```
impl<I> Iterator for Rev<I>where
I: DoubleEndedIterator,
type Item = <I as Iterator>::Item;
```
Reverses an iterator’s direction. [Read more](../iter/trait.iterator#method.rev)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)#### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](../iter/trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](../iter/struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](../iter/trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)#### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](../iter/struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](../iter/trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3312-3314)#### fn cycle(self) -> Cycle<Self>where Self: [Clone](../clone/trait.clone "trait std::clone::Clone"),
Notable traits for [Cycle](../iter/struct.cycle "struct std::iter::Cycle")<I>
```
impl<I> Iterator for Cycle<I>where
I: Clone + Iterator,
type Item = <I as Iterator>::Item;
```
Repeats an iterator endlessly. [Read more](../iter/trait.iterator#method.cycle)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](../iter/struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](../iter/trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](../iter/trait.sum "trait std::iter::Sum")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](../iter/trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](../iter/trait.product "trait std::iter::Product")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](../iter/trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another. [Read more](../iter/trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another. [Read more](../iter/trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](../iter/trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are unequal to those of another. [Read more](../iter/trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](../iter/trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](../iter/trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](../iter/trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](../iter/trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](../iter/trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](../iter/trait.iterator#method.is_sorted_by_key)
[source](https://doc.rust-lang.org/src/std/path.rs.html#885)1.26.0 · ### impl FusedIterator for Iter<'\_>
Auto Trait Implementations
--------------------------
### impl<'a> RefUnwindSafe for Iter<'a>
### impl<'a> Send for Iter<'a>
### impl<'a> Sync for Iter<'a>
### impl<'a> Unpin for Iter<'a>
### impl<'a> UnwindSafe for Iter<'a>
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](../iter/trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](../iter/trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Module std::i8 Module std::i8
==============
👎Deprecating in a future Rust version: all constants in this module replaced by associated constants on `i8`
Constants for the 8-bit signed integer type.
*[See also the `i8` primitive type](../primitive.i8 "i8").*
New code should use the associated constants directly on the primitive type.
Constants
---------
[MAX](constant.max "std::i8::MAX constant")Deprecation planned
The largest value that can be represented by this integer type. Use [`i8::MAX`](../primitive.i8#associatedconstant.MAX "i8::MAX") instead.
[MIN](constant.min "std::i8::MIN constant")Deprecation planned
The smallest value that can be represented by this integer type. Use [`i8::MIN`](../primitive.i8#associatedconstant.MIN "i8::MIN") instead.
rust Constant std::i8::MAX Constant std::i8::MAX
=====================
```
pub const MAX: i8 = i8::MAX; // 127i8
```
👎Deprecating in a future Rust version: replaced by the `MAX` associated constant on this type
The largest value that can be represented by this integer type. Use [`i8::MAX`](../primitive.i8#associatedconstant.MAX "i8::MAX") instead.
Examples
--------
```
// deprecated way
let max = std::i8::MAX;
// intended way
let max = i8::MAX;
```
rust Constant std::i8::MIN Constant std::i8::MIN
=====================
```
pub const MIN: i8 = i8::MIN; // -128i8
```
👎Deprecating in a future Rust version: replaced by the `MIN` associated constant on this type
The smallest value that can be represented by this integer type. Use [`i8::MIN`](../primitive.i8#associatedconstant.MIN "i8::MIN") instead.
Examples
--------
```
// deprecated way
let min = std::i8::MIN;
// intended way
let min = i8::MIN;
```
rust Module std::usize Module std::usize
=================
👎Deprecating in a future Rust version: all constants in this module replaced by associated constants on `usize`
Constants for the pointer-sized unsigned integer type.
*[See also the `usize` primitive type](../primitive.usize "usize").*
New code should use the associated constants directly on the primitive type.
Constants
---------
[MAX](constant.max "std::usize::MAX constant")Deprecation planned
The largest value that can be represented by this integer type. Use [`usize::MAX`](../primitive.usize#associatedconstant.MAX "usize::MAX") instead.
[MIN](constant.min "std::usize::MIN constant")Deprecation planned
The smallest value that can be represented by this integer type. Use [`usize::MIN`](../primitive.usize#associatedconstant.MIN "usize::MIN") instead.
rust Constant std::usize::MAX Constant std::usize::MAX
========================
```
pub const MAX: usize = usize::MAX; // 18_446_744_073_709_551_615usize
```
👎Deprecating in a future Rust version: replaced by the `MAX` associated constant on this type
The largest value that can be represented by this integer type. Use [`usize::MAX`](../primitive.usize#associatedconstant.MAX "usize::MAX") instead.
Examples
--------
```
// deprecated way
let max = std::usize::MAX;
// intended way
let max = usize::MAX;
```
rust Constant std::usize::MIN Constant std::usize::MIN
========================
```
pub const MIN: usize = usize::MIN; // 0usize
```
👎Deprecating in a future Rust version: replaced by the `MIN` associated constant on this type
The smallest value that can be represented by this integer type. Use [`usize::MIN`](../primitive.usize#associatedconstant.MIN "usize::MIN") instead.
Examples
--------
```
// deprecated way
let min = std::usize::MIN;
// intended way
let min = usize::MIN;
```
rust Module std::primitive Module std::primitive
=====================
This module reexports the primitive types to allow usage that is not possibly shadowed by other declared types.
This is normally only useful in macro generated code.
An example of this is when generating a new struct and an impl for it:
ⓘ
```
pub struct bool;
impl QueryId for bool {
const SOME_PROPERTY: bool = true;
}
```
Note that the `SOME_PROPERTY` associated constant would not compile, as its type `bool` refers to the struct, rather than to the primitive bool type.
A correct implementation could look like:
```
pub struct bool;
impl QueryId for bool {
const SOME_PROPERTY: core::primitive::bool = true;
}
```
Re-exports
----------
`pub use [bool](../primitive.bool);`
`pub use [char](../primitive.char);`
`pub use [f32](../primitive.f32);`
`pub use [f64](../primitive.f64);`
`pub use [i128](../primitive.i128);`
`pub use [i16](../primitive.i16);`
`pub use [i32](../primitive.i32);`
`pub use [i64](../primitive.i64);`
`pub use [i8](../primitive.i8);`
`pub use [isize](../primitive.isize);`
`pub use [str](../primitive.str);`
`pub use [u128](../primitive.u128);`
`pub use [u16](../primitive.u16);`
`pub use [u32](../primitive.u32);`
`pub use [u64](../primitive.u64);`
`pub use [u8](../primitive.u8);`
`pub use [usize](../primitive.usize);`
rust Struct std::io::Stdin Struct std::io::Stdin
=====================
```
pub struct Stdin { /* private fields */ }
```
A handle to the standard input stream of a process.
Each handle is a shared reference to a global buffer of input data to this process. A handle can be `lock`’d to gain full access to [`BufRead`](trait.bufread "BufRead") methods (e.g., `.lines()`). Reads to this handle are otherwise locked with respect to other reads.
This handle implements the `Read` trait, but beware that concurrent reads of `Stdin` must be executed with care.
Created by the [`io::stdin`](fn.stdin) method.
#### Note: Windows Portability Considerations
When operating in a console, the Windows implementation of this stream does not support non-UTF-8 byte sequences. Attempting to read bytes that are not valid UTF-8 will return an error.
In a process with a detached console, such as one using `#![windows_subsystem = "windows"]`, or in a child process spawned from such a process, the contained handle will be null. In such cases, the standard library’s `Read` and `Write` will do nothing and silently succeed. All other I/O operations, via the standard library or via raw Windows API calls, will fail.
Examples
--------
```
use std::io;
fn main() -> io::Result<()> {
let mut buffer = String::new();
let stdin = io::stdin(); // We get `Stdin` here.
stdin.read_line(&mut buffer)?;
Ok(())
}
```
Implementations
---------------
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#327-407)### impl Stdin
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#350-354)#### pub fn lock(&self) -> StdinLock<'static>
Notable traits for [StdinLock](struct.stdinlock "struct std::io::StdinLock")<'\_>
```
impl Read for StdinLock<'_>
```
Locks this handle to the standard input stream, returning a readable guard.
The lock is released when the returned lock goes out of scope. The returned guard also implements the [`Read`](trait.read "Read") and [`BufRead`](trait.bufread "BufRead") traits for accessing the underlying data.
##### Examples
```
use std::io::{self, BufRead};
fn main() -> io::Result<()> {
let mut buffer = String::new();
let stdin = io::stdin();
let mut handle = stdin.lock();
handle.read_line(&mut buffer)?;
Ok(())
}
```
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#383-385)#### pub fn read\_line(&self, buf: &mut String) -> Result<usize>
Locks this handle and reads a line of input, appending it to the specified buffer.
For detailed semantics of this method, see the documentation on [`BufRead::read_line`](trait.bufread#method.read_line "BufRead::read_line").
##### Examples
```
use std::io;
let mut input = String::new();
match io::stdin().read_line(&mut input) {
Ok(n) => {
println!("{n} bytes read");
println!("{input}");
}
Err(error) => println!("error: {error}"),
}
```
You can run the example one of two ways:
* Pipe some text to it, e.g., `printf foo | path/to/executable`
* Give it text interactively by running the executable directly, in which case it will wait for the Enter key to be pressed before continuing
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#404-406)1.62.0 · #### pub fn lines(self) -> Lines<StdinLock<'static>>
Notable traits for [Lines](struct.lines "struct std::io::Lines")<B>
```
impl<B: BufRead> Iterator for Lines<B>
type Item = Result<String>;
```
Consumes this handle and returns an iterator over input lines.
For detailed semantics of this method, see the documentation on [`BufRead::lines`](trait.bufread#method.lines "BufRead::lines").
##### Examples
```
use std::io;
let lines = io::stdin().lines();
for line in lines {
println!("got a line: {}", line.unwrap());
}
```
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/std/sys/unix/stdio.rs.html#96-101)1.63.0 · ### impl AsFd for Stdin
[source](https://doc.rust-lang.org/src/std/sys/unix/stdio.rs.html#98-100)#### fn as\_fd(&self) -> BorrowedFd<'\_>
Available on **Unix** only.Borrows the file descriptor. [Read more](../os/unix/io/trait.asfd#tymethod.as_fd)
[source](https://doc.rust-lang.org/src/std/os/windows/io/handle.rs.html#467-472)1.63.0 · ### impl AsHandle for Stdin
Available on **Windows** only.
[source](https://doc.rust-lang.org/src/std/os/windows/io/handle.rs.html#469-471)#### fn as\_handle(&self) -> BorrowedHandle<'\_>
Borrows the handle. [Read more](../os/windows/io/trait.ashandle#tymethod.as_handle)
[source](https://doc.rust-lang.org/src/std/os/fd/raw.rs.html#183-188)1.21.0 · ### impl AsRawFd for Stdin
[source](https://doc.rust-lang.org/src/std/os/fd/raw.rs.html#185-187)#### fn as\_raw\_fd(&self) -> RawFd
Available on **Unix** only.Extracts the raw file descriptor. [Read more](../os/unix/io/trait.asrawfd#tymethod.as_raw_fd)
[source](https://doc.rust-lang.org/src/std/os/windows/io/raw.rs.html#105-109)1.21.0 · ### impl AsRawHandle for Stdin
Available on **Windows** only.
[source](https://doc.rust-lang.org/src/std/os/windows/io/raw.rs.html#106-108)#### fn as\_raw\_handle(&self) -> RawHandle
Extracts the raw handle. [Read more](../os/windows/io/trait.asrawhandle#tymethod.as_raw_handle)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#410-414)1.16.0 · ### impl Debug for Stdin
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#411-413)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#417-437)### impl Read for Stdin
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#418-420)#### fn read(&mut self, buf: &mut [u8]) -> Result<usize>
Pull some bytes from this source into the specified buffer, returning how many bytes were read. [Read more](trait.read#tymethod.read)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#421-423)#### fn read\_vectored(&mut self, bufs: &mut [IoSliceMut<'\_>]) -> Result<usize>
Like `read`, except that it reads into a slice of buffers. [Read more](trait.read#method.read_vectored)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#425-427)#### fn is\_read\_vectored(&self) -> bool
🔬This is a nightly-only experimental API. (`can_vector` [#69941](https://github.com/rust-lang/rust/issues/69941))
Determines if this `Read`er has an efficient `read_vectored` implementation. [Read more](trait.read#method.is_read_vectored)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#428-430)#### fn read\_to\_end(&mut self, buf: &mut Vec<u8>) -> Result<usize>
Read all bytes until EOF in this source, placing them into `buf`. [Read more](trait.read#method.read_to_end)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#431-433)#### fn read\_to\_string(&mut self, buf: &mut String) -> Result<usize>
Read all bytes until EOF in this source, appending them to `buf`. [Read more](trait.read#method.read_to_string)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#434-436)#### fn read\_exact(&mut self, buf: &mut [u8]) -> Result<()>
Read the exact number of bytes required to fill `buf`. [Read more](trait.read#method.read_exact)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#815-817)#### fn read\_buf(&mut self, buf: BorrowedCursor<'\_>) -> Result<()>
🔬This is a nightly-only experimental API. (`read_buf` [#78485](https://github.com/rust-lang/rust/issues/78485))
Pull some bytes from this source into the specified buffer. [Read more](trait.read#method.read_buf)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#824-839)#### fn read\_buf\_exact(&mut self, cursor: BorrowedCursor<'\_>) -> Result<()>
🔬This is a nightly-only experimental API. (`read_buf` [#78485](https://github.com/rust-lang/rust/issues/78485))
Read the exact number of bytes required to fill `cursor`. [Read more](trait.read#method.read_buf_exact)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#876-881)#### fn by\_ref(&mut self) -> &mut Selfwhere Self: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Creates a “by reference” adaptor for this instance of `Read`. [Read more](trait.read#method.by_ref)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#919-924)#### fn bytes(self) -> Bytes<Self>where Self: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Notable traits for [Bytes](struct.bytes "struct std::io::Bytes")<R>
```
impl<R: Read> Iterator for Bytes<R>
type Item = Result<u8>;
```
Transforms this `Read` instance to an [`Iterator`](../iter/trait.iterator "Iterator") over its bytes. [Read more](trait.read#method.bytes)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#957-962)#### fn chain<R: Read>(self, next: R) -> Chain<Self, R>where Self: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Notable traits for [Chain](struct.chain "struct std::io::Chain")<T, U>
```
impl<T: Read, U: Read> Read for Chain<T, U>
```
Creates an adapter which will chain this stream with another. [Read more](trait.read#method.chain)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#996-1001)#### fn take(self, limit: u64) -> Take<Self>where Self: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Notable traits for [Take](struct.take "struct std::io::Take")<T>
```
impl<T: Read> Read for Take<T>
```
Creates an adapter which will read at most `limit` bytes from it. [Read more](trait.read#method.take)
Auto Trait Implementations
--------------------------
### impl RefUnwindSafe for Stdin
### impl Send for Stdin
### impl Sync for Stdin
### impl Unpin for Stdin
### impl UnwindSafe for Stdin
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
rust Struct std::io::IntoInnerError Struct std::io::IntoInnerError
==============================
```
pub struct IntoInnerError<W>(_, _);
```
An error returned by [`BufWriter::into_inner`](struct.bufwriter#method.into_inner "BufWriter::into_inner") which combines an error that happened while writing out the buffer, and the buffered writer object which may be used to recover from the condition.
Examples
--------
```
use std::io::BufWriter;
use std::net::TcpStream;
let mut stream = BufWriter::new(TcpStream::connect("127.0.0.1:34254").unwrap());
// do stuff with the stream
// we want to get our `TcpStream` back, so let's try:
let stream = match stream.into_inner() {
Ok(s) => s,
Err(e) => {
// Here, e is an IntoInnerError
panic!("An error occurred");
}
};
```
Implementations
---------------
[source](https://doc.rust-lang.org/src/std/io/buffered/mod.rs.html#50-174)### impl<W> IntoInnerError<W>
[source](https://doc.rust-lang.org/src/std/io/buffered/mod.rs.html#93-95)#### pub fn error(&self) -> &Error
Returns the error which caused the call to [`BufWriter::into_inner()`](struct.bufwriter#method.into_inner "BufWriter::into_inner()") to fail.
This error was returned when attempting to write the internal buffer.
##### Examples
```
use std::io::BufWriter;
use std::net::TcpStream;
let mut stream = BufWriter::new(TcpStream::connect("127.0.0.1:34254").unwrap());
// do stuff with the stream
// we want to get our `TcpStream` back, so let's try:
let stream = match stream.into_inner() {
Ok(s) => s,
Err(e) => {
// Here, e is an IntoInnerError, let's log the inner error.
//
// We'll just 'log' to stdout for this example.
println!("{}", e.error());
panic!("An unexpected error occurred.");
}
};
```
[source](https://doc.rust-lang.org/src/std/io/buffered/mod.rs.html#128-130)#### pub fn into\_inner(self) -> W
Returns the buffered writer instance which generated the error.
The returned object can be used for error recovery, such as re-inspecting the buffer.
##### Examples
```
use std::io::BufWriter;
use std::net::TcpStream;
let mut stream = BufWriter::new(TcpStream::connect("127.0.0.1:34254").unwrap());
// do stuff with the stream
// we want to get our `TcpStream` back, so let's try:
let stream = match stream.into_inner() {
Ok(s) => s,
Err(e) => {
// Here, e is an IntoInnerError, let's re-examine the buffer:
let buffer = e.into_inner();
// do stuff to try to recover
// afterwards, let's just return the stream
buffer.into_inner().unwrap()
}
};
```
[source](https://doc.rust-lang.org/src/std/io/buffered/mod.rs.html#148-150)1.55.0 · #### pub fn into\_error(self) -> Error
Consumes the [`IntoInnerError`](struct.intoinnererror "IntoInnerError") and returns the error which caused the call to [`BufWriter::into_inner()`](struct.bufwriter#method.into_inner "BufWriter::into_inner()") to fail. Unlike `error`, this can be used to obtain ownership of the underlying error.
##### Example
```
use std::io::{BufWriter, ErrorKind, Write};
let mut not_enough_space = [0u8; 10];
let mut stream = BufWriter::new(not_enough_space.as_mut());
write!(stream, "this cannot be actually written").unwrap();
let into_inner_err = stream.into_inner().expect_err("now we discover it's too small");
let err = into_inner_err.into_error();
assert_eq!(err.kind(), ErrorKind::WriteZero);
```
[source](https://doc.rust-lang.org/src/std/io/buffered/mod.rs.html#171-173)1.55.0 · #### pub fn into\_parts(self) -> (Error, W)
Consumes the [`IntoInnerError`](struct.intoinnererror "IntoInnerError") and returns the error which caused the call to [`BufWriter::into_inner()`](struct.bufwriter#method.into_inner "BufWriter::into_inner()") to fail, and the underlying writer.
This can be used to simply obtain ownership of the underlying error; it can also be used for advanced error recovery.
##### Example
```
use std::io::{BufWriter, ErrorKind, Write};
let mut not_enough_space = [0u8; 10];
let mut stream = BufWriter::new(not_enough_space.as_mut());
write!(stream, "this cannot be actually written").unwrap();
let into_inner_err = stream.into_inner().expect_err("now we discover it's too small");
let (err, recovered_writer) = into_inner_err.into_parts();
assert_eq!(err.kind(), ErrorKind::WriteZero);
assert_eq!(recovered_writer.buffer(), b"t be actually written");
```
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/std/io/buffered/mod.rs.html#46)### impl<W: Debug> Debug for IntoInnerError<W>
[source](https://doc.rust-lang.org/src/std/io/buffered/mod.rs.html#46)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/std/io/buffered/mod.rs.html#192-196)### impl<W> Display for IntoInnerError<W>
[source](https://doc.rust-lang.org/src/std/io/buffered/mod.rs.html#193-195)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result
Formats the value using the given formatter. [Read more](../fmt/trait.display#tymethod.fmt)
[source](https://doc.rust-lang.org/src/std/io/buffered/mod.rs.html#184-189)### impl<W: Send + Debug> Error for IntoInnerError<W>
[source](https://doc.rust-lang.org/src/std/io/buffered/mod.rs.html#186-188)#### fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to\_string()
[Read more](../error/trait.error#method.description)
[source](https://doc.rust-lang.org/src/core/error.rs.html#83)1.30.0 · #### fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. [Read more](../error/trait.error#method.source)
[source](https://doc.rust-lang.org/src/core/error.rs.html#119)#### fn cause(&self) -> Option<&dyn Error>
👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
[source](https://doc.rust-lang.org/src/core/error.rs.html#193)#### fn provide(&'a self, demand: &mut Demand<'a>)
🔬This is a nightly-only experimental API. (`error_generic_member_access` [#99301](https://github.com/rust-lang/rust/issues/99301))
Provides type based access to context intended for error reports. [Read more](../error/trait.error#method.provide)
[source](https://doc.rust-lang.org/src/std/io/buffered/mod.rs.html#177-181)### impl<W> From<IntoInnerError<W>> for Error
[source](https://doc.rust-lang.org/src/std/io/buffered/mod.rs.html#178-180)#### fn from(iie: IntoInnerError<W>) -> Error
Converts to this type from the input type.
Auto Trait Implementations
--------------------------
### impl<W> !RefUnwindSafe for IntoInnerError<W>
### impl<W> Send for IntoInnerError<W>where W: [Send](../marker/trait.send "trait std::marker::Send"),
### impl<W> Sync for IntoInnerError<W>where W: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<W> Unpin for IntoInnerError<W>where W: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"),
### impl<W> !UnwindSafe for IntoInnerError<W>
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/error.rs.html#197)### impl<E> Provider for Ewhere E: [Error](../error/trait.error "trait std::error::Error") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/error.rs.html#201)#### fn provide(&'a self, demand: &mut Demand<'a>)
🔬This is a nightly-only experimental API. (`provide_any` [#96024](https://github.com/rust-lang/rust/issues/96024))
Data providers should implement this method to provide *all* values they are able to provide by using `demand`. [Read more](../any/trait.provider#tymethod.provide)
[source](https://doc.rust-lang.org/src/alloc/string.rs.html#2500)### impl<T> ToString for Twhere T: [Display](../fmt/trait.display "trait std::fmt::Display") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/alloc/string.rs.html#2506)#### default fn to\_string(&self) -> String
Converts the given value to a `String`. [Read more](../string/trait.tostring#tymethod.to_string)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Struct std::io::IoSlice Struct std::io::IoSlice
=======================
```
#[repr(transparent)]pub struct IoSlice<'a>(_);
```
A buffer type used with `Write::write_vectored`.
It is semantically a wrapper around a `&[u8]`, but is guaranteed to be ABI compatible with the `iovec` type on Unix platforms and `WSABUF` on Windows.
Implementations
---------------
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1220-1320)### impl<'a> IoSlice<'a>
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1229-1231)#### pub fn new(buf: &'a [u8]) -> IoSlice<'a>
Creates a new `IoSlice` wrapping a byte slice.
##### Panics
Panics on Windows if the slice is larger than 4GB.
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1259-1261)#### pub fn advance(&mut self, n: usize)
🔬This is a nightly-only experimental API. (`io_slice_advance` [#62726](https://github.com/rust-lang/rust/issues/62726))
Advance the internal cursor of the slice.
Also see [`IoSlice::advance_slices`](struct.ioslice#method.advance_slices "IoSlice::advance_slices") to advance the cursors of multiple buffers.
##### Panics
Panics when trying to advance beyond the end of the slice.
##### Examples
```
#![feature(io_slice_advance)]
use std::io::IoSlice;
use std::ops::Deref;
let data = [1; 8];
let mut buf = IoSlice::new(&data);
// Mark 3 bytes as read.
buf.advance(3);
assert_eq!(buf.deref(), [1; 5].as_ref());
```
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1299-1319)#### pub fn advance\_slices(bufs: &mut &mut [IoSlice<'a>], n: usize)
🔬This is a nightly-only experimental API. (`io_slice_advance` [#62726](https://github.com/rust-lang/rust/issues/62726))
Advance a slice of slices.
Shrinks the slice to remove any `IoSlice`s that are fully advanced over. If the cursor ends up in the middle of an `IoSlice`, it is modified to start at that cursor.
For example, if we have a slice of two 8-byte `IoSlice`s, and we advance by 10 bytes, the result will only include the second `IoSlice`, advanced by 2 bytes.
##### Panics
Panics when trying to advance beyond the end of the slices.
##### Examples
```
#![feature(io_slice_advance)]
use std::io::IoSlice;
use std::ops::Deref;
let buf1 = [1; 8];
let buf2 = [2; 16];
let buf3 = [3; 8];
let mut bufs = &mut [
IoSlice::new(&buf1),
IoSlice::new(&buf2),
IoSlice::new(&buf3),
][..];
// Mark 10 bytes as written.
IoSlice::advance_slices(&mut bufs, 10);
assert_eq!(bufs[0].deref(), [2; 14].as_ref());
assert_eq!(bufs[1].deref(), [3; 8].as_ref());
```
Methods from [Deref](../ops/trait.deref "trait std::ops::Deref")<Target = [[u8](../primitive.u8)]>
--------------------------------------------------------------------------------------------------
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#4068)#### pub fn flatten(&self) -> &[T]
Notable traits for &[[u8](../primitive.u8)]
```
impl Read for &[u8]
impl Write for &mut [u8]
```
🔬This is a nightly-only experimental API. (`slice_flatten` [#95629](https://github.com/rust-lang/rust/issues/95629))
Takes a `&[[T; N]]`, and flattens it to a `&[T]`.
##### Panics
This panics if the length of the resulting slice would overflow a `usize`.
This is only possible when flattening a slice of arrays of zero-sized types, and thus tends to be irrelevant in practice. If `size_of::<T>() > 0`, this will never panic.
##### Examples
```
#![feature(slice_flatten)]
assert_eq!([[1, 2, 3], [4, 5, 6]].flatten(), &[1, 2, 3, 4, 5, 6]);
assert_eq!(
[[1, 2, 3], [4, 5, 6]].flatten(),
[[1, 2], [3, 4], [5, 6]].flatten(),
);
let slice_of_empty_arrays: &[[i32; 0]] = &[[], [], [], [], []];
assert!(slice_of_empty_arrays.flatten().is_empty());
let empty_slice_of_arrays: &[[u32; 10]] = &[];
assert!(empty_slice_of_arrays.flatten().is_empty());
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#129)1.0.0 · #### pub fn len(&self) -> usize
Returns the number of elements in the slice.
##### Examples
```
let a = [1, 2, 3];
assert_eq!(a.len(), 3);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#152)1.0.0 · #### pub fn is\_empty(&self) -> bool
Returns `true` if the slice has a length of 0.
##### Examples
```
let a = [1, 2, 3];
assert!(!a.is_empty());
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#171)1.0.0 · #### pub fn first(&self) -> Option<&T>
Returns the first element of the slice, or `None` if it is empty.
##### Examples
```
let v = [10, 40, 30];
assert_eq!(Some(&10), v.first());
let w: &[i32] = &[];
assert_eq!(None, w.first());
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#211)1.5.0 · #### pub fn split\_first(&self) -> Option<(&T, &[T])>
Returns the first and all the rest of the elements of the slice, or `None` if it is empty.
##### Examples
```
let x = &[0, 1, 2];
if let Some((first, elements)) = x.split_first() {
assert_eq!(first, &0);
assert_eq!(elements, &[1, 2]);
}
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#253)1.5.0 · #### pub fn split\_last(&self) -> Option<(&T, &[T])>
Returns the last and all the rest of the elements of the slice, or `None` if it is empty.
##### Examples
```
let x = &[0, 1, 2];
if let Some((last, elements)) = x.split_last() {
assert_eq!(last, &2);
assert_eq!(elements, &[0, 1]);
}
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#294)1.0.0 · #### pub fn last(&self) -> Option<&T>
Returns the last element of the slice, or `None` if it is empty.
##### Examples
```
let v = [10, 40, 30];
assert_eq!(Some(&30), v.last());
let w: &[i32] = &[];
assert_eq!(None, w.last());
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#339-341)1.0.0 · #### pub fn get<I>(&self, index: I) -> Option<&<I as SliceIndex<[T]>>::Output>where I: [SliceIndex](../slice/trait.sliceindex "trait std::slice::SliceIndex")<[[T]](../primitive.slice)>,
Returns a reference to an element or subslice depending on the type of index.
* If given a position, returns a reference to the element at that position or `None` if out of bounds.
* If given a range, returns the subslice corresponding to that range, or `None` if out of bounds.
##### Examples
```
let v = [10, 40, 30];
assert_eq!(Some(&40), v.get(1));
assert_eq!(Some(&[10, 40][..]), v.get(0..2));
assert_eq!(None, v.get(3));
assert_eq!(None, v.get(0..4));
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#398-400)1.0.0 · #### pub unsafe fn get\_unchecked<I>( &self, index: I) -> &<I as SliceIndex<[T]>>::Outputwhere I: [SliceIndex](../slice/trait.sliceindex "trait std::slice::SliceIndex")<[[T]](../primitive.slice)>,
Returns a reference to an element or subslice, without doing bounds checking.
For a safe alternative see [`get`](../primitive.slice#method.get).
##### Safety
Calling this method with an out-of-bounds index is *[undefined behavior](../../reference/behavior-considered-undefined)* even if the resulting reference is not used.
##### Examples
```
let x = &[1, 2, 4];
unsafe {
assert_eq!(x.get_unchecked(1), &2);
}
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#476)1.0.0 · #### pub fn as\_ptr(&self) -> \*const T
Returns a raw pointer to the slice’s buffer.
The caller must ensure that the slice outlives the pointer this function returns, or else it will end up pointing to garbage.
The caller must also ensure that the memory the pointer (non-transitively) points to is never written to (except inside an `UnsafeCell`) using this pointer or any pointer derived from it. If you need to mutate the contents of the slice, use [`as_mut_ptr`](../primitive.slice#method.as_mut_ptr).
Modifying the container referenced by this slice may cause its buffer to be reallocated, which would also make any pointers to it invalid.
##### Examples
```
let x = &[1, 2, 4];
let x_ptr = x.as_ptr();
unsafe {
for i in 0..x.len() {
assert_eq!(x.get_unchecked(i), &*x_ptr.add(i));
}
}
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#542)1.48.0 · #### pub fn as\_ptr\_range(&self) -> Range<\*const T>
Notable traits for [Range](../ops/struct.range "struct std::ops::Range")<A>
```
impl<A> Iterator for Range<A>where
A: Step,
type Item = A;
```
Returns the two raw pointers spanning the slice.
The returned range is half-open, which means that the end pointer points *one past* the last element of the slice. This way, an empty slice is represented by two equal pointers, and the difference between the two pointers represents the size of the slice.
See [`as_ptr`](../primitive.slice#method.as_ptr) for warnings on using these pointers. The end pointer requires extra caution, as it does not point to a valid element in the slice.
This function is useful for interacting with foreign interfaces which use two pointers to refer to a range of elements in memory, as is common in C++.
It can also be useful to check if a pointer to an element refers to an element of this slice:
```
let a = [1, 2, 3];
let x = &a[1] as *const _;
let y = &5 as *const _;
assert!(a.as_ptr_range().contains(&x));
assert!(!a.as_ptr_range().contains(&y));
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#738)1.0.0 · #### pub fn iter(&self) -> Iter<'\_, T>
Notable traits for [Iter](../slice/struct.iter "struct std::slice::Iter")<'a, T>
```
impl<'a, T> Iterator for Iter<'a, T>
type Item = &'a T;
```
Returns an iterator over the slice.
The iterator yields all items from start to end.
##### Examples
```
let x = &[1, 2, 4];
let mut iterator = x.iter();
assert_eq!(iterator.next(), Some(&1));
assert_eq!(iterator.next(), Some(&2));
assert_eq!(iterator.next(), Some(&4));
assert_eq!(iterator.next(), None);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#789)1.0.0 · #### pub fn windows(&self, size: usize) -> Windows<'\_, T>
Notable traits for [Windows](../slice/struct.windows "struct std::slice::Windows")<'a, T>
```
impl<'a, T> Iterator for Windows<'a, T>
type Item = &'a [T];
```
Returns an iterator over all contiguous windows of length `size`. The windows overlap. If the slice is shorter than `size`, the iterator returns no values.
##### Panics
Panics if `size` is 0.
##### Examples
```
let slice = ['r', 'u', 's', 't'];
let mut iter = slice.windows(2);
assert_eq!(iter.next().unwrap(), &['r', 'u']);
assert_eq!(iter.next().unwrap(), &['u', 's']);
assert_eq!(iter.next().unwrap(), &['s', 't']);
assert!(iter.next().is_none());
```
If the slice is shorter than `size`:
```
let slice = ['f', 'o', 'o'];
let mut iter = slice.windows(4);
assert!(iter.next().is_none());
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#823)1.0.0 · #### pub fn chunks(&self, chunk\_size: usize) -> Chunks<'\_, T>
Notable traits for [Chunks](../slice/struct.chunks "struct std::slice::Chunks")<'a, T>
```
impl<'a, T> Iterator for Chunks<'a, T>
type Item = &'a [T];
```
Returns an iterator over `chunk_size` elements of the slice at a time, starting at the beginning of the slice.
The chunks are slices and do not overlap. If `chunk_size` does not divide the length of the slice, then the last chunk will not have length `chunk_size`.
See [`chunks_exact`](../primitive.slice#method.chunks_exact) for a variant of this iterator that returns chunks of always exactly `chunk_size` elements, and [`rchunks`](../primitive.slice#method.rchunks) for the same iterator but starting at the end of the slice.
##### Panics
Panics if `chunk_size` is 0.
##### Examples
```
let slice = ['l', 'o', 'r', 'e', 'm'];
let mut iter = slice.chunks(2);
assert_eq!(iter.next().unwrap(), &['l', 'o']);
assert_eq!(iter.next().unwrap(), &['r', 'e']);
assert_eq!(iter.next().unwrap(), &['m']);
assert!(iter.next().is_none());
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#898)1.31.0 · #### pub fn chunks\_exact(&self, chunk\_size: usize) -> ChunksExact<'\_, T>
Notable traits for [ChunksExact](../slice/struct.chunksexact "struct std::slice::ChunksExact")<'a, T>
```
impl<'a, T> Iterator for ChunksExact<'a, T>
type Item = &'a [T];
```
Returns an iterator over `chunk_size` elements of the slice at a time, starting at the beginning of the slice.
The chunks are slices and do not overlap. If `chunk_size` does not divide the length of the slice, then the last up to `chunk_size-1` elements will be omitted and can be retrieved from the `remainder` function of the iterator.
Due to each chunk having exactly `chunk_size` elements, the compiler can often optimize the resulting code better than in the case of [`chunks`](../primitive.slice#method.chunks).
See [`chunks`](../primitive.slice#method.chunks) for a variant of this iterator that also returns the remainder as a smaller chunk, and [`rchunks_exact`](../primitive.slice#method.rchunks_exact) for the same iterator but starting at the end of the slice.
##### Panics
Panics if `chunk_size` is 0.
##### Examples
```
let slice = ['l', 'o', 'r', 'e', 'm'];
let mut iter = slice.chunks_exact(2);
assert_eq!(iter.next().unwrap(), &['l', 'o']);
assert_eq!(iter.next().unwrap(), &['r', 'e']);
assert!(iter.next().is_none());
assert_eq!(iter.remainder(), &['m']);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#975)#### pub unsafe fn as\_chunks\_unchecked<const N: usize>(&self) -> &[[T; N]]
🔬This is a nightly-only experimental API. (`slice_as_chunks` [#74985](https://github.com/rust-lang/rust/issues/74985))
Splits the slice into a slice of `N`-element arrays, assuming that there’s no remainder.
##### Safety
This may only be called when
* The slice splits exactly into `N`-element chunks (aka `self.len() % N == 0`).
* `N != 0`.
##### Examples
```
#![feature(slice_as_chunks)]
let slice: &[char] = &['l', 'o', 'r', 'e', 'm', '!'];
let chunks: &[[char; 1]] =
// SAFETY: 1-element chunks never have remainder
unsafe { slice.as_chunks_unchecked() };
assert_eq!(chunks, &[['l'], ['o'], ['r'], ['e'], ['m'], ['!']]);
let chunks: &[[char; 3]] =
// SAFETY: The slice length (6) is a multiple of 3
unsafe { slice.as_chunks_unchecked() };
assert_eq!(chunks, &[['l', 'o', 'r'], ['e', 'm', '!']]);
// These would be unsound:
// let chunks: &[[_; 5]] = slice.as_chunks_unchecked() // The slice length is not a multiple of 5
// let chunks: &[[_; 0]] = slice.as_chunks_unchecked() // Zero-length chunks are never allowed
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#1008)#### pub fn as\_chunks<const N: usize>(&self) -> (&[[T; N]], &[T])
🔬This is a nightly-only experimental API. (`slice_as_chunks` [#74985](https://github.com/rust-lang/rust/issues/74985))
Splits the slice into a slice of `N`-element arrays, starting at the beginning of the slice, and a remainder slice with length strictly less than `N`.
##### Panics
Panics if `N` is 0. This check will most probably get changed to a compile time error before this method gets stabilized.
##### Examples
```
#![feature(slice_as_chunks)]
let slice = ['l', 'o', 'r', 'e', 'm'];
let (chunks, remainder) = slice.as_chunks();
assert_eq!(chunks, &[['l', 'o'], ['r', 'e']]);
assert_eq!(remainder, &['m']);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#1039)#### pub fn as\_rchunks<const N: usize>(&self) -> (&[T], &[[T; N]])
🔬This is a nightly-only experimental API. (`slice_as_chunks` [#74985](https://github.com/rust-lang/rust/issues/74985))
Splits the slice into a slice of `N`-element arrays, starting at the end of the slice, and a remainder slice with length strictly less than `N`.
##### Panics
Panics if `N` is 0. This check will most probably get changed to a compile time error before this method gets stabilized.
##### Examples
```
#![feature(slice_as_chunks)]
let slice = ['l', 'o', 'r', 'e', 'm'];
let (remainder, chunks) = slice.as_rchunks();
assert_eq!(remainder, &['l']);
assert_eq!(chunks, &[['o', 'r'], ['e', 'm']]);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#1078)#### pub fn array\_chunks<const N: usize>(&self) -> ArrayChunks<'\_, T, N>
Notable traits for [ArrayChunks](../slice/struct.arraychunks "struct std::slice::ArrayChunks")<'a, T, N>
```
impl<'a, T, const N: usize> Iterator for ArrayChunks<'a, T, N>
type Item = &'a [T; N];
```
🔬This is a nightly-only experimental API. (`array_chunks` [#74985](https://github.com/rust-lang/rust/issues/74985))
Returns an iterator over `N` elements of the slice at a time, starting at the beginning of the slice.
The chunks are array references and do not overlap. If `N` does not divide the length of the slice, then the last up to `N-1` elements will be omitted and can be retrieved from the `remainder` function of the iterator.
This method is the const generic equivalent of [`chunks_exact`](../primitive.slice#method.chunks_exact).
##### Panics
Panics if `N` is 0. This check will most probably get changed to a compile time error before this method gets stabilized.
##### Examples
```
#![feature(array_chunks)]
let slice = ['l', 'o', 'r', 'e', 'm'];
let mut iter = slice.array_chunks();
assert_eq!(iter.next().unwrap(), &['l', 'o']);
assert_eq!(iter.next().unwrap(), &['r', 'e']);
assert!(iter.next().is_none());
assert_eq!(iter.remainder(), &['m']);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#1264)#### pub fn array\_windows<const N: usize>(&self) -> ArrayWindows<'\_, T, N>
Notable traits for [ArrayWindows](../slice/struct.arraywindows "struct std::slice::ArrayWindows")<'a, T, N>
```
impl<'a, T, const N: usize> Iterator for ArrayWindows<'a, T, N>
type Item = &'a [T; N];
```
🔬This is a nightly-only experimental API. (`array_windows` [#75027](https://github.com/rust-lang/rust/issues/75027))
Returns an iterator over overlapping windows of `N` elements of a slice, starting at the beginning of the slice.
This is the const generic equivalent of [`windows`](../primitive.slice#method.windows).
If `N` is greater than the size of the slice, it will return no windows.
##### Panics
Panics if `N` is 0. This check will most probably get changed to a compile time error before this method gets stabilized.
##### Examples
```
#![feature(array_windows)]
let slice = [0, 1, 2, 3];
let mut iter = slice.array_windows();
assert_eq!(iter.next().unwrap(), &[0, 1]);
assert_eq!(iter.next().unwrap(), &[1, 2]);
assert_eq!(iter.next().unwrap(), &[2, 3]);
assert!(iter.next().is_none());
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#1298)1.31.0 · #### pub fn rchunks(&self, chunk\_size: usize) -> RChunks<'\_, T>
Notable traits for [RChunks](../slice/struct.rchunks "struct std::slice::RChunks")<'a, T>
```
impl<'a, T> Iterator for RChunks<'a, T>
type Item = &'a [T];
```
Returns an iterator over `chunk_size` elements of the slice at a time, starting at the end of the slice.
The chunks are slices and do not overlap. If `chunk_size` does not divide the length of the slice, then the last chunk will not have length `chunk_size`.
See [`rchunks_exact`](../primitive.slice#method.rchunks_exact) for a variant of this iterator that returns chunks of always exactly `chunk_size` elements, and [`chunks`](../primitive.slice#method.chunks) for the same iterator but starting at the beginning of the slice.
##### Panics
Panics if `chunk_size` is 0.
##### Examples
```
let slice = ['l', 'o', 'r', 'e', 'm'];
let mut iter = slice.rchunks(2);
assert_eq!(iter.next().unwrap(), &['e', 'm']);
assert_eq!(iter.next().unwrap(), &['o', 'r']);
assert_eq!(iter.next().unwrap(), &['l']);
assert!(iter.next().is_none());
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#1375)1.31.0 · #### pub fn rchunks\_exact(&self, chunk\_size: usize) -> RChunksExact<'\_, T>
Notable traits for [RChunksExact](../slice/struct.rchunksexact "struct std::slice::RChunksExact")<'a, T>
```
impl<'a, T> Iterator for RChunksExact<'a, T>
type Item = &'a [T];
```
Returns an iterator over `chunk_size` elements of the slice at a time, starting at the end of the slice.
The chunks are slices and do not overlap. If `chunk_size` does not divide the length of the slice, then the last up to `chunk_size-1` elements will be omitted and can be retrieved from the `remainder` function of the iterator.
Due to each chunk having exactly `chunk_size` elements, the compiler can often optimize the resulting code better than in the case of [`rchunks`](../primitive.slice#method.rchunks).
See [`rchunks`](../primitive.slice#method.rchunks) for a variant of this iterator that also returns the remainder as a smaller chunk, and [`chunks_exact`](../primitive.slice#method.chunks_exact) for the same iterator but starting at the beginning of the slice.
##### Panics
Panics if `chunk_size` is 0.
##### Examples
```
let slice = ['l', 'o', 'r', 'e', 'm'];
let mut iter = slice.rchunks_exact(2);
assert_eq!(iter.next().unwrap(), &['e', 'm']);
assert_eq!(iter.next().unwrap(), &['o', 'r']);
assert!(iter.next().is_none());
assert_eq!(iter.remainder(), &['l']);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#1461-1463)#### pub fn group\_by<F>(&self, pred: F) -> GroupBy<'\_, T, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T, [&](../primitive.reference)T) -> [bool](../primitive.bool),
Notable traits for [GroupBy](../slice/struct.groupby "struct std::slice::GroupBy")<'a, T, P>
```
impl<'a, T, P> Iterator for GroupBy<'a, T, P>where
T: 'a,
P: FnMut(&T, &T) -> bool,
type Item = &'a [T];
```
🔬This is a nightly-only experimental API. (`slice_group_by` [#80552](https://github.com/rust-lang/rust/issues/80552))
Returns an iterator over the slice producing non-overlapping runs of elements using the predicate to separate them.
The predicate is called on two elements following themselves, it means the predicate is called on `slice[0]` and `slice[1]` then on `slice[1]` and `slice[2]` and so on.
##### Examples
```
#![feature(slice_group_by)]
let slice = &[1, 1, 1, 3, 3, 2, 2, 2];
let mut iter = slice.group_by(|a, b| a == b);
assert_eq!(iter.next(), Some(&[1, 1, 1][..]));
assert_eq!(iter.next(), Some(&[3, 3][..]));
assert_eq!(iter.next(), Some(&[2, 2, 2][..]));
assert_eq!(iter.next(), None);
```
This method can be used to extract the sorted subslices:
```
#![feature(slice_group_by)]
let slice = &[1, 1, 2, 3, 2, 3, 2, 3, 4];
let mut iter = slice.group_by(|a, b| a <= b);
assert_eq!(iter.next(), Some(&[1, 1, 2, 3][..]));
assert_eq!(iter.next(), Some(&[2, 3][..]));
assert_eq!(iter.next(), Some(&[2, 3, 4][..]));
assert_eq!(iter.next(), None);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#1551)1.0.0 · #### pub fn split\_at(&self, mid: usize) -> (&[T], &[T])
Divides one slice into two at an index.
The first will contain all indices from `[0, mid)` (excluding the index `mid` itself) and the second will contain all indices from `[mid, len)` (excluding the index `len` itself).
##### Panics
Panics if `mid > len`.
##### Examples
```
let v = [1, 2, 3, 4, 5, 6];
{
let (left, right) = v.split_at(0);
assert_eq!(left, []);
assert_eq!(right, [1, 2, 3, 4, 5, 6]);
}
{
let (left, right) = v.split_at(2);
assert_eq!(left, [1, 2]);
assert_eq!(right, [3, 4, 5, 6]);
}
{
let (left, right) = v.split_at(6);
assert_eq!(left, [1, 2, 3, 4, 5, 6]);
assert_eq!(right, []);
}
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#1636)#### pub unsafe fn split\_at\_unchecked(&self, mid: usize) -> (&[T], &[T])
🔬This is a nightly-only experimental API. (`slice_split_at_unchecked` [#76014](https://github.com/rust-lang/rust/issues/76014))
Divides one slice into two at an index, without doing bounds checking.
The first will contain all indices from `[0, mid)` (excluding the index `mid` itself) and the second will contain all indices from `[mid, len)` (excluding the index `len` itself).
For a safe alternative see [`split_at`](../primitive.slice#method.split_at).
##### Safety
Calling this method with an out-of-bounds index is *[undefined behavior](../../reference/behavior-considered-undefined)* even if the resulting reference is not used. The caller has to ensure that `0 <= mid <= self.len()`.
##### Examples
```
#![feature(slice_split_at_unchecked)]
let v = [1, 2, 3, 4, 5, 6];
unsafe {
let (left, right) = v.split_at_unchecked(0);
assert_eq!(left, []);
assert_eq!(right, [1, 2, 3, 4, 5, 6]);
}
unsafe {
let (left, right) = v.split_at_unchecked(2);
assert_eq!(left, [1, 2]);
assert_eq!(right, [3, 4, 5, 6]);
}
unsafe {
let (left, right) = v.split_at_unchecked(6);
assert_eq!(left, [1, 2, 3, 4, 5, 6]);
assert_eq!(right, []);
}
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#1737)#### pub fn split\_array\_ref<const N: usize>(&self) -> (&[T; N], &[T])
🔬This is a nightly-only experimental API. (`split_array` [#90091](https://github.com/rust-lang/rust/issues/90091))
Divides one slice into an array and a remainder slice at an index.
The array will contain all indices from `[0, N)` (excluding the index `N` itself) and the slice will contain all indices from `[N, len)` (excluding the index `len` itself).
##### Panics
Panics if `N > len`.
##### Examples
```
#![feature(split_array)]
let v = &[1, 2, 3, 4, 5, 6][..];
{
let (left, right) = v.split_array_ref::<0>();
assert_eq!(left, &[]);
assert_eq!(right, [1, 2, 3, 4, 5, 6]);
}
{
let (left, right) = v.split_array_ref::<2>();
assert_eq!(left, &[1, 2]);
assert_eq!(right, [3, 4, 5, 6]);
}
{
let (left, right) = v.split_array_ref::<6>();
assert_eq!(left, &[1, 2, 3, 4, 5, 6]);
assert_eq!(right, []);
}
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#1815)#### pub fn rsplit\_array\_ref<const N: usize>(&self) -> (&[T], &[T; N])
🔬This is a nightly-only experimental API. (`split_array` [#90091](https://github.com/rust-lang/rust/issues/90091))
Divides one slice into an array and a remainder slice at an index from the end.
The slice will contain all indices from `[0, len - N)` (excluding the index `len - N` itself) and the array will contain all indices from `[len - N, len)` (excluding the index `len` itself).
##### Panics
Panics if `N > len`.
##### Examples
```
#![feature(split_array)]
let v = &[1, 2, 3, 4, 5, 6][..];
{
let (left, right) = v.rsplit_array_ref::<0>();
assert_eq!(left, [1, 2, 3, 4, 5, 6]);
assert_eq!(right, &[]);
}
{
let (left, right) = v.rsplit_array_ref::<2>();
assert_eq!(left, [1, 2, 3, 4]);
assert_eq!(right, &[5, 6]);
}
{
let (left, right) = v.rsplit_array_ref::<6>();
assert_eq!(left, []);
assert_eq!(right, &[1, 2, 3, 4, 5, 6]);
}
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#1898-1900)1.0.0 · #### pub fn split<F>(&self, pred: F) -> Split<'\_, T, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
Notable traits for [Split](../slice/struct.split "struct std::slice::Split")<'a, T, P>
```
impl<'a, T, P> Iterator for Split<'a, T, P>where
P: FnMut(&T) -> bool,
type Item = &'a [T];
```
Returns an iterator over subslices separated by elements that match `pred`. The matched element is not contained in the subslices.
##### Examples
```
let slice = [10, 40, 33, 20];
let mut iter = slice.split(|num| num % 3 == 0);
assert_eq!(iter.next().unwrap(), &[10, 40]);
assert_eq!(iter.next().unwrap(), &[20]);
assert!(iter.next().is_none());
```
If the first element is matched, an empty slice will be the first item returned by the iterator. Similarly, if the last element in the slice is matched, an empty slice will be the last item returned by the iterator:
```
let slice = [10, 40, 33];
let mut iter = slice.split(|num| num % 3 == 0);
assert_eq!(iter.next().unwrap(), &[10, 40]);
assert_eq!(iter.next().unwrap(), &[]);
assert!(iter.next().is_none());
```
If two matched elements are directly adjacent, an empty slice will be present between them:
```
let slice = [10, 6, 33, 20];
let mut iter = slice.split(|num| num % 3 == 0);
assert_eq!(iter.next().unwrap(), &[10]);
assert_eq!(iter.next().unwrap(), &[]);
assert_eq!(iter.next().unwrap(), &[20]);
assert!(iter.next().is_none());
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#1956-1958)1.51.0 · #### pub fn split\_inclusive<F>(&self, pred: F) -> SplitInclusive<'\_, T, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
Notable traits for [SplitInclusive](../slice/struct.splitinclusive "struct std::slice::SplitInclusive")<'a, T, P>
```
impl<'a, T, P> Iterator for SplitInclusive<'a, T, P>where
P: FnMut(&T) -> bool,
type Item = &'a [T];
```
Returns an iterator over subslices separated by elements that match `pred`. The matched element is contained in the end of the previous subslice as a terminator.
##### Examples
```
let slice = [10, 40, 33, 20];
let mut iter = slice.split_inclusive(|num| num % 3 == 0);
assert_eq!(iter.next().unwrap(), &[10, 40, 33]);
assert_eq!(iter.next().unwrap(), &[20]);
assert!(iter.next().is_none());
```
If the last element of the slice is matched, that element will be considered the terminator of the preceding slice. That slice will be the last item returned by the iterator.
```
let slice = [3, 10, 40, 33];
let mut iter = slice.split_inclusive(|num| num % 3 == 0);
assert_eq!(iter.next().unwrap(), &[3]);
assert_eq!(iter.next().unwrap(), &[10, 40, 33]);
assert!(iter.next().is_none());
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#2016-2018)1.27.0 · #### pub fn rsplit<F>(&self, pred: F) -> RSplit<'\_, T, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
Notable traits for [RSplit](../slice/struct.rsplit "struct std::slice::RSplit")<'a, T, P>
```
impl<'a, T, P> Iterator for RSplit<'a, T, P>where
P: FnMut(&T) -> bool,
type Item = &'a [T];
```
Returns an iterator over subslices separated by elements that match `pred`, starting at the end of the slice and working backwards. The matched element is not contained in the subslices.
##### Examples
```
let slice = [11, 22, 33, 0, 44, 55];
let mut iter = slice.rsplit(|num| *num == 0);
assert_eq!(iter.next().unwrap(), &[44, 55]);
assert_eq!(iter.next().unwrap(), &[11, 22, 33]);
assert_eq!(iter.next(), None);
```
As with `split()`, if the first or last element is matched, an empty slice will be the first (or last) item returned by the iterator.
```
let v = &[0, 1, 1, 2, 3, 5, 8];
let mut it = v.rsplit(|n| *n % 2 == 0);
assert_eq!(it.next().unwrap(), &[]);
assert_eq!(it.next().unwrap(), &[3, 5]);
assert_eq!(it.next().unwrap(), &[1, 1]);
assert_eq!(it.next().unwrap(), &[]);
assert_eq!(it.next(), None);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#2070-2072)1.0.0 · #### pub fn splitn<F>(&self, n: usize, pred: F) -> SplitN<'\_, T, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
Notable traits for [SplitN](../slice/struct.splitn "struct std::slice::SplitN")<'a, T, P>
```
impl<'a, T, P> Iterator for SplitN<'a, T, P>where
P: FnMut(&T) -> bool,
type Item = &'a [T];
```
Returns an iterator over subslices separated by elements that match `pred`, limited to returning at most `n` items. The matched element is not contained in the subslices.
The last element returned, if any, will contain the remainder of the slice.
##### Examples
Print the slice split once by numbers divisible by 3 (i.e., `[10, 40]`, `[20, 60, 50]`):
```
let v = [10, 40, 30, 20, 60, 50];
for group in v.splitn(2, |num| *num % 3 == 0) {
println!("{group:?}");
}
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#2125-2127)1.0.0 · #### pub fn rsplitn<F>(&self, n: usize, pred: F) -> RSplitN<'\_, T, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
Notable traits for [RSplitN](../slice/struct.rsplitn "struct std::slice::RSplitN")<'a, T, P>
```
impl<'a, T, P> Iterator for RSplitN<'a, T, P>where
P: FnMut(&T) -> bool,
type Item = &'a [T];
```
Returns an iterator over subslices separated by elements that match `pred` limited to returning at most `n` items. This starts at the end of the slice and works backwards. The matched element is not contained in the subslices.
The last element returned, if any, will contain the remainder of the slice.
##### Examples
Print the slice split once, starting from the end, by numbers divisible by 3 (i.e., `[50]`, `[10, 40, 30, 20]`):
```
let v = [10, 40, 30, 20, 60, 50];
for group in v.rsplitn(2, |num| *num % 3 == 0) {
println!("{group:?}");
}
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#2187-2189)1.0.0 · #### pub fn contains(&self, x: &T) -> boolwhere T: [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<T>,
Returns `true` if the slice contains an element with the given value.
This operation is *O*(*n*).
Note that if you have a sorted slice, [`binary_search`](../primitive.slice#method.binary_search) may be faster.
##### Examples
```
let v = [10, 40, 30];
assert!(v.contains(&30));
assert!(!v.contains(&50));
```
If you do not have a `&T`, but some other value that you can compare with one (for example, `String` implements `PartialEq<str>`), you can use `iter().any`:
```
let v = [String::from("hello"), String::from("world")]; // slice of `String`
assert!(v.iter().any(|e| e == "hello")); // search with `&str`
assert!(!v.iter().any(|e| e == "hi"));
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#2216-2218)1.0.0 · #### pub fn starts\_with(&self, needle: &[T]) -> boolwhere T: [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<T>,
Returns `true` if `needle` is a prefix of the slice.
##### Examples
```
let v = [10, 40, 30];
assert!(v.starts_with(&[10]));
assert!(v.starts_with(&[10, 40]));
assert!(!v.starts_with(&[50]));
assert!(!v.starts_with(&[10, 50]));
```
Always returns `true` if `needle` is an empty slice:
```
let v = &[10, 40, 30];
assert!(v.starts_with(&[]));
let v: &[u8] = &[];
assert!(v.starts_with(&[]));
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#2246-2248)1.0.0 · #### pub fn ends\_with(&self, needle: &[T]) -> boolwhere T: [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<T>,
Returns `true` if `needle` is a suffix of the slice.
##### Examples
```
let v = [10, 40, 30];
assert!(v.ends_with(&[30]));
assert!(v.ends_with(&[40, 30]));
assert!(!v.ends_with(&[50]));
assert!(!v.ends_with(&[50, 30]));
```
Always returns `true` if `needle` is an empty slice:
```
let v = &[10, 40, 30];
assert!(v.ends_with(&[]));
let v: &[u8] = &[];
assert!(v.ends_with(&[]));
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#2276-2278)1.51.0 · #### pub fn strip\_prefix<P>(&self, prefix: &P) -> Option<&[T]>where P: [SlicePattern](https://doc.rust-lang.org/core/slice/trait.SlicePattern.html "trait core::slice::SlicePattern")<Item = T> + ?[Sized](../marker/trait.sized "trait std::marker::Sized"), T: [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<T>,
Returns a subslice with the prefix removed.
If the slice starts with `prefix`, returns the subslice after the prefix, wrapped in `Some`. If `prefix` is empty, simply returns the original slice.
If the slice does not start with `prefix`, returns `None`.
##### Examples
```
let v = &[10, 40, 30];
assert_eq!(v.strip_prefix(&[10]), Some(&[40, 30][..]));
assert_eq!(v.strip_prefix(&[10, 40]), Some(&[30][..]));
assert_eq!(v.strip_prefix(&[50]), None);
assert_eq!(v.strip_prefix(&[10, 50]), None);
let prefix : &str = "he";
assert_eq!(b"hello".strip_prefix(prefix.as_bytes()),
Some(b"llo".as_ref()));
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#2310-2312)1.51.0 · #### pub fn strip\_suffix<P>(&self, suffix: &P) -> Option<&[T]>where P: [SlicePattern](https://doc.rust-lang.org/core/slice/trait.SlicePattern.html "trait core::slice::SlicePattern")<Item = T> + ?[Sized](../marker/trait.sized "trait std::marker::Sized"), T: [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<T>,
Returns a subslice with the suffix removed.
If the slice ends with `suffix`, returns the subslice before the suffix, wrapped in `Some`. If `suffix` is empty, simply returns the original slice.
If the slice does not end with `suffix`, returns `None`.
##### Examples
```
let v = &[10, 40, 30];
assert_eq!(v.strip_suffix(&[30]), Some(&[10, 40][..]));
assert_eq!(v.strip_suffix(&[40, 30]), Some(&[10][..]));
assert_eq!(v.strip_suffix(&[50]), None);
assert_eq!(v.strip_suffix(&[50, 30]), None);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#2372-2374)1.0.0 · #### pub fn binary\_search(&self, x: &T) -> Result<usize, usize>where T: [Ord](../cmp/trait.ord "trait std::cmp::Ord"),
Binary searches this slice for a given element. This behaves similarly to [`contains`](../primitive.slice#method.contains) if this slice is sorted.
If the value is found then [`Result::Ok`](../result/enum.result#variant.Ok "Result::Ok") is returned, containing the index of the matching element. If there are multiple matches, then any one of the matches could be returned. The index is chosen deterministically, but is subject to change in future versions of Rust. If the value is not found then [`Result::Err`](../result/enum.result#variant.Err "Result::Err") is returned, containing the index where a matching element could be inserted while maintaining sorted order.
See also [`binary_search_by`](../primitive.slice#method.binary_search_by), [`binary_search_by_key`](../primitive.slice#method.binary_search_by_key), and [`partition_point`](../primitive.slice#method.partition_point).
##### Examples
Looks up a series of four elements. The first is found, with a uniquely determined position; the second and third are not found; the fourth could match any position in `[1, 4]`.
```
let s = [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55];
assert_eq!(s.binary_search(&13), Ok(9));
assert_eq!(s.binary_search(&4), Err(7));
assert_eq!(s.binary_search(&100), Err(13));
let r = s.binary_search(&1);
assert!(match r { Ok(1..=4) => true, _ => false, });
```
If you want to insert an item to a sorted vector, while maintaining sort order, consider using [`partition_point`](../primitive.slice#method.partition_point):
```
let mut s = vec![0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55];
let num = 42;
let idx = s.partition_point(|&x| x < num);
// The above is equivalent to `let idx = s.binary_search(&num).unwrap_or_else(|x| x);`
s.insert(idx, num);
assert_eq!(s, [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 42, 55]);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#2423-2425)1.0.0 · #### pub fn binary\_search\_by<'a, F>(&'a self, f: F) -> Result<usize, usize>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&'a](../primitive.reference) T) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Binary searches this slice with a comparator function. This behaves similarly to [`contains`](../primitive.slice#method.contains) if this slice is sorted.
The comparator function should implement an order consistent with the sort order of the underlying slice, returning an order code that indicates whether its argument is `Less`, `Equal` or `Greater` the desired target.
If the value is found then [`Result::Ok`](../result/enum.result#variant.Ok "Result::Ok") is returned, containing the index of the matching element. If there are multiple matches, then any one of the matches could be returned. The index is chosen deterministically, but is subject to change in future versions of Rust. If the value is not found then [`Result::Err`](../result/enum.result#variant.Err "Result::Err") is returned, containing the index where a matching element could be inserted while maintaining sorted order.
See also [`binary_search`](../primitive.slice#method.binary_search), [`binary_search_by_key`](../primitive.slice#method.binary_search_by_key), and [`partition_point`](../primitive.slice#method.partition_point).
##### Examples
Looks up a series of four elements. The first is found, with a uniquely determined position; the second and third are not found; the fourth could match any position in `[1, 4]`.
```
let s = [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55];
let seek = 13;
assert_eq!(s.binary_search_by(|probe| probe.cmp(&seek)), Ok(9));
let seek = 4;
assert_eq!(s.binary_search_by(|probe| probe.cmp(&seek)), Err(7));
let seek = 100;
assert_eq!(s.binary_search_by(|probe| probe.cmp(&seek)), Err(13));
let seek = 1;
let r = s.binary_search_by(|probe| probe.cmp(&seek));
assert!(match r { Ok(1..=4) => true, _ => false, });
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#2503-2506)1.10.0 · #### pub fn binary\_search\_by\_key<'a, B, F>( &'a self, b: &B, f: F) -> Result<usize, usize>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&'a](../primitive.reference) T) -> B, B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"),
Binary searches this slice with a key extraction function. This behaves similarly to [`contains`](../primitive.slice#method.contains) if this slice is sorted.
Assumes that the slice is sorted by the key, for instance with [`sort_by_key`](../primitive.slice#method.sort_by_key) using the same key extraction function.
If the value is found then [`Result::Ok`](../result/enum.result#variant.Ok "Result::Ok") is returned, containing the index of the matching element. If there are multiple matches, then any one of the matches could be returned. The index is chosen deterministically, but is subject to change in future versions of Rust. If the value is not found then [`Result::Err`](../result/enum.result#variant.Err "Result::Err") is returned, containing the index where a matching element could be inserted while maintaining sorted order.
See also [`binary_search`](../primitive.slice#method.binary_search), [`binary_search_by`](../primitive.slice#method.binary_search_by), and [`partition_point`](../primitive.slice#method.partition_point).
##### Examples
Looks up a series of four elements in a slice of pairs sorted by their second elements. The first is found, with a uniquely determined position; the second and third are not found; the fourth could match any position in `[1, 4]`.
```
let s = [(0, 0), (2, 1), (4, 1), (5, 1), (3, 1),
(1, 2), (2, 3), (4, 5), (5, 8), (3, 13),
(1, 21), (2, 34), (4, 55)];
assert_eq!(s.binary_search_by_key(&13, |&(a, b)| b), Ok(9));
assert_eq!(s.binary_search_by_key(&4, |&(a, b)| b), Err(7));
assert_eq!(s.binary_search_by_key(&100, |&(a, b)| b), Err(13));
let r = s.binary_search_by_key(&1, |&(a, b)| b);
assert!(match r { Ok(1..=4) => true, _ => false, });
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#3460)1.30.0 · #### pub unsafe fn align\_to<U>(&self) -> (&[T], &[U], &[T])
Transmute the slice to a slice of another type, ensuring alignment of the types is maintained.
This method splits the slice into three distinct slices: prefix, correctly aligned middle slice of a new type, and the suffix slice. The method may make the middle slice the greatest length possible for a given type and input slice, but only your algorithm’s performance should depend on that, not its correctness. It is permissible for all of the input data to be returned as the prefix or suffix slice.
This method has no purpose when either input element `T` or output element `U` are zero-sized and will return the original slice without splitting anything.
##### Safety
This method is essentially a `transmute` with respect to the elements in the returned middle slice, so all the usual caveats pertaining to `transmute::<T, U>` also apply here.
##### Examples
Basic usage:
```
unsafe {
let bytes: [u8; 7] = [1, 2, 3, 4, 5, 6, 7];
let (prefix, shorts, suffix) = bytes.align_to::<u16>();
// less_efficient_algorithm_for_bytes(prefix);
// more_efficient_algorithm_for_aligned_shorts(shorts);
// less_efficient_algorithm_for_bytes(suffix);
}
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#3616-3620)#### pub fn as\_simd<const LANES: usize>(&self) -> (&[T], &[Simd<T, LANES>], &[T])where T: [SimdElement](../simd/trait.simdelement "trait std::simd::SimdElement"), [Simd](../simd/struct.simd "struct std::simd::Simd")<T, LANES>: [AsRef](../convert/trait.asref "trait std::convert::AsRef")<[[](../primitive.array)T[; LANES]](../primitive.array)>, [LaneCount](../simd/struct.lanecount "struct std::simd::LaneCount")<LANES>: [SupportedLaneCount](../simd/trait.supportedlanecount "trait std::simd::SupportedLaneCount"),
🔬This is a nightly-only experimental API. (`portable_simd` [#86656](https://github.com/rust-lang/rust/issues/86656))
Split a slice into a prefix, a middle of aligned SIMD types, and a suffix.
This is a safe wrapper around [`slice::align_to`](../primitive.slice#method.align_to "slice::align_to"), so has the same weak postconditions as that method. You’re only assured that `self.len() == prefix.len() + middle.len() * LANES + suffix.len()`.
Notably, all of the following are possible:
* `prefix.len() >= LANES`.
* `middle.is_empty()` despite `self.len() >= 3 * LANES`.
* `suffix.len() >= LANES`.
That said, this is a safe method, so if you’re only writing safe code, then this can at most cause incorrect logic, not unsoundness.
##### Panics
This will panic if the size of the SIMD type is different from `LANES` times that of the scalar.
At the time of writing, the trait restrictions on `Simd<T, LANES>` keeps that from ever happening, as only power-of-two numbers of lanes are supported. It’s possible that, in the future, those restrictions might be lifted in a way that would make it possible to see panics from this method for something like `LANES == 3`.
##### Examples
```
#![feature(portable_simd)]
use core::simd::SimdFloat;
let short = &[1, 2, 3];
let (prefix, middle, suffix) = short.as_simd::<4>();
assert_eq!(middle, []); // Not enough elements for anything in the middle
// They might be split in any possible way between prefix and suffix
let it = prefix.iter().chain(suffix).copied();
assert_eq!(it.collect::<Vec<_>>(), vec![1, 2, 3]);
fn basic_simd_sum(x: &[f32]) -> f32 {
use std::ops::Add;
use std::simd::f32x4;
let (prefix, middle, suffix) = x.as_simd();
let sums = f32x4::from_array([
prefix.iter().copied().sum(),
0.0,
0.0,
suffix.iter().copied().sum(),
]);
let sums = middle.iter().copied().fold(sums, f32x4::add);
sums.reduce_sum()
}
let numbers: Vec<f32> = (1..101).map(|x| x as _).collect();
assert_eq!(basic_simd_sum(&numbers[1..99]), 4949.0);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#3700-3702)#### pub fn is\_sorted(&self) -> boolwhere T: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<T>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this slice are sorted.
That is, for each element `a` and its following element `b`, `a <= b` must hold. If the slice yields exactly zero or one element, `true` is returned.
Note that if `Self::Item` is only `PartialOrd`, but not `Ord`, the above definition implies that this function returns `false` if any two consecutive items are not comparable.
##### Examples
```
#![feature(is_sorted)]
let empty: [i32; 0] = [];
assert!([1, 2, 2, 9].is_sorted());
assert!(![1, 3, 2, 4].is_sorted());
assert!([0].is_sorted());
assert!(empty.is_sorted());
assert!(![0.0, 1.0, f32::NAN].is_sorted());
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#3716-3718)#### pub fn is\_sorted\_by<F>(&self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T, [&](../primitive.reference)T) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this slice are sorted using the given comparator function.
Instead of using `PartialOrd::partial_cmp`, this function uses the given `compare` function to determine the ordering of two elements. Apart from that, it’s equivalent to [`is_sorted`](../primitive.slice#method.is_sorted); see its documentation for more information.
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#3742-3745)#### pub fn is\_sorted\_by\_key<F, K>(&self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this slice are sorted using the given key extraction function.
Instead of comparing the slice’s elements directly, this function compares the keys of the elements, as determined by `f`. Apart from that, it’s equivalent to [`is_sorted`](../primitive.slice#method.is_sorted); see its documentation for more information.
##### Examples
```
#![feature(is_sorted)]
assert!(["c", "bb", "aaa"].is_sorted_by_key(|s| s.len()));
assert!(![-2i32, -1, 0, 3].is_sorted_by_key(|n| n.abs()));
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#3791-3793)1.52.0 · #### pub fn partition\_point<P>(&self, pred: P) -> usizewhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
Returns the index of the partition point according to the given predicate (the index of the first element of the second partition).
The slice is assumed to be partitioned according to the given predicate. This means that all elements for which the predicate returns true are at the start of the slice and all elements for which the predicate returns false are at the end. For example, [7, 15, 3, 5, 4, 12, 6] is a partitioned under the predicate x % 2 != 0 (all odd numbers are at the start, all even at the end).
If this slice is not partitioned, the returned result is unspecified and meaningless, as this method performs a kind of binary search.
See also [`binary_search`](../primitive.slice#method.binary_search), [`binary_search_by`](../primitive.slice#method.binary_search_by), and [`binary_search_by_key`](../primitive.slice#method.binary_search_by_key).
##### Examples
```
let v = [1, 2, 3, 3, 5, 6, 7];
let i = v.partition_point(|&x| x < 5);
assert_eq!(i, 4);
assert!(v[..i].iter().all(|&x| x < 5));
assert!(v[i..].iter().all(|&x| !(x < 5)));
```
If you want to insert an item to a sorted vector, while maintaining sort order:
```
let mut s = vec![0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55];
let num = 42;
let idx = s.partition_point(|&x| x < num);
s.insert(idx, num);
assert_eq!(s, [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 42, 55]);
```
[source](https://doc.rust-lang.org/src/core/slice/ascii.rs.html#15)1.23.0 · #### pub fn is\_ascii(&self) -> bool
Checks if all bytes in this slice are within the ASCII range.
[source](https://doc.rust-lang.org/src/core/slice/ascii.rs.html#26)1.23.0 · #### pub fn eq\_ignore\_ascii\_case(&self, other: &[u8]) -> bool
Checks that two slices are an ASCII case-insensitive match.
Same as `to_ascii_lowercase(a) == to_ascii_lowercase(b)`, but without allocating and copying temporaries.
[source](https://doc.rust-lang.org/src/core/slice/ascii.rs.html#78)1.60.0 · #### pub fn escape\_ascii(&self) -> EscapeAscii<'\_>
Notable traits for [EscapeAscii](../slice/struct.escapeascii "struct std::slice::EscapeAscii")<'a>
```
impl<'a> Iterator for EscapeAscii<'a>
type Item = u8;
```
Returns an iterator that produces an escaped version of this slice, treating it as an ASCII string.
##### Examples
```
let s = b"0\t\r\n'\"\\\x9d";
let escaped = s.escape_ascii().to_string();
assert_eq!(escaped, "0\\t\\r\\n\\'\\\"\\\\\\x9d");
```
[source](https://doc.rust-lang.org/src/core/slice/ascii.rs.html#97)#### pub fn trim\_ascii\_start(&self) -> &[u8]
Notable traits for &[[u8](../primitive.u8)]
```
impl Read for &[u8]
impl Write for &mut [u8]
```
🔬This is a nightly-only experimental API. (`byte_slice_trim_ascii` [#94035](https://github.com/rust-lang/rust/issues/94035))
Returns a byte slice with leading ASCII whitespace bytes removed.
‘Whitespace’ refers to the definition used by `u8::is_ascii_whitespace`.
##### Examples
```
#![feature(byte_slice_trim_ascii)]
assert_eq!(b" \t hello world\n".trim_ascii_start(), b"hello world\n");
assert_eq!(b" ".trim_ascii_start(), b"");
assert_eq!(b"".trim_ascii_start(), b"");
```
[source](https://doc.rust-lang.org/src/core/slice/ascii.rs.html#126)#### pub fn trim\_ascii\_end(&self) -> &[u8]
Notable traits for &[[u8](../primitive.u8)]
```
impl Read for &[u8]
impl Write for &mut [u8]
```
🔬This is a nightly-only experimental API. (`byte_slice_trim_ascii` [#94035](https://github.com/rust-lang/rust/issues/94035))
Returns a byte slice with trailing ASCII whitespace bytes removed.
‘Whitespace’ refers to the definition used by `u8::is_ascii_whitespace`.
##### Examples
```
#![feature(byte_slice_trim_ascii)]
assert_eq!(b"\r hello world\n ".trim_ascii_end(), b"\r hello world");
assert_eq!(b" ".trim_ascii_end(), b"");
assert_eq!(b"".trim_ascii_end(), b"");
```
[source](https://doc.rust-lang.org/src/core/slice/ascii.rs.html#156)#### pub fn trim\_ascii(&self) -> &[u8]
Notable traits for &[[u8](../primitive.u8)]
```
impl Read for &[u8]
impl Write for &mut [u8]
```
🔬This is a nightly-only experimental API. (`byte_slice_trim_ascii` [#94035](https://github.com/rust-lang/rust/issues/94035))
Returns a byte slice with leading and trailing ASCII whitespace bytes removed.
‘Whitespace’ refers to the definition used by `u8::is_ascii_whitespace`.
##### Examples
```
#![feature(byte_slice_trim_ascii)]
assert_eq!(b"\r hello world\n ".trim_ascii(), b"hello world");
assert_eq!(b" ".trim_ascii(), b"");
assert_eq!(b"".trim_ascii(), b"");
```
[source](https://doc.rust-lang.org/src/alloc/slice.rs.html#618)1.23.0 · #### pub fn to\_ascii\_uppercase(&self) -> Vec<u8, Global>
Notable traits for [Vec](../vec/struct.vec "struct std::vec::Vec")<[u8](../primitive.u8), A>
```
impl<A: Allocator> Write for Vec<u8, A>
```
Returns a vector containing a copy of this slice where each byte is mapped to its ASCII upper case equivalent.
ASCII letters ‘a’ to ‘z’ are mapped to ‘A’ to ‘Z’, but non-ASCII letters are unchanged.
To uppercase the value in-place, use [`make_ascii_uppercase`](../primitive.slice#method.make_ascii_uppercase).
[source](https://doc.rust-lang.org/src/alloc/slice.rs.html#639)1.23.0 · #### pub fn to\_ascii\_lowercase(&self) -> Vec<u8, Global>
Notable traits for [Vec](../vec/struct.vec "struct std::vec::Vec")<[u8](../primitive.u8), A>
```
impl<A: Allocator> Write for Vec<u8, A>
```
Returns a vector containing a copy of this slice where each byte is mapped to its ASCII lower case equivalent.
ASCII letters ‘A’ to ‘Z’ are mapped to ‘a’ to ‘z’, but non-ASCII letters are unchanged.
To lowercase the value in-place, use [`make_ascii_lowercase`](../primitive.slice#method.make_ascii_lowercase).
[source](https://doc.rust-lang.org/src/alloc/slice.rs.html#409-411)1.0.0 · #### pub fn to\_vec(&self) -> Vec<T, Global>where T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
Notable traits for [Vec](../vec/struct.vec "struct std::vec::Vec")<[u8](../primitive.u8), A>
```
impl<A: Allocator> Write for Vec<u8, A>
```
Copies `self` into a new `Vec`.
##### Examples
```
let s = [10, 40, 30];
let x = s.to_vec();
// Here, `s` and `x` can be modified independently.
```
[source](https://doc.rust-lang.org/src/alloc/slice.rs.html#433-435)#### pub fn to\_vec\_in<A>(&self, alloc: A) -> Vec<T, A>where A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator"), T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
Notable traits for [Vec](../vec/struct.vec "struct std::vec::Vec")<[u8](../primitive.u8), A>
```
impl<A: Allocator> Write for Vec<u8, A>
```
🔬This is a nightly-only experimental API. (`allocator_api` [#32838](https://github.com/rust-lang/rust/issues/32838))
Copies `self` into a new `Vec` with an allocator.
##### Examples
```
#![feature(allocator_api)]
use std::alloc::System;
let s = [10, 40, 30];
let x = s.to_vec_in(System);
// Here, `s` and `x` can be modified independently.
```
[source](https://doc.rust-lang.org/src/alloc/slice.rs.html#486-488)1.40.0 · #### pub fn repeat(&self, n: usize) -> Vec<T, Global>where T: [Copy](../marker/trait.copy "trait std::marker::Copy"),
Notable traits for [Vec](../vec/struct.vec "struct std::vec::Vec")<[u8](../primitive.u8), A>
```
impl<A: Allocator> Write for Vec<u8, A>
```
Creates a vector by repeating a slice `n` times.
##### Panics
This function will panic if the capacity would overflow.
##### Examples
Basic usage:
```
assert_eq!([1, 2].repeat(3), vec![1, 2, 1, 2, 1, 2]);
```
A panic upon overflow:
ⓘ
```
// this will panic at runtime
b"0123456789abcdef".repeat(usize::MAX);
```
[source](https://doc.rust-lang.org/src/alloc/slice.rs.html#554-556)1.0.0 · #### pub fn concat<Item>(&self) -> <[T] as Concat<Item>>::Outputwhere Item: ?[Sized](../marker/trait.sized "trait std::marker::Sized"), [[T]](../primitive.slice): [Concat](../slice/trait.concat "trait std::slice::Concat")<Item>,
Notable traits for &[[u8](../primitive.u8)]
```
impl Read for &[u8]
impl Write for &mut [u8]
```
Flattens a slice of `T` into a single value `Self::Output`.
##### Examples
```
assert_eq!(["hello", "world"].concat(), "helloworld");
assert_eq!([[1, 2], [3, 4]].concat(), [1, 2, 3, 4]);
```
[source](https://doc.rust-lang.org/src/alloc/slice.rs.html#573-575)1.3.0 · #### pub fn join<Separator>(&self, sep: Separator) -> <[T] as Join<Separator>>::Outputwhere [[T]](../primitive.slice): [Join](../slice/trait.join "trait std::slice::Join")<Separator>,
Notable traits for &[[u8](../primitive.u8)]
```
impl Read for &[u8]
impl Write for &mut [u8]
```
Flattens a slice of `T` into a single value `Self::Output`, placing a given separator between each.
##### Examples
```
assert_eq!(["hello", "world"].join(" "), "hello world");
assert_eq!([[1, 2], [3, 4]].join(&0), [1, 2, 0, 3, 4]);
assert_eq!([[1, 2], [3, 4]].join(&[0, 0][..]), [1, 2, 0, 0, 3, 4]);
```
[source](https://doc.rust-lang.org/src/alloc/slice.rs.html#593-595)1.0.0 · #### pub fn connect<Separator>( &self, sep: Separator) -> <[T] as Join<Separator>>::Outputwhere [[T]](../primitive.slice): [Join](../slice/trait.join "trait std::slice::Join")<Separator>,
Notable traits for &[[u8](../primitive.u8)]
```
impl Read for &[u8]
impl Write for &mut [u8]
```
👎Deprecated since 1.3.0: renamed to join
Flattens a slice of `T` into a single value `Self::Output`, placing a given separator between each.
##### Examples
```
assert_eq!(["hello", "world"].connect(" "), "hello world");
assert_eq!([[1, 2], [3, 4]].connect(&0), [1, 2, 0, 3, 4]);
```
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1203)### impl<'a> Clone for IoSlice<'a>
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1203)#### fn clone(&self) -> IoSlice<'a>
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)1.0.0 · #### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1214-1218)### impl<'a> Debug for IoSlice<'a>
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1215-1217)#### fn fmt(&self, fmt: &mut Formatter<'\_>) -> Result
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1323-1330)### impl<'a> Deref for IoSlice<'a>
#### type Target = [u8]
The resulting type after dereferencing.
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1327-1329)#### fn deref(&self) -> &[u8]
Notable traits for &[[u8](../primitive.u8)]
```
impl Read for &[u8]
impl Write for &mut [u8]
```
Dereferences the value.
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1203)### impl<'a> Copy for IoSlice<'a>
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1208)1.44.0 · ### impl<'a> Send for IoSlice<'a>
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1211)1.44.0 · ### impl<'a> Sync for IoSlice<'a>
Auto Trait Implementations
--------------------------
### impl<'a> RefUnwindSafe for IoSlice<'a>
### impl<'a> Unpin for IoSlice<'a>
### impl<'a> UnwindSafe for IoSlice<'a>
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Struct std::io::BorrowedBuf Struct std::io::BorrowedBuf
===========================
```
pub struct BorrowedBuf<'data> { /* private fields */ }
```
🔬This is a nightly-only experimental API. (`read_buf` [#78485](https://github.com/rust-lang/rust/issues/78485))
A borrowed byte buffer which is incrementally filled and initialized.
This type is a sort of “double cursor”. It tracks three regions in the buffer: a region at the beginning of the buffer that has been logically filled with data, a region that has been initialized at some point but not yet logically filled, and a region at the end that is fully uninitialized. The filled region is guaranteed to be a subset of the initialized region.
In summary, the contents of the buffer can be visualized as:
```
[ capacity ]
[ filled | unfilled ]
[ initialized | uninitialized ]
```
A `BorrowedBuf` is created around some existing data (or capacity for data) via a unique reference (`&mut`). The `BorrowedBuf` can be configured (e.g., using `clear` or `set_init`), but cannot be directly written. To write into the buffer, use `unfilled` to create a `BorrowedCursor`. The cursor has write-only access to the unfilled portion of the buffer (you can think of it as a write-only iterator).
The lifetime `'data` is a bound on the lifetime of the underlying data.
Implementations
---------------
[source](https://doc.rust-lang.org/src/std/io/readbuf.rs.html#76-137)### impl<'data> BorrowedBuf<'data>
[source](https://doc.rust-lang.org/src/std/io/readbuf.rs.html#79-81)#### pub fn capacity(&self) -> usize
🔬This is a nightly-only experimental API. (`read_buf` [#78485](https://github.com/rust-lang/rust/issues/78485))
Returns the total capacity of the buffer.
[source](https://doc.rust-lang.org/src/std/io/readbuf.rs.html#85-87)#### pub fn len(&self) -> usize
🔬This is a nightly-only experimental API. (`read_buf` [#78485](https://github.com/rust-lang/rust/issues/78485))
Returns the length of the filled part of the buffer.
[source](https://doc.rust-lang.org/src/std/io/readbuf.rs.html#91-93)#### pub fn init\_len(&self) -> usize
🔬This is a nightly-only experimental API. (`read_buf` [#78485](https://github.com/rust-lang/rust/issues/78485))
Returns the length of the initialized part of the buffer.
[source](https://doc.rust-lang.org/src/std/io/readbuf.rs.html#97-100)#### pub fn filled(&self) -> &[u8]
Notable traits for &[[u8](../primitive.u8)]
```
impl Read for &[u8]
impl Write for &mut [u8]
```
🔬This is a nightly-only experimental API. (`read_buf` [#78485](https://github.com/rust-lang/rust/issues/78485))
Returns a shared reference to the filled portion of the buffer.
[source](https://doc.rust-lang.org/src/std/io/readbuf.rs.html#104-113)#### pub fn unfilled<'this>(&'this mut self) -> BorrowedCursor<'this>
Notable traits for [BorrowedCursor](struct.borrowedcursor "struct std::io::BorrowedCursor")<'a>
```
impl<'a> Write for BorrowedCursor<'a>
```
🔬This is a nightly-only experimental API. (`read_buf` [#78485](https://github.com/rust-lang/rust/issues/78485))
Returns a cursor over the unfilled part of the buffer.
[source](https://doc.rust-lang.org/src/std/io/readbuf.rs.html#119-122)#### pub fn clear(&mut self) -> &mut Self
🔬This is a nightly-only experimental API. (`read_buf` [#78485](https://github.com/rust-lang/rust/issues/78485))
Clears the buffer, resetting the filled region to empty.
The number of initialized bytes is not changed, and the contents of the buffer are not modified.
[source](https://doc.rust-lang.org/src/std/io/readbuf.rs.html#133-136)#### pub unsafe fn set\_init(&mut self, n: usize) -> &mut Self
🔬This is a nightly-only experimental API. (`read_buf` [#78485](https://github.com/rust-lang/rust/issues/78485))
Asserts that the first `n` bytes of the buffer are initialized.
`BorrowedBuf` assumes that bytes are never de-initialized, so this method does nothing when called with fewer bytes than are already known to be initialized.
##### Safety
The caller must ensure that the first `n` unfilled bytes of the buffer have already been initialized.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/std/io/readbuf.rs.html#41-49)### impl Debug for BorrowedBuf<'\_>
[source](https://doc.rust-lang.org/src/std/io/readbuf.rs.html#42-48)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/std/io/readbuf.rs.html#69-74)### impl<'data> From<&'data mut [MaybeUninit<u8>]> for BorrowedBuf<'data>
Create a new `BorrowedBuf` from an uninitialized buffer.
Use `set_init` if part of the buffer is known to be already initialized.
[source](https://doc.rust-lang.org/src/std/io/readbuf.rs.html#71-73)#### fn from(buf: &'data mut [MaybeUninit<u8>]) -> BorrowedBuf<'data>
Converts to this type from the input type.
[source](https://doc.rust-lang.org/src/std/io/readbuf.rs.html#52-64)### impl<'data> From<&'data mut [u8]> for BorrowedBuf<'data>
Create a new `BorrowedBuf` from a fully initialized slice.
[source](https://doc.rust-lang.org/src/std/io/readbuf.rs.html#54-63)#### fn from(slice: &'data mut [u8]) -> BorrowedBuf<'data>
Converts to this type from the input type.
Auto Trait Implementations
--------------------------
### impl<'data> RefUnwindSafe for BorrowedBuf<'data>
### impl<'data> Send for BorrowedBuf<'data>
### impl<'data> Sync for BorrowedBuf<'data>
### impl<'data> Unpin for BorrowedBuf<'data>
### impl<'data> !UnwindSafe for BorrowedBuf<'data>
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
rust Struct std::io::Chain Struct std::io::Chain
=====================
```
pub struct Chain<T, U> { /* private fields */ }
```
Adapter to chain together two readers.
This struct is generally created by calling [`chain`](trait.read#method.chain) on a reader. Please see the documentation of [`chain`](trait.read#method.chain) for more details.
Implementations
---------------
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2293-2366)### impl<T, U> Chain<T, U>
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2313-2315)1.20.0 · #### pub fn into\_inner(self) -> (T, U)
Consumes the `Chain`, returning the wrapped readers.
##### Examples
```
use std::io;
use std::io::prelude::*;
use std::fs::File;
fn main() -> io::Result<()> {
let mut foo_file = File::open("foo.txt")?;
let mut bar_file = File::open("bar.txt")?;
let chain = foo_file.chain(bar_file);
let (foo_file, bar_file) = chain.into_inner();
Ok(())
}
```
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2336-2338)1.20.0 · #### pub fn get\_ref(&self) -> (&T, &U)
Gets references to the underlying readers in this `Chain`.
##### Examples
```
use std::io;
use std::io::prelude::*;
use std::fs::File;
fn main() -> io::Result<()> {
let mut foo_file = File::open("foo.txt")?;
let mut bar_file = File::open("bar.txt")?;
let chain = foo_file.chain(bar_file);
let (foo_file, bar_file) = chain.get_ref();
Ok(())
}
```
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2363-2365)1.20.0 · #### pub fn get\_mut(&mut self) -> (&mut T, &mut U)
Gets mutable references to the underlying readers in this `Chain`.
Care should be taken to avoid modifying the internal I/O state of the underlying readers as doing so may corrupt the internal state of this `Chain`.
##### Examples
```
use std::io;
use std::io::prelude::*;
use std::fs::File;
fn main() -> io::Result<()> {
let mut foo_file = File::open("foo.txt")?;
let mut bar_file = File::open("bar.txt")?;
let mut chain = foo_file.chain(bar_file);
let (foo_file, bar_file) = chain.get_mut();
Ok(())
}
```
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2392-2408)1.9.0 · ### impl<T: BufRead, U: BufRead> BufRead for Chain<T, U>
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2393-2403)#### fn fill\_buf(&mut self) -> Result<&[u8]>
Returns the contents of the internal buffer, filling it with more data from the inner reader if it is empty. [Read more](trait.bufread#tymethod.fill_buf)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2405-2407)#### fn consume(&mut self, amt: usize)
Tells this buffer that `amt` bytes have been consumed from the buffer, so they should no longer be returned in calls to `read`. [Read more](trait.bufread#tymethod.consume)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2073-2075)#### fn has\_data\_left(&mut self) -> Result<bool>
🔬This is a nightly-only experimental API. (`buf_read_has_data_left` [#86423](https://github.com/rust-lang/rust/issues/86423))
Check if the underlying `Read` has any data left to be read. [Read more](trait.bufread#method.has_data_left)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2132-2134)#### fn read\_until(&mut self, byte: u8, buf: &mut Vec<u8>) -> Result<usize>
Read all bytes into `buf` until the delimiter `byte` or EOF is reached. [Read more](trait.bufread#method.read_until)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2196-2201)#### fn read\_line(&mut self, buf: &mut String) -> Result<usize>
Read all bytes until a newline (the `0xA` byte) is reached, and append them to the provided buffer. You do not need to clear the buffer before appending. [Read more](trait.bufread#method.read_line)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2234-2239)#### fn split(self, byte: u8) -> Split<Self>where Self: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Notable traits for [Split](struct.split "struct std::io::Split")<B>
```
impl<B: BufRead> Iterator for Split<B>
type Item = Result<Vec<u8>>;
```
Returns an iterator over the contents of this reader split on the byte `byte`. [Read more](trait.bufread#method.split)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2271-2276)#### fn lines(self) -> Lines<Self>where Self: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Notable traits for [Lines](struct.lines "struct std::io::Lines")<B>
```
impl<B: BufRead> Iterator for Lines<B>
type Item = Result<String>;
```
Returns an iterator over the lines of this reader. [Read more](trait.bufread#method.lines)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2286)### impl<T: Debug, U: Debug> Debug for Chain<T, U>
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2286)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2369-2389)### impl<T: Read, U: Read> Read for Chain<T, U>
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2370-2378)#### fn read(&mut self, buf: &mut [u8]) -> Result<usize>
Pull some bytes from this source into the specified buffer, returning how many bytes were read. [Read more](trait.read#tymethod.read)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2380-2388)#### fn read\_vectored(&mut self, bufs: &mut [IoSliceMut<'\_>]) -> Result<usize>
Like `read`, except that it reads into a slice of buffers. [Read more](trait.read#method.read_vectored)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#655-657)#### fn is\_read\_vectored(&self) -> bool
🔬This is a nightly-only experimental API. (`can_vector` [#69941](https://github.com/rust-lang/rust/issues/69941))
Determines if this `Read`er has an efficient `read_vectored` implementation. [Read more](trait.read#method.is_read_vectored)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#706-708)#### fn read\_to\_end(&mut self, buf: &mut Vec<u8>) -> Result<usize>
Read all bytes until EOF in this source, placing them into `buf`. [Read more](trait.read#method.read_to_end)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#749-751)#### fn read\_to\_string(&mut self, buf: &mut String) -> Result<usize>
Read all bytes until EOF in this source, appending them to `buf`. [Read more](trait.read#method.read_to_string)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#804-806)1.6.0 · #### fn read\_exact(&mut self, buf: &mut [u8]) -> Result<()>
Read the exact number of bytes required to fill `buf`. [Read more](trait.read#method.read_exact)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#815-817)#### fn read\_buf(&mut self, buf: BorrowedCursor<'\_>) -> Result<()>
🔬This is a nightly-only experimental API. (`read_buf` [#78485](https://github.com/rust-lang/rust/issues/78485))
Pull some bytes from this source into the specified buffer. [Read more](trait.read#method.read_buf)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#824-839)#### fn read\_buf\_exact(&mut self, cursor: BorrowedCursor<'\_>) -> Result<()>
🔬This is a nightly-only experimental API. (`read_buf` [#78485](https://github.com/rust-lang/rust/issues/78485))
Read the exact number of bytes required to fill `cursor`. [Read more](trait.read#method.read_buf_exact)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#876-881)#### fn by\_ref(&mut self) -> &mut Selfwhere Self: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Creates a “by reference” adaptor for this instance of `Read`. [Read more](trait.read#method.by_ref)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#919-924)#### fn bytes(self) -> Bytes<Self>where Self: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Notable traits for [Bytes](struct.bytes "struct std::io::Bytes")<R>
```
impl<R: Read> Iterator for Bytes<R>
type Item = Result<u8>;
```
Transforms this `Read` instance to an [`Iterator`](../iter/trait.iterator "Iterator") over its bytes. [Read more](trait.read#method.bytes)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#957-962)#### fn chain<R: Read>(self, next: R) -> Chain<Self, R>where Self: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Notable traits for [Chain](struct.chain "struct std::io::Chain")<T, U>
```
impl<T: Read, U: Read> Read for Chain<T, U>
```
Creates an adapter which will chain this stream with another. [Read more](trait.read#method.chain)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#996-1001)#### fn take(self, limit: u64) -> Take<Self>where Self: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Notable traits for [Take](struct.take "struct std::io::Take")<T>
```
impl<T: Read> Read for Take<T>
```
Creates an adapter which will read at most `limit` bytes from it. [Read more](trait.read#method.take)
Auto Trait Implementations
--------------------------
### impl<T, U> RefUnwindSafe for Chain<T, U>where T: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"), U: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<T, U> Send for Chain<T, U>where T: [Send](../marker/trait.send "trait std::marker::Send"), U: [Send](../marker/trait.send "trait std::marker::Send"),
### impl<T, U> Sync for Chain<T, U>where T: [Sync](../marker/trait.sync "trait std::marker::Sync"), U: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<T, U> Unpin for Chain<T, U>where T: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"), U: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"),
### impl<T, U> UnwindSafe for Chain<T, U>where T: [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"), U: [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"),
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Module std::io Module std::io
==============
Traits, helpers, and type definitions for core I/O functionality.
The `std::io` module contains a number of common things you’ll need when doing input and output. The most core part of this module is the [`Read`](trait.read "Read") and [`Write`](trait.write "Write") traits, which provide the most general interface for reading and writing input and output.
Read and Write
--------------
Because they are traits, [`Read`](trait.read "Read") and [`Write`](trait.write "Write") are implemented by a number of other types, and you can implement them for your types too. As such, you’ll see a few different types of I/O throughout the documentation in this module: [`File`](../fs/struct.file)s, [`TcpStream`](../net/struct.tcpstream)s, and sometimes even [`Vec<T>`](../vec/struct.vec "Vec<T>")s. For example, [`Read`](trait.read "Read") adds a [`read`](trait.read#tymethod.read "Read::read") method, which we can use on [`File`](../fs/struct.file)s:
```
use std::io;
use std::io::prelude::*;
use std::fs::File;
fn main() -> io::Result<()> {
let mut f = File::open("foo.txt")?;
let mut buffer = [0; 10];
// read up to 10 bytes
let n = f.read(&mut buffer)?;
println!("The bytes: {:?}", &buffer[..n]);
Ok(())
}
```
[`Read`](trait.read "Read") and [`Write`](trait.write "Write") are so important, implementors of the two traits have a nickname: readers and writers. So you’ll sometimes see ‘a reader’ instead of ‘a type that implements the [`Read`](trait.read "Read") trait’. Much easier!
### Seek and BufRead
Beyond that, there are two important traits that are provided: [`Seek`](trait.seek "Seek") and [`BufRead`](trait.bufread "BufRead"). Both of these build on top of a reader to control how the reading happens. [`Seek`](trait.seek "Seek") lets you control where the next byte is coming from:
```
use std::io;
use std::io::prelude::*;
use std::io::SeekFrom;
use std::fs::File;
fn main() -> io::Result<()> {
let mut f = File::open("foo.txt")?;
let mut buffer = [0; 10];
// skip to the last 10 bytes of the file
f.seek(SeekFrom::End(-10))?;
// read up to 10 bytes
let n = f.read(&mut buffer)?;
println!("The bytes: {:?}", &buffer[..n]);
Ok(())
}
```
[`BufRead`](trait.bufread "BufRead") uses an internal buffer to provide a number of other ways to read, but to show it off, we’ll need to talk about buffers in general. Keep reading!
### BufReader and BufWriter
Byte-based interfaces are unwieldy and can be inefficient, as we’d need to be making near-constant calls to the operating system. To help with this, `std::io` comes with two structs, [`BufReader`](struct.bufreader "BufReader") and [`BufWriter`](struct.bufwriter "BufWriter"), which wrap readers and writers. The wrapper uses a buffer, reducing the number of calls and providing nicer methods for accessing exactly what you want.
For example, [`BufReader`](struct.bufreader "BufReader") works with the [`BufRead`](trait.bufread "BufRead") trait to add extra methods to any reader:
```
use std::io;
use std::io::prelude::*;
use std::io::BufReader;
use std::fs::File;
fn main() -> io::Result<()> {
let f = File::open("foo.txt")?;
let mut reader = BufReader::new(f);
let mut buffer = String::new();
// read a line into buffer
reader.read_line(&mut buffer)?;
println!("{buffer}");
Ok(())
}
```
[`BufWriter`](struct.bufwriter "BufWriter") doesn’t add any new ways of writing; it just buffers every call to [`write`](trait.write#tymethod.write "Write::write"):
```
use std::io;
use std::io::prelude::*;
use std::io::BufWriter;
use std::fs::File;
fn main() -> io::Result<()> {
let f = File::create("foo.txt")?;
{
let mut writer = BufWriter::new(f);
// write a byte to the buffer
writer.write(&[42])?;
} // the buffer is flushed once writer goes out of scope
Ok(())
}
```
### Standard input and output
A very common source of input is standard input:
```
use std::io;
fn main() -> io::Result<()> {
let mut input = String::new();
io::stdin().read_line(&mut input)?;
println!("You typed: {}", input.trim());
Ok(())
}
```
Note that you cannot use the [`?` operator](../../book/appendix-02-operators) in functions that do not return a [`Result<T, E>`](../result/enum.result). Instead, you can call [`.unwrap()`](../result/enum.result#method.unwrap) or `match` on the return value to catch any possible errors:
```
use std::io;
let mut input = String::new();
io::stdin().read_line(&mut input).unwrap();
```
And a very common source of output is standard output:
```
use std::io;
use std::io::prelude::*;
fn main() -> io::Result<()> {
io::stdout().write(&[42])?;
Ok(())
}
```
Of course, using [`io::stdout`](fn.stdout) directly is less common than something like [`println!`](../macro.println "println!").
### Iterator types
A large number of the structures provided by `std::io` are for various ways of iterating over I/O. For example, [`Lines`](struct.lines "Lines") is used to split over lines:
```
use std::io;
use std::io::prelude::*;
use std::io::BufReader;
use std::fs::File;
fn main() -> io::Result<()> {
let f = File::open("foo.txt")?;
let reader = BufReader::new(f);
for line in reader.lines() {
println!("{}", line?);
}
Ok(())
}
```
### Functions
There are a number of [functions](#functions-1) that offer access to various features. For example, we can use three of these functions to copy everything from standard input to standard output:
```
use std::io;
fn main() -> io::Result<()> {
io::copy(&mut io::stdin(), &mut io::stdout())?;
Ok(())
}
```
### io::Result
Last, but certainly not least, is [`io::Result`](type.result). This type is used as the return type of many `std::io` functions that can cause an error, and can be returned from your own functions as well. Many of the examples in this module use the [`?` operator](../../book/appendix-02-operators):
```
use std::io;
fn read_input() -> io::Result<()> {
let mut input = String::new();
io::stdin().read_line(&mut input)?;
println!("You typed: {}", input.trim());
Ok(())
}
```
The return type of `read_input()`, [`io::Result<()>`](type.result), is a very common type for functions which don’t have a ‘real’ return value, but do want to return errors if they happen. In this case, the only purpose of this function is to read the line and print it, so we use `()`.
### Platform-specific behavior
Many I/O functions throughout the standard library are documented to indicate what various library or syscalls they are delegated to. This is done to help applications both understand what’s happening under the hood as well as investigate any possibly unclear semantics. Note, however, that this is informative, not a binding contract. The implementation of many of these functions are subject to change over time and may call fewer or more syscalls/library functions.
Modules
-------
[prelude](prelude/index "std::io::prelude mod")
The I/O Prelude.
Structs
-------
[BorrowedBuf](struct.borrowedbuf "std::io::BorrowedBuf struct")Experimental
A borrowed byte buffer which is incrementally filled and initialized.
[BorrowedCursor](struct.borrowedcursor "std::io::BorrowedCursor struct")Experimental
A writeable view of the unfilled portion of a [`BorrowedBuf`](struct.borrowedbuf).
[BufReader](struct.bufreader "std::io::BufReader struct")
The `BufReader<R>` struct adds buffering to any reader.
[BufWriter](struct.bufwriter "std::io::BufWriter struct")
Wraps a writer and buffers its output.
[Bytes](struct.bytes "std::io::Bytes struct")
An iterator over `u8` values of a reader.
[Chain](struct.chain "std::io::Chain struct")
Adapter to chain together two readers.
[Cursor](struct.cursor "std::io::Cursor struct")
A `Cursor` wraps an in-memory buffer and provides it with a [`Seek`](trait.seek "Seek") implementation.
[Empty](struct.empty "std::io::Empty struct")
A reader which is always at EOF.
[Error](struct.error "std::io::Error struct")
The error type for I/O operations of the [`Read`](trait.read), [`Write`](trait.write), [`Seek`](trait.seek), and associated traits.
[IntoInnerError](struct.intoinnererror "std::io::IntoInnerError struct")
An error returned by [`BufWriter::into_inner`](struct.bufwriter#method.into_inner "BufWriter::into_inner") which combines an error that happened while writing out the buffer, and the buffered writer object which may be used to recover from the condition.
[IoSlice](struct.ioslice "std::io::IoSlice struct")
A buffer type used with `Write::write_vectored`.
[IoSliceMut](struct.ioslicemut "std::io::IoSliceMut struct")
A buffer type used with `Read::read_vectored`.
[LineWriter](struct.linewriter "std::io::LineWriter struct")
Wraps a writer and buffers output to it, flushing whenever a newline (`0x0a`, `'\n'`) is detected.
[Lines](struct.lines "std::io::Lines struct")
An iterator over the lines of an instance of `BufRead`.
[Repeat](struct.repeat "std::io::Repeat struct")
A reader which yields one byte over and over and over and over and over and…
[Sink](struct.sink "std::io::Sink struct")
A writer which will move data into the void.
[Split](struct.split "std::io::Split struct")
An iterator over the contents of an instance of `BufRead` split on a particular byte.
[Stderr](struct.stderr "std::io::Stderr struct")
A handle to the standard error stream of a process.
[StderrLock](struct.stderrlock "std::io::StderrLock struct")
A locked reference to the [`Stderr`](struct.stderr "Stderr") handle.
[Stdin](struct.stdin "std::io::Stdin struct")
A handle to the standard input stream of a process.
[StdinLock](struct.stdinlock "std::io::StdinLock struct")
A locked reference to the [`Stdin`](struct.stdin "Stdin") handle.
[Stdout](struct.stdout "std::io::Stdout struct")
A handle to the global standard output stream of the current process.
[StdoutLock](struct.stdoutlock "std::io::StdoutLock struct")
A locked reference to the [`Stdout`](struct.stdout "Stdout") handle.
[Take](struct.take "std::io::Take struct")
Reader adapter which limits the bytes read from an underlying reader.
[WriterPanicked](struct.writerpanicked "std::io::WriterPanicked struct")
Error returned for the buffered data from `BufWriter::into_parts`, when the underlying writer has previously panicked. Contains the (possibly partly written) buffered data.
Enums
-----
[ErrorKind](enum.errorkind "std::io::ErrorKind enum")
A list specifying general categories of I/O error.
[SeekFrom](enum.seekfrom "std::io::SeekFrom enum")
Enumeration of possible methods to seek within an I/O object.
Traits
------
[BufRead](trait.bufread "std::io::BufRead trait")
A `BufRead` is a type of `Read`er which has an internal buffer, allowing it to perform extra ways of reading.
[Read](trait.read "std::io::Read trait")
The `Read` trait allows for reading bytes from a source.
[Seek](trait.seek "std::io::Seek trait")
The `Seek` trait provides a cursor which can be moved within a stream of bytes.
[Write](trait.write "std::io::Write trait")
A trait for objects which are byte-oriented sinks.
Functions
---------
[copy](fn.copy "std::io::copy fn")
Copies the entire contents of a reader into a writer.
[empty](fn.empty "std::io::empty fn")
Constructs a new handle to an empty reader.
[read\_to\_string](fn.read_to_string "std::io::read_to_string fn")
Read all bytes from a [reader](trait.read "Read") into a new [`String`](../string/struct.string "String").
[repeat](fn.repeat "std::io::repeat fn")
Creates an instance of a reader that infinitely repeats one byte.
[sink](fn.sink "std::io::sink fn")
Creates an instance of a writer which will successfully consume all data.
[stderr](fn.stderr "std::io::stderr fn")
Constructs a new handle to the standard error of the current process.
[stdin](fn.stdin "std::io::stdin fn")
Constructs a new handle to the standard input of the current process.
[stdout](fn.stdout "std::io::stdout fn")
Constructs a new handle to the standard output of the current process.
Type Definitions
----------------
[Result](type.result "std::io::Result type")
A specialized [`Result`](../result/enum.result) type for I/O operations.
rust Enum std::io::ErrorKind Enum std::io::ErrorKind
=======================
```
#[non_exhaustive]
pub enum ErrorKind {
Show 40 variants NotFound,
PermissionDenied,
ConnectionRefused,
ConnectionReset,
HostUnreachable,
NetworkUnreachable,
ConnectionAborted,
NotConnected,
AddrInUse,
AddrNotAvailable,
NetworkDown,
BrokenPipe,
AlreadyExists,
WouldBlock,
NotADirectory,
IsADirectory,
DirectoryNotEmpty,
ReadOnlyFilesystem,
FilesystemLoop,
StaleNetworkFileHandle,
InvalidInput,
InvalidData,
TimedOut,
WriteZero,
StorageFull,
NotSeekable,
FilesystemQuotaExceeded,
FileTooLarge,
ResourceBusy,
ExecutableFileBusy,
Deadlock,
CrossesDevices,
TooManyLinks,
InvalidFilename,
ArgumentListTooLong,
Interrupted,
Unsupported,
UnexpectedEof,
OutOfMemory,
Other,
// some variants omitted
}
```
A list specifying general categories of I/O error.
This list is intended to grow over time and it is not recommended to exhaustively match against it.
It is used with the [`io::Error`](struct.error) type.
Handling errors and matching on `ErrorKind`
-------------------------------------------
In application code, use `match` for the `ErrorKind` values you are expecting; use `_` to match “all other errors”.
In comprehensive and thorough tests that want to verify that a test doesn’t return any known incorrect error kind, you may want to cut-and-paste the current full list of errors from here into your test code, and then match `_` as the correct case. This seems counterintuitive, but it will make your tests more robust. In particular, if you want to verify that your code does produce an unrecognized error kind, the robust solution is to check for all the recognized error kinds and fail in those cases.
Variants (Non-exhaustive)
-------------------------
This enum is marked as non-exhaustiveNon-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.### `NotFound`
An entity was not found, often a file.
### `PermissionDenied`
The operation lacked the necessary privileges to complete.
### `ConnectionRefused`
The connection was refused by the remote server.
### `ConnectionReset`
The connection was reset by the remote server.
### `HostUnreachable`
🔬This is a nightly-only experimental API. (`io_error_more` [#86442](https://github.com/rust-lang/rust/issues/86442))
The remote host is not reachable.
### `NetworkUnreachable`
🔬This is a nightly-only experimental API. (`io_error_more` [#86442](https://github.com/rust-lang/rust/issues/86442))
The network containing the remote host is not reachable.
### `ConnectionAborted`
The connection was aborted (terminated) by the remote server.
### `NotConnected`
The network operation failed because it was not connected yet.
### `AddrInUse`
A socket address could not be bound because the address is already in use elsewhere.
### `AddrNotAvailable`
A nonexistent interface was requested or the requested address was not local.
### `NetworkDown`
🔬This is a nightly-only experimental API. (`io_error_more` [#86442](https://github.com/rust-lang/rust/issues/86442))
The system’s networking is down.
### `BrokenPipe`
The operation failed because a pipe was closed.
### `AlreadyExists`
An entity already exists, often a file.
### `WouldBlock`
The operation needs to block to complete, but the blocking operation was requested to not occur.
### `NotADirectory`
🔬This is a nightly-only experimental API. (`io_error_more` [#86442](https://github.com/rust-lang/rust/issues/86442))
A filesystem object is, unexpectedly, not a directory.
For example, a filesystem path was specified where one of the intermediate directory components was, in fact, a plain file.
### `IsADirectory`
🔬This is a nightly-only experimental API. (`io_error_more` [#86442](https://github.com/rust-lang/rust/issues/86442))
The filesystem object is, unexpectedly, a directory.
A directory was specified when a non-directory was expected.
### `DirectoryNotEmpty`
🔬This is a nightly-only experimental API. (`io_error_more` [#86442](https://github.com/rust-lang/rust/issues/86442))
A non-empty directory was specified where an empty directory was expected.
### `ReadOnlyFilesystem`
🔬This is a nightly-only experimental API. (`io_error_more` [#86442](https://github.com/rust-lang/rust/issues/86442))
The filesystem or storage medium is read-only, but a write operation was attempted.
### `FilesystemLoop`
🔬This is a nightly-only experimental API. (`io_error_more` [#86442](https://github.com/rust-lang/rust/issues/86442))
Loop in the filesystem or IO subsystem; often, too many levels of symbolic links.
There was a loop (or excessively long chain) resolving a filesystem object or file IO object.
On Unix this is usually the result of a symbolic link loop; or, of exceeding the system-specific limit on the depth of symlink traversal.
### `StaleNetworkFileHandle`
🔬This is a nightly-only experimental API. (`io_error_more` [#86442](https://github.com/rust-lang/rust/issues/86442))
Stale network file handle.
With some network filesystems, notably NFS, an open file (or directory) can be invalidated by problems with the network or server.
### `InvalidInput`
A parameter was incorrect.
###
`InvalidData`1.2.0
Data not valid for the operation were encountered.
Unlike [`InvalidInput`](enum.errorkind#variant.InvalidInput), this typically means that the operation parameters were valid, however the error was caused by malformed input data.
For example, a function that reads a file into a string will error with `InvalidData` if the file’s contents are not valid UTF-8.
### `TimedOut`
The I/O operation’s timeout expired, causing it to be canceled.
### `WriteZero`
An error returned when an operation could not be completed because a call to [`write`](trait.write#tymethod.write) returned [`Ok(0)`](../result/enum.result#variant.Ok).
This typically means that an operation could only succeed if it wrote a particular number of bytes but only a smaller number of bytes could be written.
### `StorageFull`
🔬This is a nightly-only experimental API. (`io_error_more` [#86442](https://github.com/rust-lang/rust/issues/86442))
The underlying storage (typically, a filesystem) is full.
This does not include out of quota errors.
### `NotSeekable`
🔬This is a nightly-only experimental API. (`io_error_more` [#86442](https://github.com/rust-lang/rust/issues/86442))
Seek on unseekable file.
Seeking was attempted on an open file handle which is not suitable for seeking - for example, on Unix, a named pipe opened with `File::open`.
### `FilesystemQuotaExceeded`
🔬This is a nightly-only experimental API. (`io_error_more` [#86442](https://github.com/rust-lang/rust/issues/86442))
Filesystem quota was exceeded.
### `FileTooLarge`
🔬This is a nightly-only experimental API. (`io_error_more` [#86442](https://github.com/rust-lang/rust/issues/86442))
File larger than allowed or supported.
This might arise from a hard limit of the underlying filesystem or file access API, or from an administratively imposed resource limitation. Simple disk full, and out of quota, have their own errors.
### `ResourceBusy`
🔬This is a nightly-only experimental API. (`io_error_more` [#86442](https://github.com/rust-lang/rust/issues/86442))
Resource is busy.
### `ExecutableFileBusy`
🔬This is a nightly-only experimental API. (`io_error_more` [#86442](https://github.com/rust-lang/rust/issues/86442))
Executable file is busy.
An attempt was made to write to a file which is also in use as a running program. (Not all operating systems detect this situation.)
### `Deadlock`
🔬This is a nightly-only experimental API. (`io_error_more` [#86442](https://github.com/rust-lang/rust/issues/86442))
Deadlock (avoided).
A file locking operation would result in deadlock. This situation is typically detected, if at all, on a best-effort basis.
### `CrossesDevices`
🔬This is a nightly-only experimental API. (`io_error_more` [#86442](https://github.com/rust-lang/rust/issues/86442))
Cross-device or cross-filesystem (hard) link or rename.
### `TooManyLinks`
🔬This is a nightly-only experimental API. (`io_error_more` [#86442](https://github.com/rust-lang/rust/issues/86442))
Too many (hard) links to the same filesystem object.
The filesystem does not support making so many hardlinks to the same file.
### `InvalidFilename`
🔬This is a nightly-only experimental API. (`io_error_more` [#86442](https://github.com/rust-lang/rust/issues/86442))
A filename was invalid.
This error can also cause if it exceeded the filename length limit.
### `ArgumentListTooLong`
🔬This is a nightly-only experimental API. (`io_error_more` [#86442](https://github.com/rust-lang/rust/issues/86442))
Program argument list too long.
When trying to run an external program, a system or process limit on the size of the arguments would have been exceeded.
### `Interrupted`
This operation was interrupted.
Interrupted operations can typically be retried.
###
`Unsupported`1.53.0
This operation is unsupported on this platform.
This means that the operation can never succeed.
###
`UnexpectedEof`1.6.0
An error returned when an operation could not be completed because an “end of file” was reached prematurely.
This typically means that an operation could only succeed if it read a particular number of bytes but only a smaller number of bytes could be read.
###
`OutOfMemory`1.54.0
An operation could not be completed, because it failed to allocate enough memory.
### `Other`
A custom error that does not fall under any other I/O error kind.
This can be used to construct your own [`Error`](struct.error "Error")s that do not match any [`ErrorKind`](enum.errorkind "ErrorKind").
This [`ErrorKind`](enum.errorkind "ErrorKind") is not used by the standard library.
Errors from the standard library that do not fall under any of the I/O error kinds cannot be `match`ed on, and will only match a wildcard (`_`) pattern. New [`ErrorKind`](enum.errorkind "ErrorKind")s might be added in the future for some of those.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/std/io/error.rs.html#166)### impl Clone for ErrorKind
[source](https://doc.rust-lang.org/src/std/io/error.rs.html#166)#### fn clone(&self) -> ErrorKind
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)#### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/std/io/error.rs.html#166)### impl Debug for ErrorKind
[source](https://doc.rust-lang.org/src/std/io/error.rs.html#166)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/std/io/error.rs.html#439-452)1.60.0 · ### impl Display for ErrorKind
[source](https://doc.rust-lang.org/src/std/io/error.rs.html#449-451)#### fn fmt(&self, fmt: &mut Formatter<'\_>) -> Result
Shows a human-readable description of the `ErrorKind`.
This is similar to `impl Display for Error`, but doesn’t require first converting to Error.
##### Examples
```
use std::io::ErrorKind;
assert_eq!("entity not found", ErrorKind::NotFound.to_string());
```
[source](https://doc.rust-lang.org/src/std/io/error.rs.html#457-475)1.14.0 · ### impl From<ErrorKind> for Error
Intended for use for errors not exposed to the user, where allocating onto the heap (for normal construction via Error::new) is too costly.
[source](https://doc.rust-lang.org/src/std/io/error.rs.html#472-474)#### fn from(kind: ErrorKind) -> Error
Converts an [`ErrorKind`](enum.errorkind "ErrorKind") into an [`Error`](struct.error "Error").
This conversion creates a new error with a simple representation of error kind.
##### Examples
```
use std::io::{Error, ErrorKind};
let not_found = ErrorKind::NotFound;
let error = Error::from(not_found);
assert_eq!("entity not found", format!("{error}"));
```
[source](https://doc.rust-lang.org/src/std/io/error.rs.html#166)### impl Hash for ErrorKind
[source](https://doc.rust-lang.org/src/std/io/error.rs.html#166)#### fn hash<\_\_H: Hasher>(&self, state: &mut \_\_H)
Feeds this value into the given [`Hasher`](../hash/trait.hasher "Hasher"). [Read more](../hash/trait.hash#tymethod.hash)
[source](https://doc.rust-lang.org/src/core/hash/mod.rs.html#237-239)1.3.0 · #### fn hash\_slice<H>(data: &[Self], state: &mut H)where H: [Hasher](../hash/trait.hasher "trait std::hash::Hasher"),
Feeds a slice of this type into the given [`Hasher`](../hash/trait.hasher "Hasher"). [Read more](../hash/trait.hash#method.hash_slice)
[source](https://doc.rust-lang.org/src/std/io/error.rs.html#166)### impl Ord for ErrorKind
[source](https://doc.rust-lang.org/src/std/io/error.rs.html#166)#### fn cmp(&self, other: &ErrorKind) -> Ordering
This method returns an [`Ordering`](../cmp/enum.ordering "Ordering") between `self` and `other`. [Read more](../cmp/trait.ord#tymethod.cmp)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#804-807)1.21.0 · #### fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. [Read more](../cmp/trait.ord#method.max)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#831-834)1.21.0 · #### fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. [Read more](../cmp/trait.ord#method.min)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#863-867)1.50.0 · #### fn clamp(self, min: Self, max: Self) -> Selfwhere Self: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<Self>,
Restrict a value to a certain interval. [Read more](../cmp/trait.ord#method.clamp)
[source](https://doc.rust-lang.org/src/std/io/error.rs.html#166)### impl PartialEq<ErrorKind> for ErrorKind
[source](https://doc.rust-lang.org/src/std/io/error.rs.html#166)#### fn eq(&self, other: &ErrorKind) -> bool
This method tests for `self` and `other` values to be equal, and is used by `==`. [Read more](../cmp/trait.partialeq#tymethod.eq)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#236)#### fn ne(&self, other: &Rhs) -> bool
This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. [Read more](../cmp/trait.partialeq#method.ne)
[source](https://doc.rust-lang.org/src/std/io/error.rs.html#166)### impl PartialOrd<ErrorKind> for ErrorKind
[source](https://doc.rust-lang.org/src/std/io/error.rs.html#166)#### fn partial\_cmp(&self, other: &ErrorKind) -> Option<Ordering>
This method returns an ordering between `self` and `other` values if one exists. [Read more](../cmp/trait.partialord#tymethod.partial_cmp)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1138)#### fn lt(&self, other: &Rhs) -> bool
This method tests less than (for `self` and `other`) and is used by the `<` operator. [Read more](../cmp/trait.partialord#method.lt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1157)#### fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for `self` and `other`) and is used by the `<=` operator. [Read more](../cmp/trait.partialord#method.le)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1175)#### fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for `self` and `other`) and is used by the `>` operator. [Read more](../cmp/trait.partialord#method.gt)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#1194)#### fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for `self` and `other`) and is used by the `>=` operator. [Read more](../cmp/trait.partialord#method.ge)
[source](https://doc.rust-lang.org/src/std/io/error.rs.html#166)### impl Copy for ErrorKind
[source](https://doc.rust-lang.org/src/std/io/error.rs.html#166)### impl Eq for ErrorKind
[source](https://doc.rust-lang.org/src/std/io/error.rs.html#166)### impl StructuralEq for ErrorKind
[source](https://doc.rust-lang.org/src/std/io/error.rs.html#166)### impl StructuralPartialEq for ErrorKind
Auto Trait Implementations
--------------------------
### impl RefUnwindSafe for ErrorKind
### impl Send for ErrorKind
### impl Sync for ErrorKind
### impl Unpin for ErrorKind
### impl UnwindSafe for ErrorKind
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/alloc/string.rs.html#2500)### impl<T> ToString for Twhere T: [Display](../fmt/trait.display "trait std::fmt::Display") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/alloc/string.rs.html#2506)#### default fn to\_string(&self) -> String
Converts the given value to a `String`. [Read more](../string/trait.tostring#tymethod.to_string)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Function std::io::stdin Function std::io::stdin
=======================
```
pub fn stdin() -> StdinⓘNotable traits for Stdinimpl Read for Stdin
```
Constructs a new handle to the standard input of the current process.
Each handle returned is a reference to a shared global buffer whose access is synchronized via a mutex. If you need more explicit control over locking, see the [`Stdin::lock`](struct.stdin#method.lock "Stdin::lock") method.
#### Note: Windows Portability Considerations
When operating in a console, the Windows implementation of this stream does not support non-UTF-8 byte sequences. Attempting to read bytes that are not valid UTF-8 will return an error.
In a process with a detached console, such as one using `#![windows_subsystem = "windows"]`, or in a child process spawned from such a process, the contained handle will be null. In such cases, the standard library’s `Read` and `Write` will do nothing and silently succeed. All other I/O operations, via the standard library or via raw Windows API calls, will fail.
Examples
--------
Using implicit synchronization:
```
use std::io;
fn main() -> io::Result<()> {
let mut buffer = String::new();
io::stdin().read_line(&mut buffer)?;
Ok(())
}
```
Using explicit synchronization:
```
use std::io::{self, BufRead};
fn main() -> io::Result<()> {
let mut buffer = String::new();
let stdin = io::stdin();
let mut handle = stdin.lock();
handle.read_line(&mut buffer)?;
Ok(())
}
```
rust Struct std::io::LineWriter Struct std::io::LineWriter
==========================
```
pub struct LineWriter<W: Write> { /* private fields */ }
```
Wraps a writer and buffers output to it, flushing whenever a newline (`0x0a`, `'\n'`) is detected.
The [`BufWriter`](struct.bufwriter "BufWriter") struct wraps a writer and buffers its output. But it only does this batched write when it goes out of scope, or when the internal buffer is full. Sometimes, you’d prefer to write each line as it’s completed, rather than the entire buffer at once. Enter `LineWriter`. It does exactly that.
Like [`BufWriter`](struct.bufwriter "BufWriter"), a `LineWriter`’s buffer will also be flushed when the `LineWriter` goes out of scope or when its internal buffer is full.
If there’s still a partial line in the buffer when the `LineWriter` is dropped, it will flush those contents.
Examples
--------
We can use `LineWriter` to write one line at a time, significantly reducing the number of actual writes to the file.
```
use std::fs::{self, File};
use std::io::prelude::*;
use std::io::LineWriter;
fn main() -> std::io::Result<()> {
let road_not_taken = b"I shall be telling this with a sigh
Somewhere ages and ages hence:
Two roads diverged in a wood, and I -
I took the one less traveled by,
And that has made all the difference.";
let file = File::create("poem.txt")?;
let mut file = LineWriter::new(file);
file.write_all(b"I shall be telling this with a sigh")?;
// No bytes are written until a newline is encountered (or
// the internal buffer is filled).
assert_eq!(fs::read_to_string("poem.txt")?, "");
file.write_all(b"\n")?;
assert_eq!(
fs::read_to_string("poem.txt")?,
"I shall be telling this with a sigh\n",
);
// Write the rest of the poem.
file.write_all(b"Somewhere ages and ages hence:
Two roads diverged in a wood, and I -
I took the one less traveled by,
And that has made all the difference.")?;
// The last line of the poem doesn't end in a newline, so
// we have to flush or drop the `LineWriter` to finish
// writing.
file.flush()?;
// Confirm the whole poem was written.
assert_eq!(fs::read("poem.txt")?, &road_not_taken[..]);
Ok(())
}
```
Implementations
---------------
[source](https://doc.rust-lang.org/src/std/io/buffered/linewriter.rs.html#71-185)### impl<W: Write> LineWriter<W>
[source](https://doc.rust-lang.org/src/std/io/buffered/linewriter.rs.html#87-90)#### pub fn new(inner: W) -> LineWriter<W>
Notable traits for [LineWriter](struct.linewriter "struct std::io::LineWriter")<W>
```
impl<W: Write> Write for LineWriter<W>
```
Creates a new `LineWriter`.
##### Examples
```
use std::fs::File;
use std::io::LineWriter;
fn main() -> std::io::Result<()> {
let file = File::create("poem.txt")?;
let file = LineWriter::new(file);
Ok(())
}
```
[source](https://doc.rust-lang.org/src/std/io/buffered/linewriter.rs.html#108-110)#### pub fn with\_capacity(capacity: usize, inner: W) -> LineWriter<W>
Notable traits for [LineWriter](struct.linewriter "struct std::io::LineWriter")<W>
```
impl<W: Write> Write for LineWriter<W>
```
Creates a new `LineWriter` with at least the specified capacity for the internal buffer.
##### Examples
```
use std::fs::File;
use std::io::LineWriter;
fn main() -> std::io::Result<()> {
let file = File::create("poem.txt")?;
let file = LineWriter::with_capacity(100, file);
Ok(())
}
```
[source](https://doc.rust-lang.org/src/std/io/buffered/linewriter.rs.html#129-131)#### pub fn get\_ref(&self) -> &W
Gets a reference to the underlying writer.
##### Examples
```
use std::fs::File;
use std::io::LineWriter;
fn main() -> std::io::Result<()> {
let file = File::create("poem.txt")?;
let file = LineWriter::new(file);
let reference = file.get_ref();
Ok(())
}
```
[source](https://doc.rust-lang.org/src/std/io/buffered/linewriter.rs.html#154-156)#### pub fn get\_mut(&mut self) -> &mut W
Gets a mutable reference to the underlying writer.
Caution must be taken when calling methods on the mutable reference returned as extra writes could corrupt the output stream.
##### Examples
```
use std::fs::File;
use std::io::LineWriter;
fn main() -> std::io::Result<()> {
let file = File::create("poem.txt")?;
let mut file = LineWriter::new(file);
// we can use reference just like file
let reference = file.get_mut();
Ok(())
}
```
[source](https://doc.rust-lang.org/src/std/io/buffered/linewriter.rs.html#182-184)#### pub fn into\_inner(self) -> Result<W, IntoInnerError<LineWriter<W>>>
Unwraps this `LineWriter`, returning the underlying writer.
The internal buffer is written out before returning the writer.
##### Errors
An [`Err`](../result/enum.result#variant.Err "Err") will be returned if an error occurs while flushing the buffer.
##### Examples
```
use std::fs::File;
use std::io::LineWriter;
fn main() -> std::io::Result<()> {
let file = File::create("poem.txt")?;
let writer: LineWriter<File> = LineWriter::new(file);
let file: File = writer.into_inner()?;
Ok(())
}
```
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/std/io/buffered/linewriter.rs.html#219-232)### impl<W: Write> Debug for LineWriter<W>where W: [Debug](../fmt/trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/std/io/buffered/linewriter.rs.html#223-231)#### fn fmt(&self, fmt: &mut Formatter<'\_>) -> Result
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/std/io/buffered/linewriter.rs.html#188-216)### impl<W: Write> Write for LineWriter<W>
[source](https://doc.rust-lang.org/src/std/io/buffered/linewriter.rs.html#189-191)#### fn write(&mut self, buf: &[u8]) -> Result<usize>
Write a buffer into this writer, returning how many bytes were written. [Read more](trait.write#tymethod.write)
[source](https://doc.rust-lang.org/src/std/io/buffered/linewriter.rs.html#193-195)#### fn flush(&mut self) -> Result<()>
Flush this output stream, ensuring that all intermediately buffered contents reach their destination. [Read more](trait.write#tymethod.flush)
[source](https://doc.rust-lang.org/src/std/io/buffered/linewriter.rs.html#197-199)#### fn write\_vectored(&mut self, bufs: &[IoSlice<'\_>]) -> Result<usize>
Like [`write`](trait.write#tymethod.write), except that it writes from a slice of buffers. [Read more](trait.write#method.write_vectored)
[source](https://doc.rust-lang.org/src/std/io/buffered/linewriter.rs.html#201-203)#### fn is\_write\_vectored(&self) -> bool
🔬This is a nightly-only experimental API. (`can_vector` [#69941](https://github.com/rust-lang/rust/issues/69941))
Determines if this `Write`r has an efficient [`write_vectored`](trait.write#method.write_vectored) implementation. [Read more](trait.write#method.is_write_vectored)
[source](https://doc.rust-lang.org/src/std/io/buffered/linewriter.rs.html#205-207)#### fn write\_all(&mut self, buf: &[u8]) -> Result<()>
Attempts to write an entire buffer into this writer. [Read more](trait.write#method.write_all)
[source](https://doc.rust-lang.org/src/std/io/buffered/linewriter.rs.html#209-211)#### fn write\_all\_vectored(&mut self, bufs: &mut [IoSlice<'\_>]) -> Result<()>
🔬This is a nightly-only experimental API. (`write_all_vectored` [#70436](https://github.com/rust-lang/rust/issues/70436))
Attempts to write multiple buffers into this writer. [Read more](trait.write#method.write_all_vectored)
[source](https://doc.rust-lang.org/src/std/io/buffered/linewriter.rs.html#213-215)#### fn write\_fmt(&mut self, fmt: Arguments<'\_>) -> Result<()>
Writes a formatted string into this writer, returning any error encountered. [Read more](trait.write#method.write_fmt)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1714-1719)#### fn by\_ref(&mut self) -> &mut Selfwhere Self: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Creates a “by reference” adapter for this instance of `Write`. [Read more](trait.write#method.by_ref)
Auto Trait Implementations
--------------------------
### impl<W> RefUnwindSafe for LineWriter<W>where W: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<W> Send for LineWriter<W>where W: [Send](../marker/trait.send "trait std::marker::Send"),
### impl<W> Sync for LineWriter<W>where W: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<W> Unpin for LineWriter<W>where W: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"),
### impl<W> UnwindSafe for LineWriter<W>where W: [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"),
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
rust Struct std::io::StdoutLock Struct std::io::StdoutLock
==========================
```
pub struct StdoutLock<'a> { /* private fields */ }
```
A locked reference to the [`Stdout`](struct.stdout "Stdout") handle.
This handle implements the [`Write`](trait.write "Write") trait, and is constructed via the [`Stdout::lock`](struct.stdout#method.lock "Stdout::lock") method. See its documentation for more.
#### Note: Windows Portability Considerations
When operating in a console, the Windows implementation of this stream does not support non-UTF-8 byte sequences. Attempting to write bytes that are not valid UTF-8 will return an error.
In a process with a detached console, such as one using `#![windows_subsystem = "windows"]`, or in a child process spawned from such a process, the contained handle will be null. In such cases, the standard library’s `Read` and `Write` will do nothing and silently succeed. All other I/O operations, via the standard library or via raw Windows API calls, will fail.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/std/sys/unix/stdio.rs.html#120-125)1.63.0 · ### impl<'a> AsFd for StdoutLock<'a>
[source](https://doc.rust-lang.org/src/std/sys/unix/stdio.rs.html#122-124)#### fn as\_fd(&self) -> BorrowedFd<'\_>
Available on **Unix** only.Borrows the file descriptor. [Read more](../os/unix/io/trait.asfd#tymethod.as_fd)
[source](https://doc.rust-lang.org/src/std/os/windows/io/handle.rs.html#491-496)1.63.0 · ### impl<'a> AsHandle for StdoutLock<'a>
Available on **Windows** only.
[source](https://doc.rust-lang.org/src/std/os/windows/io/handle.rs.html#493-495)#### fn as\_handle(&self) -> BorrowedHandle<'\_>
Borrows the handle. [Read more](../os/windows/io/trait.ashandle#tymethod.as_handle)
[source](https://doc.rust-lang.org/src/std/os/fd/raw.rs.html#215-220)1.35.0 · ### impl<'a> AsRawFd for StdoutLock<'a>
[source](https://doc.rust-lang.org/src/std/os/fd/raw.rs.html#217-219)#### fn as\_raw\_fd(&self) -> RawFd
Available on **Unix** only.Extracts the raw file descriptor. [Read more](../os/unix/io/trait.asrawfd#tymethod.as_raw_fd)
[source](https://doc.rust-lang.org/src/std/os/windows/io/raw.rs.html#133-137)1.35.0 · ### impl<'a> AsRawHandle for StdoutLock<'a>
Available on **Windows** only.
[source](https://doc.rust-lang.org/src/std/os/windows/io/raw.rs.html#134-136)#### fn as\_raw\_handle(&self) -> RawHandle
Extracts the raw handle. [Read more](../os/windows/io/trait.asrawhandle#tymethod.as_raw_handle)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#743-747)1.16.0 · ### impl Debug for StdoutLock<'\_>
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#744-746)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#720-740)### impl Write for StdoutLock<'\_>
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#721-723)#### fn write(&mut self, buf: &[u8]) -> Result<usize>
Write a buffer into this writer, returning how many bytes were written. [Read more](trait.write#tymethod.write)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#724-726)#### fn write\_vectored(&mut self, bufs: &[IoSlice<'\_>]) -> Result<usize>
Like [`write`](trait.write#tymethod.write), except that it writes from a slice of buffers. [Read more](trait.write#method.write_vectored)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#728-730)#### fn is\_write\_vectored(&self) -> bool
🔬This is a nightly-only experimental API. (`can_vector` [#69941](https://github.com/rust-lang/rust/issues/69941))
Determines if this `Write`r has an efficient [`write_vectored`](trait.write#method.write_vectored) implementation. [Read more](trait.write#method.is_write_vectored)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#731-733)#### fn flush(&mut self) -> Result<()>
Flush this output stream, ensuring that all intermediately buffered contents reach their destination. [Read more](trait.write#tymethod.flush)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#734-736)#### fn write\_all(&mut self, buf: &[u8]) -> Result<()>
Attempts to write an entire buffer into this writer. [Read more](trait.write#method.write_all)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#737-739)#### fn write\_all\_vectored(&mut self, bufs: &mut [IoSlice<'\_>]) -> Result<()>
🔬This is a nightly-only experimental API. (`write_all_vectored` [#70436](https://github.com/rust-lang/rust/issues/70436))
Attempts to write multiple buffers into this writer. [Read more](trait.write#method.write_all_vectored)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1658-1690)#### fn write\_fmt(&mut self, fmt: Arguments<'\_>) -> Result<()>
Writes a formatted string into this writer, returning any error encountered. [Read more](trait.write#method.write_fmt)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1714-1719)#### fn by\_ref(&mut self) -> &mut Selfwhere Self: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Creates a “by reference” adapter for this instance of `Write`. [Read more](trait.write#method.by_ref)
Auto Trait Implementations
--------------------------
### impl<'a> RefUnwindSafe for StdoutLock<'a>
### impl<'a> !Send for StdoutLock<'a>
### impl<'a> Sync for StdoutLock<'a>
### impl<'a> Unpin for StdoutLock<'a>
### impl<'a> UnwindSafe for StdoutLock<'a>
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Struct std::io::Stdout Struct std::io::Stdout
======================
```
pub struct Stdout { /* private fields */ }
```
A handle to the global standard output stream of the current process.
Each handle shares a global buffer of data to be written to the standard output stream. Access is also synchronized via a lock and explicit control over locking is available via the [`lock`](struct.stdout#method.lock) method.
Created by the [`io::stdout`](fn.stdout) method.
#### Note: Windows Portability Considerations
When operating in a console, the Windows implementation of this stream does not support non-UTF-8 byte sequences. Attempting to write bytes that are not valid UTF-8 will return an error.
In a process with a detached console, such as one using `#![windows_subsystem = "windows"]`, or in a child process spawned from such a process, the contained handle will be null. In such cases, the standard library’s `Read` and `Write` will do nothing and silently succeed. All other I/O operations, via the standard library or via raw Windows API calls, will fail.
Implementations
---------------
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#631-658)### impl Stdout
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#652-657)#### pub fn lock(&self) -> StdoutLock<'static>
Notable traits for [StdoutLock](struct.stdoutlock "struct std::io::StdoutLock")<'\_>
```
impl Write for StdoutLock<'_>
```
Locks this handle to the standard output stream, returning a writable guard.
The lock is released when the returned lock goes out of scope. The returned guard also implements the `Write` trait for writing data.
##### Examples
```
use std::io::{self, Write};
fn main() -> io::Result<()> {
let mut stdout = io::stdout().lock();
stdout.write_all(b"hello world")?;
Ok(())
}
```
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/std/sys/unix/stdio.rs.html#112-117)1.63.0 · ### impl AsFd for Stdout
[source](https://doc.rust-lang.org/src/std/sys/unix/stdio.rs.html#114-116)#### fn as\_fd(&self) -> BorrowedFd<'\_>
Available on **Unix** only.Borrows the file descriptor. [Read more](../os/unix/io/trait.asfd#tymethod.as_fd)
[source](https://doc.rust-lang.org/src/std/os/windows/io/handle.rs.html#483-488)1.63.0 · ### impl AsHandle for Stdout
Available on **Windows** only.
[source](https://doc.rust-lang.org/src/std/os/windows/io/handle.rs.html#485-487)#### fn as\_handle(&self) -> BorrowedHandle<'\_>
Borrows the handle. [Read more](../os/windows/io/trait.ashandle#tymethod.as_handle)
[source](https://doc.rust-lang.org/src/std/os/fd/raw.rs.html#191-196)1.21.0 · ### impl AsRawFd for Stdout
[source](https://doc.rust-lang.org/src/std/os/fd/raw.rs.html#193-195)#### fn as\_raw\_fd(&self) -> RawFd
Available on **Unix** only.Extracts the raw file descriptor. [Read more](../os/unix/io/trait.asrawfd#tymethod.as_raw_fd)
[source](https://doc.rust-lang.org/src/std/os/windows/io/raw.rs.html#112-116)1.21.0 · ### impl AsRawHandle for Stdout
Available on **Windows** only.
[source](https://doc.rust-lang.org/src/std/os/windows/io/raw.rs.html#113-115)#### fn as\_raw\_handle(&self) -> RawHandle
Extracts the raw handle. [Read more](../os/windows/io/trait.asrawhandle#tymethod.as_raw_handle)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#661-665)1.16.0 · ### impl Debug for Stdout
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#662-664)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#694-717)1.48.0 · ### impl Write for &Stdout
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#695-697)#### fn write(&mut self, buf: &[u8]) -> Result<usize>
Write a buffer into this writer, returning how many bytes were written. [Read more](trait.write#tymethod.write)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#698-700)#### fn write\_vectored(&mut self, bufs: &[IoSlice<'\_>]) -> Result<usize>
Like [`write`](trait.write#tymethod.write), except that it writes from a slice of buffers. [Read more](trait.write#method.write_vectored)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#702-704)#### fn is\_write\_vectored(&self) -> bool
🔬This is a nightly-only experimental API. (`can_vector` [#69941](https://github.com/rust-lang/rust/issues/69941))
Determines if this `Write`r has an efficient [`write_vectored`](trait.write#method.write_vectored) implementation. [Read more](trait.write#method.is_write_vectored)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#705-707)#### fn flush(&mut self) -> Result<()>
Flush this output stream, ensuring that all intermediately buffered contents reach their destination. [Read more](trait.write#tymethod.flush)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#708-710)#### fn write\_all(&mut self, buf: &[u8]) -> Result<()>
Attempts to write an entire buffer into this writer. [Read more](trait.write#method.write_all)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#711-713)#### fn write\_all\_vectored(&mut self, bufs: &mut [IoSlice<'\_>]) -> Result<()>
🔬This is a nightly-only experimental API. (`write_all_vectored` [#70436](https://github.com/rust-lang/rust/issues/70436))
Attempts to write multiple buffers into this writer. [Read more](trait.write#method.write_all_vectored)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#714-716)#### fn write\_fmt(&mut self, args: Arguments<'\_>) -> Result<()>
Writes a formatted string into this writer, returning any error encountered. [Read more](trait.write#method.write_fmt)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1714-1719)#### fn by\_ref(&mut self) -> &mut Selfwhere Self: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Creates a “by reference” adapter for this instance of `Write`. [Read more](trait.write#method.by_ref)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#668-691)### impl Write for Stdout
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#669-671)#### fn write(&mut self, buf: &[u8]) -> Result<usize>
Write a buffer into this writer, returning how many bytes were written. [Read more](trait.write#tymethod.write)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#672-674)#### fn write\_vectored(&mut self, bufs: &[IoSlice<'\_>]) -> Result<usize>
Like [`write`](trait.write#tymethod.write), except that it writes from a slice of buffers. [Read more](trait.write#method.write_vectored)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#676-678)#### fn is\_write\_vectored(&self) -> bool
🔬This is a nightly-only experimental API. (`can_vector` [#69941](https://github.com/rust-lang/rust/issues/69941))
Determines if this `Write`r has an efficient [`write_vectored`](trait.write#method.write_vectored) implementation. [Read more](trait.write#method.is_write_vectored)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#679-681)#### fn flush(&mut self) -> Result<()>
Flush this output stream, ensuring that all intermediately buffered contents reach their destination. [Read more](trait.write#tymethod.flush)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#682-684)#### fn write\_all(&mut self, buf: &[u8]) -> Result<()>
Attempts to write an entire buffer into this writer. [Read more](trait.write#method.write_all)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#685-687)#### fn write\_all\_vectored(&mut self, bufs: &mut [IoSlice<'\_>]) -> Result<()>
🔬This is a nightly-only experimental API. (`write_all_vectored` [#70436](https://github.com/rust-lang/rust/issues/70436))
Attempts to write multiple buffers into this writer. [Read more](trait.write#method.write_all_vectored)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#688-690)#### fn write\_fmt(&mut self, args: Arguments<'\_>) -> Result<()>
Writes a formatted string into this writer, returning any error encountered. [Read more](trait.write#method.write_fmt)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1714-1719)#### fn by\_ref(&mut self) -> &mut Selfwhere Self: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Creates a “by reference” adapter for this instance of `Write`. [Read more](trait.write#method.by_ref)
Auto Trait Implementations
--------------------------
### impl RefUnwindSafe for Stdout
### impl Send for Stdout
### impl Sync for Stdout
### impl Unpin for Stdout
### impl UnwindSafe for Stdout
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
rust Struct std::io::Sink Struct std::io::Sink
====================
```
#[non_exhaustive]pub struct Sink;
```
A writer which will move data into the void.
This struct is generally created by calling [`sink`](fn.sink "sink"). Please see the documentation of [`sink()`](fn.sink "sink()") for more details.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/std/io/util.rs.html#189)### impl Clone for Sink
[source](https://doc.rust-lang.org/src/std/io/util.rs.html#189)#### fn clone(&self) -> Sink
Notable traits for [Sink](struct.sink "struct std::io::Sink")
```
impl Write for Sink
impl Write for &Sink
```
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)#### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/std/io/util.rs.html#264-268)1.16.0 · ### impl Debug for Sink
[source](https://doc.rust-lang.org/src/std/io/util.rs.html#265-267)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/std/io/util.rs.html#189)### impl Default for Sink
[source](https://doc.rust-lang.org/src/std/io/util.rs.html#189)#### fn default() -> Sink
Notable traits for [Sink](struct.sink "struct std::io::Sink")
```
impl Write for Sink
impl Write for &Sink
```
Returns the “default value” for a type. [Read more](../default/trait.default#tymethod.default)
[source](https://doc.rust-lang.org/src/std/io/util.rs.html#240-261)1.48.0 · ### impl Write for &Sink
[source](https://doc.rust-lang.org/src/std/io/util.rs.html#242-244)#### fn write(&mut self, buf: &[u8]) -> Result<usize>
Write a buffer into this writer, returning how many bytes were written. [Read more](trait.write#tymethod.write)
[source](https://doc.rust-lang.org/src/std/io/util.rs.html#247-250)#### fn write\_vectored(&mut self, bufs: &[IoSlice<'\_>]) -> Result<usize>
Like [`write`](trait.write#tymethod.write), except that it writes from a slice of buffers. [Read more](trait.write#method.write_vectored)
[source](https://doc.rust-lang.org/src/std/io/util.rs.html#253-255)#### fn is\_write\_vectored(&self) -> bool
🔬This is a nightly-only experimental API. (`can_vector` [#69941](https://github.com/rust-lang/rust/issues/69941))
Determines if this `Write`r has an efficient [`write_vectored`](trait.write#method.write_vectored) implementation. [Read more](trait.write#method.is_write_vectored)
[source](https://doc.rust-lang.org/src/std/io/util.rs.html#258-260)#### fn flush(&mut self) -> Result<()>
Flush this output stream, ensuring that all intermediately buffered contents reach their destination. [Read more](trait.write#tymethod.flush)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1537-1552)#### fn write\_all(&mut self, buf: &[u8]) -> Result<()>
Attempts to write an entire buffer into this writer. [Read more](trait.write#method.write_all)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1602-1620)#### fn write\_all\_vectored(&mut self, bufs: &mut [IoSlice<'\_>]) -> Result<()>
🔬This is a nightly-only experimental API. (`write_all_vectored` [#70436](https://github.com/rust-lang/rust/issues/70436))
Attempts to write multiple buffers into this writer. [Read more](trait.write#method.write_all_vectored)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1658-1690)#### fn write\_fmt(&mut self, fmt: Arguments<'\_>) -> Result<()>
Writes a formatted string into this writer, returning any error encountered. [Read more](trait.write#method.write_fmt)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1714-1719)#### fn by\_ref(&mut self) -> &mut Selfwhere Self: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Creates a “by reference” adapter for this instance of `Write`. [Read more](trait.write#method.by_ref)
[source](https://doc.rust-lang.org/src/std/io/util.rs.html#216-237)### impl Write for Sink
[source](https://doc.rust-lang.org/src/std/io/util.rs.html#218-220)#### fn write(&mut self, buf: &[u8]) -> Result<usize>
Write a buffer into this writer, returning how many bytes were written. [Read more](trait.write#tymethod.write)
[source](https://doc.rust-lang.org/src/std/io/util.rs.html#223-226)#### fn write\_vectored(&mut self, bufs: &[IoSlice<'\_>]) -> Result<usize>
Like [`write`](trait.write#tymethod.write), except that it writes from a slice of buffers. [Read more](trait.write#method.write_vectored)
[source](https://doc.rust-lang.org/src/std/io/util.rs.html#229-231)#### fn is\_write\_vectored(&self) -> bool
🔬This is a nightly-only experimental API. (`can_vector` [#69941](https://github.com/rust-lang/rust/issues/69941))
Determines if this `Write`r has an efficient [`write_vectored`](trait.write#method.write_vectored) implementation. [Read more](trait.write#method.is_write_vectored)
[source](https://doc.rust-lang.org/src/std/io/util.rs.html#234-236)#### fn flush(&mut self) -> Result<()>
Flush this output stream, ensuring that all intermediately buffered contents reach their destination. [Read more](trait.write#tymethod.flush)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1537-1552)#### fn write\_all(&mut self, buf: &[u8]) -> Result<()>
Attempts to write an entire buffer into this writer. [Read more](trait.write#method.write_all)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1602-1620)#### fn write\_all\_vectored(&mut self, bufs: &mut [IoSlice<'\_>]) -> Result<()>
🔬This is a nightly-only experimental API. (`write_all_vectored` [#70436](https://github.com/rust-lang/rust/issues/70436))
Attempts to write multiple buffers into this writer. [Read more](trait.write#method.write_all_vectored)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1658-1690)#### fn write\_fmt(&mut self, fmt: Arguments<'\_>) -> Result<()>
Writes a formatted string into this writer, returning any error encountered. [Read more](trait.write#method.write_fmt)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1714-1719)#### fn by\_ref(&mut self) -> &mut Selfwhere Self: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Creates a “by reference” adapter for this instance of `Write`. [Read more](trait.write#method.by_ref)
[source](https://doc.rust-lang.org/src/std/io/util.rs.html#189)### impl Copy for Sink
Auto Trait Implementations
--------------------------
### impl RefUnwindSafe for Sink
### impl Send for Sink
### impl Sync for Sink
### impl Unpin for Sink
### impl UnwindSafe for Sink
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Struct std::io::Bytes Struct std::io::Bytes
=====================
```
pub struct Bytes<R> { /* private fields */ }
```
An iterator over `u8` values of a reader.
This struct is generally created by calling [`bytes`](trait.read#method.bytes) on a reader. Please see the documentation of [`bytes`](trait.read#method.bytes) for more details.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2683)### impl<R: Debug> Debug for Bytes<R>
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2683)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2689-2707)### impl<R: Read> Iterator for Bytes<R>
#### type Item = Result<u8, Error>
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2692-2702)#### fn next(&mut self) -> Option<Result<u8>>
Advances the iterator and returns the next value. [Read more](../iter/trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2704-2706)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](../iter/trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](../iter/trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#252-254)#### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](../iter/trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#282-284)#### fn last(self) -> Option<Self::Item>
Consumes the iterator, returning the last element. [Read more](../iter/trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#328)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](../iter/trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#376)#### fn nth(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element of the iterator. [Read more](../iter/trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](../iter/struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](../iter/trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)#### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](../iter/struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](../iter/trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)#### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](../iter/struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](../iter/trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](../iter/struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](../iter/trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)#### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](../iter/struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](../iter/trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](../iter/trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)#### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](../iter/struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](../iter/trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)#### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](../iter/struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](../iter/trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)#### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](../iter/struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](../iter/trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)#### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](../iter/struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](../iter/struct.peekable#method.peek) and [`peek_mut`](../iter/struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](../iter/trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)#### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](../iter/struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](../iter/trait.iterator#method.skip)s elements based on a predicate. [Read more](../iter/trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)#### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](../iter/struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](../iter/trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](../iter/struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](../iter/trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)#### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](../iter/struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](../iter/trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)#### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](../iter/struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](../iter/trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)#### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](../iter/struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](../iter/trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](../iter/trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)#### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](../iter/struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](../iter/trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)#### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](../iter/struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](../iter/trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)#### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](../iter/struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](../iter/trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)#### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](../iter/trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)#### fn collect<B>(self) -> Bwhere B: [FromIterator](../iter/trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](../iter/trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](../iter/trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)#### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](../iter/trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](../iter/trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2230-2234)1.27.0 · #### fn try\_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](../iter/trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](../iter/trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2407-2410)#### fn fold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](../iter/trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](../iter/trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](../iter/trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)#### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)#### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)#### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](../iter/trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](../iter/trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](../iter/trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)#### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](../iter/trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](../iter/trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](../iter/trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)#### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](../iter/trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](../iter/struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](../iter/trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)#### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](../iter/struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](../iter/trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](../iter/struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](../iter/trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](../iter/trait.sum "trait std::iter::Sum")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](../iter/trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](../iter/trait.product "trait std::iter::Product")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](../iter/trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another. [Read more](../iter/trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another. [Read more](../iter/trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](../iter/trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are unequal to those of another. [Read more](../iter/trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](../iter/trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](../iter/trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](../iter/trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](../iter/trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](../iter/trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](../iter/trait.iterator#method.is_sorted_by_key)
Auto Trait Implementations
--------------------------
### impl<R> RefUnwindSafe for Bytes<R>where R: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<R> Send for Bytes<R>where R: [Send](../marker/trait.send "trait std::marker::Send"),
### impl<R> Sync for Bytes<R>where R: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<R> Unpin for Bytes<R>where R: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"),
### impl<R> UnwindSafe for Bytes<R>where R: [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"),
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](../iter/trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](../iter/trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Struct std::io::Lines Struct std::io::Lines
=====================
```
pub struct Lines<B> { /* private fields */ }
```
An iterator over the lines of an instance of `BufRead`.
This struct is generally created by calling [`lines`](trait.bufread#method.lines) on a `BufRead`. Please see the documentation of [`lines`](trait.bufread#method.lines) for more details.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2807)### impl<B: Debug> Debug for Lines<B>
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2807)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2813-2832)### impl<B: BufRead> Iterator for Lines<B>
#### type Item = Result<String, Error>
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2816-2831)#### fn next(&mut self) -> Option<Result<String>>
Advances the iterator and returns the next value. [Read more](../iter/trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](../iter/trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#215)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](../iter/trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#252-254)#### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](../iter/trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#282-284)#### fn last(self) -> Option<Self::Item>
Consumes the iterator, returning the last element. [Read more](../iter/trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#328)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](../iter/trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#376)#### fn nth(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element of the iterator. [Read more](../iter/trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](../iter/struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](../iter/trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)#### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](../iter/struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](../iter/trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)#### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](../iter/struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](../iter/trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](../iter/struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](../iter/trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)#### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](../iter/struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](../iter/trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](../iter/trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)#### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](../iter/struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](../iter/trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)#### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](../iter/struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](../iter/trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)#### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](../iter/struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](../iter/trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)#### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](../iter/struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](../iter/struct.peekable#method.peek) and [`peek_mut`](../iter/struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](../iter/trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)#### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](../iter/struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](../iter/trait.iterator#method.skip)s elements based on a predicate. [Read more](../iter/trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)#### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](../iter/struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](../iter/trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](../iter/struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](../iter/trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)#### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](../iter/struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](../iter/trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)#### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](../iter/struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](../iter/trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)#### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](../iter/struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](../iter/trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](../iter/trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)#### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](../iter/struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](../iter/trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)#### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](../iter/struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](../iter/trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)#### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](../iter/struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](../iter/trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)#### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](../iter/trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)#### fn collect<B>(self) -> Bwhere B: [FromIterator](../iter/trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](../iter/trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](../iter/trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)#### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](../iter/trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](../iter/trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2230-2234)1.27.0 · #### fn try\_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](../iter/trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](../iter/trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2407-2410)#### fn fold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](../iter/trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](../iter/trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](../iter/trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)#### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)#### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)#### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](../iter/trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](../iter/trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](../iter/trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)#### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](../iter/trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](../iter/trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](../iter/trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)#### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](../iter/trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](../iter/struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](../iter/trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)#### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](../iter/struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](../iter/trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](../iter/struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](../iter/trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](../iter/trait.sum "trait std::iter::Sum")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](../iter/trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](../iter/trait.product "trait std::iter::Product")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](../iter/trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another. [Read more](../iter/trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another. [Read more](../iter/trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](../iter/trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are unequal to those of another. [Read more](../iter/trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](../iter/trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](../iter/trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](../iter/trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](../iter/trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](../iter/trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](../iter/trait.iterator#method.is_sorted_by_key)
Auto Trait Implementations
--------------------------
### impl<B> RefUnwindSafe for Lines<B>where B: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<B> Send for Lines<B>where B: [Send](../marker/trait.send "trait std::marker::Send"),
### impl<B> Sync for Lines<B>where B: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<B> Unpin for Lines<B>where B: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"),
### impl<B> UnwindSafe for Lines<B>where B: [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"),
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](../iter/trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](../iter/trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Struct std::io::BorrowedCursor Struct std::io::BorrowedCursor
==============================
```
pub struct BorrowedCursor<'a> { /* private fields */ }
```
🔬This is a nightly-only experimental API. (`read_buf` [#78485](https://github.com/rust-lang/rust/issues/78485))
A writeable view of the unfilled portion of a [`BorrowedBuf`](struct.borrowedbuf).
Provides access to the initialized and uninitialized parts of the underlying `BorrowedBuf`. Data can be written directly to the cursor by using [`append`](struct.borrowedcursor#method.append) or indirectly by getting a slice of part or all of the cursor and writing into the slice. In the indirect case, the caller must call [`advance`](struct.borrowedcursor#method.advance) after writing to inform the cursor how many bytes have been written.
Once data is written to the cursor, it becomes part of the filled portion of the underlying `BorrowedBuf` and can no longer be accessed or re-written by the cursor. I.e., the cursor tracks the unfilled part of the underlying `BorrowedBuf`.
The lifetime `'a` is a bound on the lifetime of the underlying buffer (which means it is a bound on the data in that buffer by transitivity).
Implementations
---------------
[source](https://doc.rust-lang.org/src/std/io/readbuf.rs.html#165-295)### impl<'a> BorrowedCursor<'a>
[source](https://doc.rust-lang.org/src/std/io/readbuf.rs.html#171-182)#### pub fn reborrow<'this>(&'this mut self) -> BorrowedCursor<'this>
Notable traits for [BorrowedCursor](struct.borrowedcursor "struct std::io::BorrowedCursor")<'a>
```
impl<'a> Write for BorrowedCursor<'a>
```
🔬This is a nightly-only experimental API. (`read_buf` [#78485](https://github.com/rust-lang/rust/issues/78485))
Reborrow this cursor by cloning it with a smaller lifetime.
Since a cursor maintains unique access to its underlying buffer, the borrowed cursor is not accessible while the new cursor exists.
[source](https://doc.rust-lang.org/src/std/io/readbuf.rs.html#186-188)#### pub fn capacity(&self) -> usize
🔬This is a nightly-only experimental API. (`read_buf` [#78485](https://github.com/rust-lang/rust/issues/78485))
Returns the available space in the cursor.
[source](https://doc.rust-lang.org/src/std/io/readbuf.rs.html#195-197)#### pub fn written(&self) -> usize
🔬This is a nightly-only experimental API. (`read_buf` [#78485](https://github.com/rust-lang/rust/issues/78485))
Returns the number of bytes written to this cursor since it was created from a `BorrowedBuf`.
Note that if this cursor is a reborrowed clone of another, then the count returned is the count written via either cursor, not the count since the cursor was reborrowed.
[source](https://doc.rust-lang.org/src/std/io/readbuf.rs.html#201-204)#### pub fn init\_ref(&self) -> &[u8]
Notable traits for &[[u8](../primitive.u8)]
```
impl Read for &[u8]
impl Write for &mut [u8]
```
🔬This is a nightly-only experimental API. (`read_buf` [#78485](https://github.com/rust-lang/rust/issues/78485))
Returns a shared reference to the initialized portion of the cursor.
[source](https://doc.rust-lang.org/src/std/io/readbuf.rs.html#208-213)#### pub fn init\_mut(&mut self) -> &mut [u8]
Notable traits for &[[u8](../primitive.u8)]
```
impl Read for &[u8]
impl Write for &mut [u8]
```
🔬This is a nightly-only experimental API. (`read_buf` [#78485](https://github.com/rust-lang/rust/issues/78485))
Returns a mutable reference to the initialized portion of the cursor.
[source](https://doc.rust-lang.org/src/std/io/readbuf.rs.html#219-221)#### pub fn uninit\_mut(&mut self) -> &mut [MaybeUninit<u8>]
🔬This is a nightly-only experimental API. (`read_buf` [#78485](https://github.com/rust-lang/rust/issues/78485))
Returns a mutable reference to the uninitialized part of the cursor.
It is safe to uninitialize any of these bytes.
[source](https://doc.rust-lang.org/src/std/io/readbuf.rs.html#229-231)#### pub unsafe fn as\_mut(&mut self) -> &mut [MaybeUninit<u8>]
🔬This is a nightly-only experimental API. (`read_buf` [#78485](https://github.com/rust-lang/rust/issues/78485))
Returns a mutable reference to the whole cursor.
##### Safety
The caller must not uninitialize any bytes in the initialized portion of the cursor.
[source](https://doc.rust-lang.org/src/std/io/readbuf.rs.html#244-248)#### pub unsafe fn advance(&mut self, n: usize) -> &mut Self
🔬This is a nightly-only experimental API. (`read_buf` [#78485](https://github.com/rust-lang/rust/issues/78485))
Advance the cursor by asserting that `n` bytes have been filled.
After advancing, the `n` bytes are no longer accessible via the cursor and can only be accessed via the underlying buffer. I.e., the buffer’s filled portion grows by `n` elements and its unfilled portion (and the capacity of this cursor) shrinks by `n` elements.
##### Safety
The caller must ensure that the first `n` bytes of the cursor have been properly initialised.
[source](https://doc.rust-lang.org/src/std/io/readbuf.rs.html#252-259)#### pub fn ensure\_init(&mut self) -> &mut Self
🔬This is a nightly-only experimental API. (`read_buf` [#78485](https://github.com/rust-lang/rust/issues/78485))
Initializes all bytes in the cursor.
[source](https://doc.rust-lang.org/src/std/io/readbuf.rs.html#270-273)#### pub unsafe fn set\_init(&mut self, n: usize) -> &mut Self
🔬This is a nightly-only experimental API. (`read_buf` [#78485](https://github.com/rust-lang/rust/issues/78485))
Asserts that the first `n` unfilled bytes of the cursor are initialized.
`BorrowedBuf` assumes that bytes are never de-initialized, so this method does nothing when called with fewer bytes than are already known to be initialized.
##### Safety
The caller must ensure that the first `n` bytes of the buffer have already been initialized.
[source](https://doc.rust-lang.org/src/std/io/readbuf.rs.html#281-294)#### pub fn append(&mut self, buf: &[u8])
🔬This is a nightly-only experimental API. (`read_buf` [#78485](https://github.com/rust-lang/rust/issues/78485))
Appends data to the cursor, advancing position within its buffer.
##### Panics
Panics if `self.capacity()` is less than `buf.len()`.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/std/io/readbuf.rs.html#153)### impl<'a> Debug for BorrowedCursor<'a>
[source](https://doc.rust-lang.org/src/std/io/readbuf.rs.html#153)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/std/io/readbuf.rs.html#297-306)### impl<'a> Write for BorrowedCursor<'a>
[source](https://doc.rust-lang.org/src/std/io/readbuf.rs.html#298-301)#### fn write(&mut self, buf: &[u8]) -> Result<usize>
Write a buffer into this writer, returning how many bytes were written. [Read more](trait.write#tymethod.write)
[source](https://doc.rust-lang.org/src/std/io/readbuf.rs.html#303-305)#### fn flush(&mut self) -> Result<()>
Flush this output stream, ensuring that all intermediately buffered contents reach their destination. [Read more](trait.write#tymethod.flush)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1460-1462)1.36.0 · #### fn write\_vectored(&mut self, bufs: &[IoSlice<'\_>]) -> Result<usize>
Like [`write`](trait.write#tymethod.write), except that it writes from a slice of buffers. [Read more](trait.write#method.write_vectored)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1475-1477)#### fn is\_write\_vectored(&self) -> bool
🔬This is a nightly-only experimental API. (`can_vector` [#69941](https://github.com/rust-lang/rust/issues/69941))
Determines if this `Write`r has an efficient [`write_vectored`](trait.write#method.write_vectored) implementation. [Read more](trait.write#method.is_write_vectored)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1537-1552)1.0.0 · #### fn write\_all(&mut self, buf: &[u8]) -> Result<()>
Attempts to write an entire buffer into this writer. [Read more](trait.write#method.write_all)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1602-1620)#### fn write\_all\_vectored(&mut self, bufs: &mut [IoSlice<'\_>]) -> Result<()>
🔬This is a nightly-only experimental API. (`write_all_vectored` [#70436](https://github.com/rust-lang/rust/issues/70436))
Attempts to write multiple buffers into this writer. [Read more](trait.write#method.write_all_vectored)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1658-1690)1.0.0 · #### fn write\_fmt(&mut self, fmt: Arguments<'\_>) -> Result<()>
Writes a formatted string into this writer, returning any error encountered. [Read more](trait.write#method.write_fmt)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1714-1719)1.0.0 · #### fn by\_ref(&mut self) -> &mut Selfwhere Self: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Creates a “by reference” adapter for this instance of `Write`. [Read more](trait.write#method.by_ref)
Auto Trait Implementations
--------------------------
### impl<'a> RefUnwindSafe for BorrowedCursor<'a>
### impl<'a> Send for BorrowedCursor<'a>
### impl<'a> Sync for BorrowedCursor<'a>
### impl<'a> Unpin for BorrowedCursor<'a>
### impl<'a> !UnwindSafe for BorrowedCursor<'a>
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
rust Struct std::io::Stderr Struct std::io::Stderr
======================
```
pub struct Stderr { /* private fields */ }
```
A handle to the standard error stream of a process.
For more information, see the [`io::stderr`](fn.stderr) method.
#### Note: Windows Portability Considerations
When operating in a console, the Windows implementation of this stream does not support non-UTF-8 byte sequences. Attempting to write bytes that are not valid UTF-8 will return an error.
In a process with a detached console, such as one using `#![windows_subsystem = "windows"]`, or in a child process spawned from such a process, the contained handle will be null. In such cases, the standard library’s `Read` and `Write` will do nothing and silently succeed. All other I/O operations, via the standard library or via raw Windows API calls, will fail.
Implementations
---------------
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#849-877)### impl Stderr
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#871-876)#### pub fn lock(&self) -> StderrLock<'static>
Notable traits for [StderrLock](struct.stderrlock "struct std::io::StderrLock")<'\_>
```
impl Write for StderrLock<'_>
```
Locks this handle to the standard error stream, returning a writable guard.
The lock is released when the returned lock goes out of scope. The returned guard also implements the [`Write`](trait.write "Write") trait for writing data.
##### Examples
```
use std::io::{self, Write};
fn foo() -> io::Result<()> {
let stderr = io::stderr();
let mut handle = stderr.lock();
handle.write_all(b"hello world")?;
Ok(())
}
```
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/std/sys/unix/stdio.rs.html#128-133)1.63.0 · ### impl AsFd for Stderr
[source](https://doc.rust-lang.org/src/std/sys/unix/stdio.rs.html#130-132)#### fn as\_fd(&self) -> BorrowedFd<'\_>
Available on **Unix** only.Borrows the file descriptor. [Read more](../os/unix/io/trait.asfd#tymethod.as_fd)
[source](https://doc.rust-lang.org/src/std/os/windows/io/handle.rs.html#499-504)1.63.0 · ### impl AsHandle for Stderr
Available on **Windows** only.
[source](https://doc.rust-lang.org/src/std/os/windows/io/handle.rs.html#501-503)#### fn as\_handle(&self) -> BorrowedHandle<'\_>
Borrows the handle. [Read more](../os/windows/io/trait.ashandle#tymethod.as_handle)
[source](https://doc.rust-lang.org/src/std/os/fd/raw.rs.html#199-204)1.21.0 · ### impl AsRawFd for Stderr
[source](https://doc.rust-lang.org/src/std/os/fd/raw.rs.html#201-203)#### fn as\_raw\_fd(&self) -> RawFd
Available on **Unix** only.Extracts the raw file descriptor. [Read more](../os/unix/io/trait.asrawfd#tymethod.as_raw_fd)
[source](https://doc.rust-lang.org/src/std/os/windows/io/raw.rs.html#119-123)1.21.0 · ### impl AsRawHandle for Stderr
Available on **Windows** only.
[source](https://doc.rust-lang.org/src/std/os/windows/io/raw.rs.html#120-122)#### fn as\_raw\_handle(&self) -> RawHandle
Extracts the raw handle. [Read more](../os/windows/io/trait.asrawhandle#tymethod.as_raw_handle)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#880-884)1.16.0 · ### impl Debug for Stderr
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#881-883)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#913-936)1.48.0 · ### impl Write for &Stderr
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#914-916)#### fn write(&mut self, buf: &[u8]) -> Result<usize>
Write a buffer into this writer, returning how many bytes were written. [Read more](trait.write#tymethod.write)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#917-919)#### fn write\_vectored(&mut self, bufs: &[IoSlice<'\_>]) -> Result<usize>
Like [`write`](trait.write#tymethod.write), except that it writes from a slice of buffers. [Read more](trait.write#method.write_vectored)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#921-923)#### fn is\_write\_vectored(&self) -> bool
🔬This is a nightly-only experimental API. (`can_vector` [#69941](https://github.com/rust-lang/rust/issues/69941))
Determines if this `Write`r has an efficient [`write_vectored`](trait.write#method.write_vectored) implementation. [Read more](trait.write#method.is_write_vectored)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#924-926)#### fn flush(&mut self) -> Result<()>
Flush this output stream, ensuring that all intermediately buffered contents reach their destination. [Read more](trait.write#tymethod.flush)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#927-929)#### fn write\_all(&mut self, buf: &[u8]) -> Result<()>
Attempts to write an entire buffer into this writer. [Read more](trait.write#method.write_all)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#930-932)#### fn write\_all\_vectored(&mut self, bufs: &mut [IoSlice<'\_>]) -> Result<()>
🔬This is a nightly-only experimental API. (`write_all_vectored` [#70436](https://github.com/rust-lang/rust/issues/70436))
Attempts to write multiple buffers into this writer. [Read more](trait.write#method.write_all_vectored)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#933-935)#### fn write\_fmt(&mut self, args: Arguments<'\_>) -> Result<()>
Writes a formatted string into this writer, returning any error encountered. [Read more](trait.write#method.write_fmt)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1714-1719)#### fn by\_ref(&mut self) -> &mut Selfwhere Self: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Creates a “by reference” adapter for this instance of `Write`. [Read more](trait.write#method.by_ref)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#887-910)### impl Write for Stderr
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#888-890)#### fn write(&mut self, buf: &[u8]) -> Result<usize>
Write a buffer into this writer, returning how many bytes were written. [Read more](trait.write#tymethod.write)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#891-893)#### fn write\_vectored(&mut self, bufs: &[IoSlice<'\_>]) -> Result<usize>
Like [`write`](trait.write#tymethod.write), except that it writes from a slice of buffers. [Read more](trait.write#method.write_vectored)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#895-897)#### fn is\_write\_vectored(&self) -> bool
🔬This is a nightly-only experimental API. (`can_vector` [#69941](https://github.com/rust-lang/rust/issues/69941))
Determines if this `Write`r has an efficient [`write_vectored`](trait.write#method.write_vectored) implementation. [Read more](trait.write#method.is_write_vectored)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#898-900)#### fn flush(&mut self) -> Result<()>
Flush this output stream, ensuring that all intermediately buffered contents reach their destination. [Read more](trait.write#tymethod.flush)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#901-903)#### fn write\_all(&mut self, buf: &[u8]) -> Result<()>
Attempts to write an entire buffer into this writer. [Read more](trait.write#method.write_all)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#904-906)#### fn write\_all\_vectored(&mut self, bufs: &mut [IoSlice<'\_>]) -> Result<()>
🔬This is a nightly-only experimental API. (`write_all_vectored` [#70436](https://github.com/rust-lang/rust/issues/70436))
Attempts to write multiple buffers into this writer. [Read more](trait.write#method.write_all_vectored)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#907-909)#### fn write\_fmt(&mut self, args: Arguments<'\_>) -> Result<()>
Writes a formatted string into this writer, returning any error encountered. [Read more](trait.write#method.write_fmt)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1714-1719)#### fn by\_ref(&mut self) -> &mut Selfwhere Self: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Creates a “by reference” adapter for this instance of `Write`. [Read more](trait.write#method.by_ref)
Auto Trait Implementations
--------------------------
### impl RefUnwindSafe for Stderr
### impl Send for Stderr
### impl Sync for Stderr
### impl Unpin for Stderr
### impl UnwindSafe for Stderr
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Struct std::io::Split Struct std::io::Split
=====================
```
pub struct Split<B> { /* private fields */ }
```
An iterator over the contents of an instance of `BufRead` split on a particular byte.
This struct is generally created by calling [`split`](trait.bufread#method.split) on a `BufRead`. Please see the documentation of [`split`](trait.bufread#method.split) for more details.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2775)### impl<B: Debug> Debug for Split<B>
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2775)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2782-2798)### impl<B: BufRead> Iterator for Split<B>
#### type Item = Result<Vec<u8, Global>, Error>
The type of the elements being iterated over.
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2785-2797)#### fn next(&mut self) -> Option<Result<Vec<u8>>>
Advances the iterator and returns the next value. [Read more](../iter/trait.iterator#tymethod.next)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#138-142)#### fn next\_chunk<const N: usize>( &mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
🔬This is a nightly-only experimental API. (`iter_next_chunk` [#98326](https://github.com/rust-lang/rust/issues/98326))
Advances the iterator and returns an array containing the next `N` values. [Read more](../iter/trait.iterator#method.next_chunk)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#215)#### fn size\_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. [Read more](../iter/trait.iterator#method.size_hint)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#252-254)#### fn count(self) -> usize
Consumes the iterator, counting the number of iterations and returning it. [Read more](../iter/trait.iterator#method.count)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#282-284)#### fn last(self) -> Option<Self::Item>
Consumes the iterator, returning the last element. [Read more](../iter/trait.iterator#method.last)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#328)#### fn advance\_by(&mut self, n: usize) -> Result<(), usize>
🔬This is a nightly-only experimental API. (`iter_advance_by` [#77404](https://github.com/rust-lang/rust/issues/77404))
Advances the iterator by `n` elements. [Read more](../iter/trait.iterator#method.advance_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#376)#### fn nth(&mut self, n: usize) -> Option<Self::Item>
Returns the `n`th element of the iterator. [Read more](../iter/trait.iterator#method.nth)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#428-430)1.28.0 · #### fn step\_by(self, step: usize) -> StepBy<Self>
Notable traits for [StepBy](../iter/struct.stepby "struct std::iter::StepBy")<I>
```
impl<I> Iterator for StepBy<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator starting at the same point, but stepping by the given amount at each iteration. [Read more](../iter/trait.iterator#method.step_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#499-502)#### fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")<Item = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Notable traits for [Chain](../iter/struct.chain "struct std::iter::Chain")<A, B>
```
impl<A, B> Iterator for Chain<A, B>where
A: Iterator,
B: Iterator<Item = <A as Iterator>::Item>,
type Item = <A as Iterator>::Item;
```
Takes two iterators and creates a new iterator over both in sequence. [Read more](../iter/trait.iterator#method.chain)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#617-620)#### fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"),
Notable traits for [Zip](../iter/struct.zip "struct std::iter::Zip")<A, B>
```
impl<A, B> Iterator for Zip<A, B>where
A: Iterator,
B: Iterator,
type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
```
‘Zips up’ two iterators into a single iterator of pairs. [Read more](../iter/trait.iterator#method.zip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#717-720)#### fn intersperse\_with<G>(self, separator: G) -> IntersperseWith<Self, G>where G: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Notable traits for [IntersperseWith](../iter/struct.interspersewith "struct std::iter::IntersperseWith")<I, G>
```
impl<I, G> Iterator for IntersperseWith<I, G>where
I: Iterator,
G: FnMut() -> <I as Iterator>::Item,
type Item = <I as Iterator>::Item;
```
🔬This is a nightly-only experimental API. (`iter_intersperse` [#79524](https://github.com/rust-lang/rust/issues/79524))
Creates a new iterator which places an item generated by `separator` between adjacent items of the original iterator. [Read more](../iter/trait.iterator#method.intersperse_with)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#776-779)#### fn map<B, F>(self, f: F) -> Map<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Notable traits for [Map](../iter/struct.map "struct std::iter::Map")<I, F>
```
impl<B, I, F> Iterator for Map<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> B,
type Item = B;
```
Takes a closure and creates an iterator which calls that closure on each element. [Read more](../iter/trait.iterator#method.map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#821-824)1.21.0 · #### fn for\_each<F>(self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Calls a closure on each element of an iterator. [Read more](../iter/trait.iterator#method.for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#896-899)#### fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [Filter](../iter/struct.filter "struct std::iter::Filter")<I, P>
```
impl<I, P> Iterator for Filter<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator which uses a closure to determine if an element should be yielded. [Read more](../iter/trait.iterator#method.filter)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#941-944)#### fn filter\_map<B, F>(self, f: F) -> FilterMap<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [FilterMap](../iter/struct.filtermap "struct std::iter::FilterMap")<I, F>
```
impl<B, I, F> Iterator for FilterMap<I, F>where
I: Iterator,
F: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both filters and maps. [Read more](../iter/trait.iterator#method.filter_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#987-989)#### fn enumerate(self) -> Enumerate<Self>
Notable traits for [Enumerate](../iter/struct.enumerate "struct std::iter::Enumerate")<I>
```
impl<I> Iterator for Enumerate<I>where
I: Iterator,
type Item = (usize, <I as Iterator>::Item);
```
Creates an iterator which gives the current iteration count as well as the next value. [Read more](../iter/trait.iterator#method.enumerate)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1058-1060)#### fn peekable(self) -> Peekable<Self>
Notable traits for [Peekable](../iter/struct.peekable "struct std::iter::Peekable")<I>
```
impl<I> Iterator for Peekable<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which can use the [`peek`](../iter/struct.peekable#method.peek) and [`peek_mut`](../iter/struct.peekable#method.peek_mut) methods to look at the next element of the iterator without consuming it. See their documentation for more information. [Read more](../iter/trait.iterator#method.peekable)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1123-1126)#### fn skip\_while<P>(self, predicate: P) -> SkipWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [SkipWhile](../iter/struct.skipwhile "struct std::iter::SkipWhile")<I, P>
```
impl<I, P> Iterator for SkipWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that [`skip`](../iter/trait.iterator#method.skip)s elements based on a predicate. [Read more](../iter/trait.iterator#method.skip_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1204-1207)#### fn take\_while<P>(self, predicate: P) -> TakeWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Notable traits for [TakeWhile](../iter/struct.takewhile "struct std::iter::TakeWhile")<I, P>
```
impl<I, P> Iterator for TakeWhile<I, P>where
I: Iterator,
P: FnMut(&<I as Iterator>::Item) -> bool,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields elements based on a predicate. [Read more](../iter/trait.iterator#method.take_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1292-1295)1.57.0 · #### fn map\_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [MapWhile](../iter/struct.mapwhile "struct std::iter::MapWhile")<I, P>
```
impl<B, I, P> Iterator for MapWhile<I, P>where
I: Iterator,
P: FnMut(<I as Iterator>::Item) -> Option<B>,
type Item = B;
```
Creates an iterator that both yields elements based on a predicate and maps. [Read more](../iter/trait.iterator#method.map_while)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1323-1325)#### fn skip(self, n: usize) -> Skip<Self>
Notable traits for [Skip](../iter/struct.skip "struct std::iter::Skip")<I>
```
impl<I> Iterator for Skip<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that skips the first `n` elements. [Read more](../iter/trait.iterator#method.skip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1376-1378)#### fn take(self, n: usize) -> Take<Self>
Notable traits for [Take](../iter/struct.take "struct std::iter::Take")<I>
```
impl<I> Iterator for Take<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. [Read more](../iter/trait.iterator#method.take)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1420-1423)#### fn scan<St, B, F>(self, initial\_state: St, f: F) -> Scan<Self, St, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) St, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Notable traits for [Scan](../iter/struct.scan "struct std::iter::Scan")<I, St, F>
```
impl<B, I, St, F> Iterator for Scan<I, St, F>where
I: Iterator,
F: FnMut(&mut St, <I as Iterator>::Item) -> Option<B>,
type Item = B;
```
An iterator adapter similar to [`fold`](../iter/trait.iterator#method.fold) that holds internal state and produces a new iterator. [Read more](../iter/trait.iterator#method.scan)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1460-1464)#### fn flat\_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where U: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> U,
Notable traits for [FlatMap](../iter/struct.flatmap "struct std::iter::FlatMap")<I, U, F>
```
impl<I, U, F> Iterator for FlatMap<I, U, F>where
I: Iterator,
U: IntoIterator,
F: FnMut(<I as Iterator>::Item) -> U,
type Item = <U as IntoIterator>::Item;
```
Creates an iterator that works like map, but flattens nested structure. [Read more](../iter/trait.iterator#method.flat_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1600-1602)#### fn fuse(self) -> Fuse<Self>
Notable traits for [Fuse](../iter/struct.fuse "struct std::iter::Fuse")<I>
```
impl<I> Iterator for Fuse<I>where
I: Iterator,
type Item = <I as Iterator>::Item;
```
Creates an iterator which ends after the first [`None`](../option/enum.option#variant.None "None"). [Read more](../iter/trait.iterator#method.fuse)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1684-1687)#### fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")),
Notable traits for [Inspect](../iter/struct.inspect "struct std::iter::Inspect")<I, F>
```
impl<I, F> Iterator for Inspect<I, F>where
I: Iterator,
F: FnMut(&<I as Iterator>::Item),
type Item = <I as Iterator>::Item;
```
Does something with each element of an iterator, passing the value on. [Read more](../iter/trait.iterator#method.inspect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1714-1716)#### fn by\_ref(&mut self) -> &mut Self
Borrows an iterator, rather than consuming it. [Read more](../iter/trait.iterator#method.by_ref)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1832-1834)#### fn collect<B>(self) -> Bwhere B: [FromIterator](../iter/trait.fromiterator "trait std::iter::FromIterator")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Transforms an iterator into a collection. [Read more](../iter/trait.iterator#method.collect)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#1983-1985)#### fn collect\_into<E>(self, collection: &mut E) -> &mut Ewhere E: [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
🔬This is a nightly-only experimental API. (`iter_collect_into` [#94780](https://github.com/rust-lang/rust/issues/94780))
Collects all the items from an iterator into a collection. [Read more](../iter/trait.iterator#method.collect_into)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2017-2021)#### fn partition<B, F>(self, f: F) -> (B, B)where B: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Consumes an iterator, creating two collections from it. [Read more](../iter/trait.iterator#method.partition)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2136-2139)#### fn is\_partitioned<P>(self, predicate: P) -> boolwhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_is_partitioned` [#62544](https://github.com/rust-lang/rust/issues/62544))
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return `true` precede all those that return `false`. [Read more](../iter/trait.iterator#method.is_partitioned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2230-2234)1.27.0 · #### fn try\_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = B>,
An iterator method that applies a function as long as it returns successfully, producing a single, final value. [Read more](../iter/trait.iterator#method.try_fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2288-2292)1.27.0 · #### fn try\_for\_each<F, R>(&mut self, f: F) -> Rwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [()](../primitive.unit)>,
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. [Read more](../iter/trait.iterator#method.try_for_each)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2407-2410)#### fn fold<B, F>(self, init: B, f: F) -> Bwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(B, Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Folds every element into an accumulator by applying an operation, returning the final result. [Read more](../iter/trait.iterator#method.fold)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2453-2456)1.51.0 · #### fn reduce<F>(self, f: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"),
Reduces the elements to a single one, by repeatedly applying a reducing operation. [Read more](../iter/trait.iterator#method.reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2524-2529)#### fn try\_reduce<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`iterator_try_reduce` [#87053](https://github.com/rust-lang/rust/issues/87053))
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. [Read more](../iter/trait.iterator#method.try_reduce)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2581-2584)#### fn all<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if every element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.all)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2634-2637)#### fn any<F>(&mut self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Tests if any element of the iterator matches a predicate. [Read more](../iter/trait.iterator#method.any)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2694-2697)#### fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element of an iterator that satisfies a predicate. [Read more](../iter/trait.iterator#method.find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2725-2728)1.30.0 · #### fn find\_map<B, F>(&mut self, f: F) -> Option<B>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<B>,
Applies function to the elements of iterator and returns the first non-none result. [Read more](../iter/trait.iterator#method.find_map)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2781-2786)#### fn try\_find<F, R>( &mut self, f: F) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> R, R: [Try](../ops/trait.try "trait std::ops::Try")<Output = [bool](../primitive.bool)>, <R as [Try](../ops/trait.try "trait std::ops::Try")>::[Residual](../ops/trait.try#associatedtype.Residual "type std::ops::Try::Residual"): [Residual](../ops/trait.residual "trait std::ops::Residual")<[Option](../option/enum.option "enum std::option::Option")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>>,
🔬This is a nightly-only experimental API. (`try_find` [#63178](https://github.com/rust-lang/rust/issues/63178))
Applies function to the elements of iterator and returns the first true result or the first error. [Read more](../iter/trait.iterator#method.try_find)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2863-2866)#### fn position<P>(&mut self, predicate: P) -> Option<usize>where P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [bool](../primitive.bool),
Searches for an element in an iterator, returning its index. [Read more](../iter/trait.iterator#method.position)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3031-3034)1.6.0 · #### fn max\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the maximum value from the specified function. [Read more](../iter/trait.iterator#method.max_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3064-3067)1.15.0 · #### fn max\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the maximum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.max_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3091-3094)1.6.0 · #### fn min\_by\_key<B, F>(self, f: F) -> Option<Self::Item>where B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> B,
Returns the element that gives the minimum value from the specified function. [Read more](../iter/trait.iterator#method.min_by_key)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3124-3127)1.15.0 · #### fn min\_by<F>(self, compare: F) -> Option<Self::Item>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Returns the element that gives the minimum value with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.min_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3199-3203)#### fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<A>, FromB: [Default](../default/trait.default "trait std::default::Default") + [Extend](../iter/trait.extend "trait std::iter::Extend")<B>, Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [(A, B)](../primitive.tuple)>,
Converts an iterator of pairs into a pair of containers. [Read more](../iter/trait.iterator#method.unzip)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3231-3234)1.36.0 · #### fn copied<'a, T>(self) -> Copied<Self>where T: 'a + [Copy](../marker/trait.copy "trait std::marker::Copy"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Copied](../iter/struct.copied "struct std::iter::Copied")<I>
```
impl<'a, I, T> Iterator for Copied<I>where
T: 'a + Copy,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which copies all of its elements. [Read more](../iter/trait.iterator#method.copied)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3278-3281)#### fn cloned<'a, T>(self) -> Cloned<Self>where T: 'a + [Clone](../clone/trait.clone "trait std::clone::Clone"), Self: [Iterator](../iter/trait.iterator "trait std::iter::Iterator")<Item = [&'a](../primitive.reference) T>,
Notable traits for [Cloned](../iter/struct.cloned "struct std::iter::Cloned")<I>
```
impl<'a, I, T> Iterator for Cloned<I>where
T: 'a + Clone,
I: Iterator<Item = &'a T>,
type Item = T;
```
Creates an iterator which [`clone`](../clone/trait.clone#tymethod.clone)s all of its elements. [Read more](../iter/trait.iterator#method.cloned)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3355-3357)#### fn array\_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
Notable traits for [ArrayChunks](../iter/struct.arraychunks "struct std::iter::ArrayChunks")<I, N>
```
impl<I, const N: usize> Iterator for ArrayChunks<I, N>where
I: Iterator,
type Item = [<I as Iterator>::Item; N];
```
🔬This is a nightly-only experimental API. (`iter_array_chunks` [#100450](https://github.com/rust-lang/rust/issues/100450))
Returns an iterator over `N` elements of the iterator at a time. [Read more](../iter/trait.iterator#method.array_chunks)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3385-3388)1.11.0 · #### fn sum<S>(self) -> Swhere S: [Sum](../iter/trait.sum "trait std::iter::Sum")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Sums the elements of an iterator. [Read more](../iter/trait.iterator#method.sum)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3414-3417)1.11.0 · #### fn product<P>(self) -> Pwhere P: [Product](../iter/trait.product "trait std::iter::Product")<Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")>,
Iterates over the entire iterator, multiplying all the elements [Read more](../iter/trait.iterator#method.product)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3464-3468)#### fn cmp\_by<I, F>(self, other: I, cmp: F) -> Orderingwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3511-3515)1.5.0 · #### fn partial\_cmp<I>(self, other: I) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another. [Read more](../iter/trait.iterator#method.partial_cmp)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3549-3553)#### fn partial\_cmp\_by<I, F>(self, other: I, partial\_cmp: F) -> Option<Ordering>where I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
[Lexicographically](../cmp/trait.ord#lexicographical-comparison) compares the elements of this [`Iterator`](../iter/trait.iterator "Iterator") with those of another with respect to the specified comparison function. [Read more](../iter/trait.iterator#method.partial_cmp_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3591-3595)1.5.0 · #### fn eq<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another. [Read more](../iter/trait.iterator#method.eq)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3616-3620)#### fn eq\_by<I, F>(self, other: I, eq: F) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), <I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`iter_order_by` [#64295](https://github.com/rust-lang/rust/issues/64295))
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are equal to those of another with respect to the specified equality function. [Read more](../iter/trait.iterator#method.eq_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3651-3655)1.5.0 · #### fn ne<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are unequal to those of another. [Read more](../iter/trait.iterator#method.ne)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3672-3676)1.5.0 · #### fn lt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less than those of another. [Read more](../iter/trait.iterator#method.lt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3693-3697)1.5.0 · #### fn le<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) less or equal to those of another. [Read more](../iter/trait.iterator#method.le)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3714-3718)1.5.0 · #### fn gt<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than those of another. [Read more](../iter/trait.iterator#method.gt)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3735-3739)1.5.0 · #### fn ge<I>(self, other: I) -> boolwhere I: [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator"), Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"): [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<<I as [IntoIterator](../iter/trait.intoiterator "trait std::iter::IntoIterator")>::[Item](../iter/trait.intoiterator#associatedtype.Item "type std::iter::IntoIterator::Item")>,
Determines if the elements of this [`Iterator`](../iter/trait.iterator "Iterator") are [lexicographically](../cmp/trait.ord#lexicographical-comparison) greater than or equal to those of another. [Read more](../iter/trait.iterator#method.ge)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3794-3797)#### fn is\_sorted\_by<F>(self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(&Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item"), &Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given comparator function. [Read more](../iter/trait.iterator#method.is_sorted_by)
[source](https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#3840-3844)#### fn is\_sorted\_by\_key<F, K>(self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")(Self::[Item](../iter/trait.iterator#associatedtype.Item "type std::iter::Iterator::Item")) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this iterator are sorted using the given key extraction function. [Read more](../iter/trait.iterator#method.is_sorted_by_key)
Auto Trait Implementations
--------------------------
### impl<B> RefUnwindSafe for Split<B>where B: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<B> Send for Split<B>where B: [Send](../marker/trait.send "trait std::marker::Send"),
### impl<B> Sync for Split<B>where B: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<B> Unpin for Split<B>where B: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"),
### impl<B> UnwindSafe for Split<B>where B: [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"),
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#266)### impl<I> IntoIterator for Iwhere I: [Iterator](../iter/trait.iterator "trait std::iter::Iterator"),
#### 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?
[source](https://doc.rust-lang.org/src/core/iter/traits/collect.rs.html#271)const: [unstable](https://github.com/rust-lang/rust/issues/90603 "Tracking issue for const_intoiterator_identity") · #### fn into\_iter(self) -> I
Creates an iterator from a value. [Read more](../iter/trait.intoiterator#tymethod.into_iter)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Struct std::io::Repeat Struct std::io::Repeat
======================
```
pub struct Repeat { /* private fields */ }
```
A reader which yields one byte over and over and over and over and over and…
This struct is generally created by calling [`repeat()`](fn.repeat "repeat()"). Please see the documentation of [`repeat()`](fn.repeat "repeat()") for more details.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/std/io/util.rs.html#177-181)1.16.0 · ### impl Debug for Repeat
[source](https://doc.rust-lang.org/src/std/io/util.rs.html#178-180)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/std/io/util.rs.html#124-162)### impl Read for Repeat
[source](https://doc.rust-lang.org/src/std/io/util.rs.html#126-131)#### fn read(&mut self, buf: &mut [u8]) -> Result<usize>
Pull some bytes from this source into the specified buffer, returning how many bytes were read. [Read more](trait.read#tymethod.read)
[source](https://doc.rust-lang.org/src/std/io/util.rs.html#133-147)#### fn read\_buf(&mut self, buf: BorrowedCursor<'\_>) -> Result<()>
🔬This is a nightly-only experimental API. (`read_buf` [#78485](https://github.com/rust-lang/rust/issues/78485))
Pull some bytes from this source into the specified buffer. [Read more](trait.read#method.read_buf)
[source](https://doc.rust-lang.org/src/std/io/util.rs.html#150-156)#### fn read\_vectored(&mut self, bufs: &mut [IoSliceMut<'\_>]) -> Result<usize>
Like `read`, except that it reads into a slice of buffers. [Read more](trait.read#method.read_vectored)
[source](https://doc.rust-lang.org/src/std/io/util.rs.html#159-161)#### fn is\_read\_vectored(&self) -> bool
🔬This is a nightly-only experimental API. (`can_vector` [#69941](https://github.com/rust-lang/rust/issues/69941))
Determines if this `Read`er has an efficient `read_vectored` implementation. [Read more](trait.read#method.is_read_vectored)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#706-708)#### fn read\_to\_end(&mut self, buf: &mut Vec<u8>) -> Result<usize>
Read all bytes until EOF in this source, placing them into `buf`. [Read more](trait.read#method.read_to_end)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#749-751)#### fn read\_to\_string(&mut self, buf: &mut String) -> Result<usize>
Read all bytes until EOF in this source, appending them to `buf`. [Read more](trait.read#method.read_to_string)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#804-806)1.6.0 · #### fn read\_exact(&mut self, buf: &mut [u8]) -> Result<()>
Read the exact number of bytes required to fill `buf`. [Read more](trait.read#method.read_exact)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#824-839)#### fn read\_buf\_exact(&mut self, cursor: BorrowedCursor<'\_>) -> Result<()>
🔬This is a nightly-only experimental API. (`read_buf` [#78485](https://github.com/rust-lang/rust/issues/78485))
Read the exact number of bytes required to fill `cursor`. [Read more](trait.read#method.read_buf_exact)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#876-881)#### fn by\_ref(&mut self) -> &mut Selfwhere Self: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Creates a “by reference” adaptor for this instance of `Read`. [Read more](trait.read#method.by_ref)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#919-924)#### fn bytes(self) -> Bytes<Self>where Self: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Notable traits for [Bytes](struct.bytes "struct std::io::Bytes")<R>
```
impl<R: Read> Iterator for Bytes<R>
type Item = Result<u8>;
```
Transforms this `Read` instance to an [`Iterator`](../iter/trait.iterator "Iterator") over its bytes. [Read more](trait.read#method.bytes)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#957-962)#### fn chain<R: Read>(self, next: R) -> Chain<Self, R>where Self: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Notable traits for [Chain](struct.chain "struct std::io::Chain")<T, U>
```
impl<T: Read, U: Read> Read for Chain<T, U>
```
Creates an adapter which will chain this stream with another. [Read more](trait.read#method.chain)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#996-1001)#### fn take(self, limit: u64) -> Take<Self>where Self: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Notable traits for [Take](struct.take "struct std::io::Take")<T>
```
impl<T: Read> Read for Take<T>
```
Creates an adapter which will read at most `limit` bytes from it. [Read more](trait.read#method.take)
Auto Trait Implementations
--------------------------
### impl RefUnwindSafe for Repeat
### impl Send for Repeat
### impl Sync for Repeat
### impl Unpin for Repeat
### impl UnwindSafe for Repeat
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
rust Trait std::io::Read Trait std::io::Read
===================
```
pub trait Read {
fn read(&mut self, buf: &mut [u8]) -> Result<usize>;
fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize> { ... }
fn is_read_vectored(&self) -> bool { ... }
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> { ... }
fn read_to_string(&mut self, buf: &mut String) -> Result<usize> { ... }
fn read_exact(&mut self, buf: &mut [u8]) -> Result<()> { ... }
fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<()> { ... }
fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<()> { ... }
fn by_ref(&mut self) -> &mut Self where Self: Sized,
{ ... }
fn bytes(self) -> Bytes<Self> where Self: Sized,
{ ... }
fn chain<R: Read>(self, next: R) -> Chain<Self, R>ⓘNotable traits for Chain<T, U>impl<T: Read, U: Read> Read for Chain<T, U> where Self: Sized,
{ ... }
fn take(self, limit: u64) -> Take<Self>ⓘNotable traits for Take<T>impl<T: Read> Read for Take<T> where Self: Sized,
{ ... }
}
```
Notable traits for [Bytes](struct.bytes "struct std::io::Bytes")<R>
```
impl<R: Read> Iterator for Bytes<R>
type Item = Result<u8>;
```
The `Read` trait allows for reading bytes from a source.
Implementors of the `Read` trait are called ‘readers’.
Readers are defined by one required method, [`read()`](trait.read#tymethod.read). Each call to [`read()`](trait.read#tymethod.read) will attempt to pull bytes from this source into a provided buffer. A number of other methods are implemented in terms of [`read()`](trait.read#tymethod.read), giving implementors a number of ways to read bytes while only needing to implement a single method.
Readers are intended to be composable with one another. Many implementors throughout [`std::io`](index) take and provide types which implement the `Read` trait.
Please note that each call to [`read()`](trait.read#tymethod.read) may involve a system call, and therefore, using something that implements [`BufRead`](trait.bufread "BufRead"), such as [`BufReader`](struct.bufreader "BufReader"), will be more efficient.
Examples
--------
[`File`](../fs/struct.file)s implement `Read`:
```
use std::io;
use std::io::prelude::*;
use std::fs::File;
fn main() -> io::Result<()> {
let mut f = File::open("foo.txt")?;
let mut buffer = [0; 10];
// read up to 10 bytes
f.read(&mut buffer)?;
let mut buffer = Vec::new();
// read the whole file
f.read_to_end(&mut buffer)?;
// read into a String, so that you don't need to do the conversion.
let mut buffer = String::new();
f.read_to_string(&mut buffer)?;
// and more! See the other methods for more details.
Ok(())
}
```
Read from [`&str`](../primitive.str) because [`&[u8]`](../primitive.slice "slice") implements `Read`:
```
use std::io::prelude::*;
fn main() -> io::Result<()> {
let mut b = "This string will be read".as_bytes();
let mut buffer = [0; 10];
// read up to 10 bytes
b.read(&mut buffer)?;
// etc... it works exactly as a File does!
Ok(())
}
```
Required Methods
----------------
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#630)#### fn read(&mut self, buf: &mut [u8]) -> Result<usize>
Pull some bytes from this source into the specified buffer, returning how many bytes were read.
This function does not provide any guarantees about whether it blocks waiting for data, but if an object needs to block for a read and cannot, it will typically signal this via an [`Err`](../result/enum.result#variant.Err "Err") return value.
If the return value of this method is [`Ok(n)`](../result/enum.result#variant.Ok), then implementations must guarantee that `0 <= n <= buf.len()`. A nonzero `n` value indicates that the buffer `buf` has been filled in with `n` bytes of data from this source. If `n` is `0`, then it can indicate one of two scenarios:
1. This reader has reached its “end of file” and will likely no longer be able to produce bytes. Note that this does not mean that the reader will *always* no longer be able to produce bytes. As an example, on Linux, this method will call the `recv` syscall for a [`TcpStream`](../net/struct.tcpstream), where returning zero indicates the connection was shut down correctly. While for [`File`](../fs/struct.file), it is possible to reach the end of file and get zero as result, but if more data is appended to the file, future calls to `read` will return more data.
2. The buffer specified was 0 bytes in length.
It is not an error if the returned value `n` is smaller than the buffer size, even when the reader is not at the end of the stream yet. This may happen for example because fewer bytes are actually available right now (e. g. being close to end-of-file) or because read() was interrupted by a signal.
As this trait is safe to implement, callers cannot rely on `n <= buf.len()` for safety. Extra care needs to be taken when `unsafe` functions are used to access the read bytes. Callers have to ensure that no unchecked out-of-bounds accesses are possible even if `n > buf.len()`.
No guarantees are provided about the contents of `buf` when this function is called, implementations cannot rely on any property of the contents of `buf` being true. It is recommended that *implementations* only write data to `buf` instead of reading its contents.
Correspondingly, however, *callers* of this method must not assume any guarantees about how the implementation uses `buf`. The trait is safe to implement, so it is possible that the code that’s supposed to write to the buffer might also read from it. It is your responsibility to make sure that `buf` is initialized before calling `read`. Calling `read` with an uninitialized `buf` (of the kind one obtains via [`MaybeUninit<T>`](../mem/union.maybeuninit)) is not safe, and can lead to undefined behavior.
##### Errors
If this function encounters any form of I/O or other error, an error variant will be returned. If an error is returned then it must be guaranteed that no bytes were read.
An error of the [`ErrorKind::Interrupted`](enum.errorkind#variant.Interrupted "ErrorKind::Interrupted") kind is non-fatal and the read operation should be retried if there is nothing else to do.
##### Examples
[`File`](../fs/struct.file)s implement `Read`:
```
use std::io;
use std::io::prelude::*;
use std::fs::File;
fn main() -> io::Result<()> {
let mut f = File::open("foo.txt")?;
let mut buffer = [0; 10];
// read up to 10 bytes
let n = f.read(&mut buffer[..])?;
println!("The bytes: {:?}", &buffer[..n]);
Ok(())
}
```
Provided Methods
----------------
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#642-644)1.36.0 · #### fn read\_vectored(&mut self, bufs: &mut [IoSliceMut<'\_>]) -> Result<usize>
Like `read`, except that it reads into a slice of buffers.
Data is copied to fill each buffer in order, with the final buffer written to possibly being only partially filled. This method must behave equivalently to a single call to `read` with concatenated buffers.
The default implementation calls `read` with either the first nonempty buffer provided, or an empty one if none exists.
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#655-657)#### fn is\_read\_vectored(&self) -> bool
🔬This is a nightly-only experimental API. (`can_vector` [#69941](https://github.com/rust-lang/rust/issues/69941))
Determines if this `Read`er has an efficient `read_vectored` implementation.
If a `Read`er does not override the default `read_vectored` implementation, code using it may want to avoid the method all together and coalesce writes into a single buffer for higher performance.
The default implementation returns `false`.
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#706-708)#### fn read\_to\_end(&mut self, buf: &mut Vec<u8>) -> Result<usize>
Read all bytes until EOF in this source, placing them into `buf`.
All bytes read from this source will be appended to the specified buffer `buf`. This function will continuously call [`read()`](trait.read#tymethod.read) to append more data to `buf` until [`read()`](trait.read#tymethod.read) returns either [`Ok(0)`](../result/enum.result#variant.Ok) or an error of non-[`ErrorKind::Interrupted`](enum.errorkind#variant.Interrupted "ErrorKind::Interrupted") kind.
If successful, this function will return the total number of bytes read.
##### Errors
If this function encounters an error of the kind [`ErrorKind::Interrupted`](enum.errorkind#variant.Interrupted "ErrorKind::Interrupted") then the error is ignored and the operation will continue.
If any other read error is encountered then this function immediately returns. Any bytes which have already been read will be appended to `buf`.
##### Examples
[`File`](../fs/struct.file)s implement `Read`:
```
use std::io;
use std::io::prelude::*;
use std::fs::File;
fn main() -> io::Result<()> {
let mut f = File::open("foo.txt")?;
let mut buffer = Vec::new();
// read the whole file
f.read_to_end(&mut buffer)?;
Ok(())
}
```
(See also the [`std::fs::read`](../fs/fn.read) convenience function for reading from a file.)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#749-751)#### fn read\_to\_string(&mut self, buf: &mut String) -> Result<usize>
Read all bytes until EOF in this source, appending them to `buf`.
If successful, this function returns the number of bytes which were read and appended to `buf`.
##### Errors
If the data in this stream is *not* valid UTF-8 then an error is returned and `buf` is unchanged.
See [`read_to_end`](trait.read#method.read_to_end) for other error semantics.
##### Examples
[`File`](../fs/struct.file)s implement `Read`:
```
use std::io;
use std::io::prelude::*;
use std::fs::File;
fn main() -> io::Result<()> {
let mut f = File::open("foo.txt")?;
let mut buffer = String::new();
f.read_to_string(&mut buffer)?;
Ok(())
}
```
(See also the [`std::fs::read_to_string`](../fs/fn.read_to_string) convenience function for reading from a file.)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#804-806)1.6.0 · #### fn read\_exact(&mut self, buf: &mut [u8]) -> Result<()>
Read the exact number of bytes required to fill `buf`.
This function reads as many bytes as necessary to completely fill the specified buffer `buf`.
No guarantees are provided about the contents of `buf` when this function is called, implementations cannot rely on any property of the contents of `buf` being true. It is recommended that implementations only write data to `buf` instead of reading its contents. The documentation on [`read`](trait.read#tymethod.read) has a more detailed explanation on this subject.
##### Errors
If this function encounters an error of the kind [`ErrorKind::Interrupted`](enum.errorkind#variant.Interrupted "ErrorKind::Interrupted") then the error is ignored and the operation will continue.
If this function encounters an “end of file” before completely filling the buffer, it returns an error of the kind [`ErrorKind::UnexpectedEof`](enum.errorkind#variant.UnexpectedEof "ErrorKind::UnexpectedEof"). The contents of `buf` are unspecified in this case.
If any other read error is encountered then this function immediately returns. The contents of `buf` are unspecified in this case.
If this function returns an error, it is unspecified how many bytes it has read, but it will never read more than would be necessary to completely fill the buffer.
##### Examples
[`File`](../fs/struct.file)s implement `Read`:
```
use std::io;
use std::io::prelude::*;
use std::fs::File;
fn main() -> io::Result<()> {
let mut f = File::open("foo.txt")?;
let mut buffer = [0; 10];
// read exactly 10 bytes
f.read_exact(&mut buffer)?;
Ok(())
}
```
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#815-817)#### fn read\_buf(&mut self, buf: BorrowedCursor<'\_>) -> Result<()>
🔬This is a nightly-only experimental API. (`read_buf` [#78485](https://github.com/rust-lang/rust/issues/78485))
Pull some bytes from this source into the specified buffer.
This is equivalent to the [`read`](trait.read#tymethod.read) method, except that it is passed a [`BorrowedCursor`](struct.borrowedcursor "BorrowedCursor") rather than `[u8]` to allow use with uninitialized buffers. The new data will be appended to any existing contents of `buf`.
The default implementation delegates to `read`.
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#824-839)#### fn read\_buf\_exact(&mut self, cursor: BorrowedCursor<'\_>) -> Result<()>
🔬This is a nightly-only experimental API. (`read_buf` [#78485](https://github.com/rust-lang/rust/issues/78485))
Read the exact number of bytes required to fill `cursor`.
This is equivalent to the [`read_exact`](trait.read#method.read_exact) method, except that it is passed a [`BorrowedCursor`](struct.borrowedcursor "BorrowedCursor") rather than `[u8]` to allow use with uninitialized buffers.
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#876-881)#### fn by\_ref(&mut self) -> &mut Selfwhere Self: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Creates a “by reference” adaptor for this instance of `Read`.
The returned adapter also implements `Read` and will simply borrow this current reader.
##### Examples
[`File`](../fs/struct.file)s implement `Read`:
```
use std::io;
use std::io::Read;
use std::fs::File;
fn main() -> io::Result<()> {
let mut f = File::open("foo.txt")?;
let mut buffer = Vec::new();
let mut other_buffer = Vec::new();
{
let reference = f.by_ref();
// read at most 5 bytes
reference.take(5).read_to_end(&mut buffer)?;
} // drop our &mut reference so we can use f again
// original file still usable, read the rest
f.read_to_end(&mut other_buffer)?;
Ok(())
}
```
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#919-924)#### fn bytes(self) -> Bytes<Self>where Self: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Notable traits for [Bytes](struct.bytes "struct std::io::Bytes")<R>
```
impl<R: Read> Iterator for Bytes<R>
type Item = Result<u8>;
```
Transforms this `Read` instance to an [`Iterator`](../iter/trait.iterator "Iterator") over its bytes.
The returned type implements [`Iterator`](../iter/trait.iterator "Iterator") where the [`Item`](../iter/trait.iterator#associatedtype.Item) is `[Result](../result/enum.result "Result")<[u8](../primitive.u8 "u8"), [io::Error](struct.error "io::Error")>`. The yielded item is [`Ok`](../result/enum.result#variant.Ok "Ok") if a byte was successfully read and [`Err`](../result/enum.result#variant.Err "Err") otherwise. EOF is mapped to returning [`None`](../option/enum.option#variant.None "None") from this iterator.
The default implementation calls `read` for each byte, which can be very inefficient for data that’s not in memory, such as [`File`](../fs/struct.file "fs::File"). Consider using a [`BufReader`](struct.bufreader "BufReader") in such cases.
##### Examples
[`File`](../fs/struct.file "fs::File")s implement `Read`:
```
use std::io;
use std::io::prelude::*;
use std::io::BufReader;
use std::fs::File;
fn main() -> io::Result<()> {
let f = BufReader::new(File::open("foo.txt")?);
for byte in f.bytes() {
println!("{}", byte.unwrap());
}
Ok(())
}
```
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#957-962)#### fn chain<R: Read>(self, next: R) -> Chain<Self, R>where Self: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Notable traits for [Chain](struct.chain "struct std::io::Chain")<T, U>
```
impl<T: Read, U: Read> Read for Chain<T, U>
```
Creates an adapter which will chain this stream with another.
The returned `Read` instance will first read all bytes from this object until EOF is encountered. Afterwards the output is equivalent to the output of `next`.
##### Examples
[`File`](../fs/struct.file)s implement `Read`:
```
use std::io;
use std::io::prelude::*;
use std::fs::File;
fn main() -> io::Result<()> {
let f1 = File::open("foo.txt")?;
let f2 = File::open("bar.txt")?;
let mut handle = f1.chain(f2);
let mut buffer = String::new();
// read the value into a String. We could use any Read method here,
// this is just one example.
handle.read_to_string(&mut buffer)?;
Ok(())
}
```
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#996-1001)#### fn take(self, limit: u64) -> Take<Self>where Self: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Notable traits for [Take](struct.take "struct std::io::Take")<T>
```
impl<T: Read> Read for Take<T>
```
Creates an adapter which will read at most `limit` bytes from it.
This function returns a new instance of `Read` which will read at most `limit` bytes, after which it will always return EOF ([`Ok(0)`](../result/enum.result#variant.Ok)). Any read errors will not count towards the number of bytes read and future calls to [`read()`](trait.read#tymethod.read) may succeed.
##### Examples
[`File`](../fs/struct.file)s implement `Read`:
```
use std::io;
use std::io::prelude::*;
use std::fs::File;
fn main() -> io::Result<()> {
let f = File::open("foo.txt")?;
let mut buffer = [0; 5];
// read at most five bytes
let mut handle = f.take(5);
handle.read(&mut buffer)?;
Ok(())
}
```
Implementors
------------
[source](https://doc.rust-lang.org/src/std/fs.rs.html#782-811)### impl Read for &File
[source](https://doc.rust-lang.org/src/std/net/tcp.rs.html#651-664)### impl Read for &TcpStream
[source](https://doc.rust-lang.org/src/std/io/impls.rs.html#232-310)### impl Read for &[u8]
Read is implemented for `&[u8]` by copying from the slice.
Note that reading updates the slice to point to the yet unread part. The slice will be empty when EOF is reached.
[source](https://doc.rust-lang.org/src/std/fs.rs.html#726-755)### impl Read for File
[source](https://doc.rust-lang.org/src/std/net/tcp.rs.html#617-630)### impl Read for TcpStream
[source](https://doc.rust-lang.org/src/std/os/unix/net/stream.rs.html#619-632)1.10.0 · ### impl Read for UnixStream
Available on **Unix** only.[source](https://doc.rust-lang.org/src/std/process.rs.html#413-426)### impl Read for ChildStderr
[source](https://doc.rust-lang.org/src/std/process.rs.html#352-365)### impl Read for ChildStdout
[source](https://doc.rust-lang.org/src/std/io/util.rs.html#43-53)### impl Read for Empty
[source](https://doc.rust-lang.org/src/std/io/util.rs.html#124-162)### impl Read for Repeat
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#417-437)### impl Read for Stdin
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#448-473)### impl Read for StdinLock<'\_>
[source](https://doc.rust-lang.org/src/std/os/unix/net/stream.rs.html#635-648)1.10.0 · ### impl<'a> Read for &'a UnixStream
Available on **Unix** only.[source](https://doc.rust-lang.org/src/std/io/impls.rs.html#417-437)1.63.0 · ### impl<A: Allocator> Read for VecDeque<u8, A>
Read is implemented for `VecDeque<u8>` by consuming bytes from the front of the `VecDeque`.
[source](https://doc.rust-lang.org/src/std/io/impls.rs.html#17-52)### impl<R: Read + ?Sized> Read for &mut R
[source](https://doc.rust-lang.org/src/std/io/impls.rs.html#121-156)### impl<R: Read + ?Sized> Read for Box<R>
[source](https://doc.rust-lang.org/src/std/io/buffered/bufreader.rs.html#260-371)### impl<R: Read> Read for BufReader<R>
[source](https://doc.rust-lang.org/src/std/io/cursor.rs.html#316-358)### impl<T> Read for Cursor<T>where T: [AsRef](../convert/trait.asref "trait std::convert::AsRef")<[[u8](../primitive.u8)]>,
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2578-2638)### impl<T: Read> Read for Take<T>
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2369-2389)### impl<T: Read, U: Read> Read for Chain<T, U>
| programming_docs |
rust Struct std::io::StderrLock Struct std::io::StderrLock
==========================
```
pub struct StderrLock<'a> { /* private fields */ }
```
A locked reference to the [`Stderr`](struct.stderr "Stderr") handle.
This handle implements the [`Write`](trait.write "Write") trait and is constructed via the [`Stderr::lock`](struct.stderr#method.lock "Stderr::lock") method. See its documentation for more.
#### Note: Windows Portability Considerations
When operating in a console, the Windows implementation of this stream does not support non-UTF-8 byte sequences. Attempting to write bytes that are not valid UTF-8 will return an error.
In a process with a detached console, such as one using `#![windows_subsystem = "windows"]`, or in a child process spawned from such a process, the contained handle will be null. In such cases, the standard library’s `Read` and `Write` will do nothing and silently succeed. All other I/O operations, via the standard library or via raw Windows API calls, will fail.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/std/sys/unix/stdio.rs.html#136-141)1.63.0 · ### impl<'a> AsFd for StderrLock<'a>
[source](https://doc.rust-lang.org/src/std/sys/unix/stdio.rs.html#138-140)#### fn as\_fd(&self) -> BorrowedFd<'\_>
Available on **Unix** only.Borrows the file descriptor. [Read more](../os/unix/io/trait.asfd#tymethod.as_fd)
[source](https://doc.rust-lang.org/src/std/os/windows/io/handle.rs.html#507-512)1.63.0 · ### impl<'a> AsHandle for StderrLock<'a>
Available on **Windows** only.
[source](https://doc.rust-lang.org/src/std/os/windows/io/handle.rs.html#509-511)#### fn as\_handle(&self) -> BorrowedHandle<'\_>
Borrows the handle. [Read more](../os/windows/io/trait.ashandle#tymethod.as_handle)
[source](https://doc.rust-lang.org/src/std/os/fd/raw.rs.html#223-228)1.35.0 · ### impl<'a> AsRawFd for StderrLock<'a>
[source](https://doc.rust-lang.org/src/std/os/fd/raw.rs.html#225-227)#### fn as\_raw\_fd(&self) -> RawFd
Available on **Unix** only.Extracts the raw file descriptor. [Read more](../os/unix/io/trait.asrawfd#tymethod.as_raw_fd)
[source](https://doc.rust-lang.org/src/std/os/windows/io/raw.rs.html#140-144)1.35.0 · ### impl<'a> AsRawHandle for StderrLock<'a>
Available on **Windows** only.
[source](https://doc.rust-lang.org/src/std/os/windows/io/raw.rs.html#141-143)#### fn as\_raw\_handle(&self) -> RawHandle
Extracts the raw handle. [Read more](../os/windows/io/trait.asrawhandle#tymethod.as_raw_handle)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#962-966)1.16.0 · ### impl Debug for StderrLock<'\_>
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#963-965)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#939-959)### impl Write for StderrLock<'\_>
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#940-942)#### fn write(&mut self, buf: &[u8]) -> Result<usize>
Write a buffer into this writer, returning how many bytes were written. [Read more](trait.write#tymethod.write)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#943-945)#### fn write\_vectored(&mut self, bufs: &[IoSlice<'\_>]) -> Result<usize>
Like [`write`](trait.write#tymethod.write), except that it writes from a slice of buffers. [Read more](trait.write#method.write_vectored)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#947-949)#### fn is\_write\_vectored(&self) -> bool
🔬This is a nightly-only experimental API. (`can_vector` [#69941](https://github.com/rust-lang/rust/issues/69941))
Determines if this `Write`r has an efficient [`write_vectored`](trait.write#method.write_vectored) implementation. [Read more](trait.write#method.is_write_vectored)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#950-952)#### fn flush(&mut self) -> Result<()>
Flush this output stream, ensuring that all intermediately buffered contents reach their destination. [Read more](trait.write#tymethod.flush)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#953-955)#### fn write\_all(&mut self, buf: &[u8]) -> Result<()>
Attempts to write an entire buffer into this writer. [Read more](trait.write#method.write_all)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#956-958)#### fn write\_all\_vectored(&mut self, bufs: &mut [IoSlice<'\_>]) -> Result<()>
🔬This is a nightly-only experimental API. (`write_all_vectored` [#70436](https://github.com/rust-lang/rust/issues/70436))
Attempts to write multiple buffers into this writer. [Read more](trait.write#method.write_all_vectored)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1658-1690)#### fn write\_fmt(&mut self, fmt: Arguments<'\_>) -> Result<()>
Writes a formatted string into this writer, returning any error encountered. [Read more](trait.write#method.write_fmt)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1714-1719)#### fn by\_ref(&mut self) -> &mut Selfwhere Self: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Creates a “by reference” adapter for this instance of `Write`. [Read more](trait.write#method.by_ref)
Auto Trait Implementations
--------------------------
### impl<'a> RefUnwindSafe for StderrLock<'a>
### impl<'a> !Send for StderrLock<'a>
### impl<'a> Sync for StderrLock<'a>
### impl<'a> Unpin for StderrLock<'a>
### impl<'a> UnwindSafe for StderrLock<'a>
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
rust Function std::io::read_to_string Function std::io::read\_to\_string
==================================
```
pub fn read_to_string<R: Read>(reader: R) -> Result<String>
```
Read all bytes from a [reader](trait.read "Read") into a new [`String`](../string/struct.string "String").
This is a convenience function for [`Read::read_to_string`](trait.read#method.read_to_string "Read::read_to_string"). Using this function avoids having to create a variable first and provides more type safety since you can only get the buffer out if there were no errors. (If you use [`Read::read_to_string`](trait.read#method.read_to_string "Read::read_to_string") you have to remember to check whether the read succeeded because otherwise your buffer will be empty or only partially full.)
Performance
-----------
The downside of this function’s increased ease of use and type safety is that it gives you less control over performance. For example, you can’t pre-allocate memory like you can using [`String::with_capacity`](../string/struct.string#method.with_capacity "String::with_capacity") and [`Read::read_to_string`](trait.read#method.read_to_string "Read::read_to_string"). Also, you can’t re-use the buffer if an error occurs while reading.
In many cases, this function’s performance will be adequate and the ease of use and type safety tradeoffs will be worth it. However, there are cases where you need more control over performance, and in those cases you should definitely use [`Read::read_to_string`](trait.read#method.read_to_string "Read::read_to_string") directly.
Note that in some special cases, such as when reading files, this function will pre-allocate memory based on the size of the input it is reading. In those cases, the performance should be as good as if you had used [`Read::read_to_string`](trait.read#method.read_to_string "Read::read_to_string") with a manually pre-allocated buffer.
Errors
------
This function forces you to handle errors because the output (the `String`) is wrapped in a [`Result`](type.result "Result"). See [`Read::read_to_string`](trait.read#method.read_to_string "Read::read_to_string") for the errors that can occur. If any error occurs, you will get an [`Err`](../result/enum.result#variant.Err "Err"), so you don’t have to worry about your buffer being empty or partially full.
Examples
--------
```
fn main() -> io::Result<()> {
let stdin = io::read_to_string(io::stdin())?;
println!("Stdin was:");
println!("{stdin}");
Ok(())
}
```
rust Enum std::io::SeekFrom Enum std::io::SeekFrom
======================
```
pub enum SeekFrom {
Start(u64),
End(i64),
Current(i64),
}
```
Enumeration of possible methods to seek within an I/O object.
It is used by the [`Seek`](trait.seek "Seek") trait.
Variants
--------
### `Start([u64](../primitive.u64))`
Sets the offset to the provided number of bytes.
### `End([i64](../primitive.i64))`
Sets the offset to the size of this object plus the specified number of bytes.
It is possible to seek beyond the end of an object, but it’s an error to seek before byte 0.
### `Current([i64](../primitive.i64))`
Sets the offset to the current position plus the specified number of bytes.
It is possible to seek beyond the end of an object, but it’s an error to seek before byte 0.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1881)### impl Clone for SeekFrom
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1881)#### fn clone(&self) -> SeekFrom
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)#### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1881)### impl Debug for SeekFrom
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1881)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1881)### impl PartialEq<SeekFrom> for SeekFrom
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1881)#### fn eq(&self, other: &SeekFrom) -> bool
This method tests for `self` and `other` values to be equal, and is used by `==`. [Read more](../cmp/trait.partialeq#tymethod.eq)
[source](https://doc.rust-lang.org/src/core/cmp.rs.html#236)#### fn ne(&self, other: &Rhs) -> bool
This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. [Read more](../cmp/trait.partialeq#method.ne)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1881)### impl Copy for SeekFrom
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1881)### impl Eq for SeekFrom
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1881)### impl StructuralEq for SeekFrom
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1881)### impl StructuralPartialEq for SeekFrom
Auto Trait Implementations
--------------------------
### impl RefUnwindSafe for SeekFrom
### impl Send for SeekFrom
### impl Sync for SeekFrom
### impl Unpin for SeekFrom
### impl UnwindSafe for SeekFrom
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
rust Struct std::io::StdinLock Struct std::io::StdinLock
=========================
```
pub struct StdinLock<'a> { /* private fields */ }
```
A locked reference to the [`Stdin`](struct.stdin "Stdin") handle.
This handle implements both the [`Read`](trait.read "Read") and [`BufRead`](trait.bufread "BufRead") traits, and is constructed via the [`Stdin::lock`](struct.stdin#method.lock "Stdin::lock") method.
#### Note: Windows Portability Considerations
When operating in a console, the Windows implementation of this stream does not support non-UTF-8 byte sequences. Attempting to read bytes that are not valid UTF-8 will return an error.
In a process with a detached console, such as one using `#![windows_subsystem = "windows"]`, or in a child process spawned from such a process, the contained handle will be null. In such cases, the standard library’s `Read` and `Write` will do nothing and silently succeed. All other I/O operations, via the standard library or via raw Windows API calls, will fail.
Examples
--------
```
use std::io::{self, BufRead};
fn main() -> io::Result<()> {
let mut buffer = String::new();
let stdin = io::stdin(); // We get `Stdin` here.
{
let mut handle = stdin.lock(); // We get `StdinLock` here.
handle.read_line(&mut buffer)?;
} // `StdinLock` is dropped here.
Ok(())
}
```
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/std/sys/unix/stdio.rs.html#104-109)1.63.0 · ### impl<'a> AsFd for StdinLock<'a>
[source](https://doc.rust-lang.org/src/std/sys/unix/stdio.rs.html#106-108)#### fn as\_fd(&self) -> BorrowedFd<'\_>
Available on **Unix** only.Borrows the file descriptor. [Read more](../os/unix/io/trait.asfd#tymethod.as_fd)
[source](https://doc.rust-lang.org/src/std/os/windows/io/handle.rs.html#475-480)1.63.0 · ### impl<'a> AsHandle for StdinLock<'a>
Available on **Windows** only.
[source](https://doc.rust-lang.org/src/std/os/windows/io/handle.rs.html#477-479)#### fn as\_handle(&self) -> BorrowedHandle<'\_>
Borrows the handle. [Read more](../os/windows/io/trait.ashandle#tymethod.as_handle)
[source](https://doc.rust-lang.org/src/std/os/fd/raw.rs.html#207-212)1.35.0 · ### impl<'a> AsRawFd for StdinLock<'a>
[source](https://doc.rust-lang.org/src/std/os/fd/raw.rs.html#209-211)#### fn as\_raw\_fd(&self) -> RawFd
Available on **Unix** only.Extracts the raw file descriptor. [Read more](../os/unix/io/trait.asrawfd#tymethod.as_raw_fd)
[source](https://doc.rust-lang.org/src/std/os/windows/io/raw.rs.html#126-130)1.35.0 · ### impl<'a> AsRawHandle for StdinLock<'a>
Available on **Windows** only.
[source](https://doc.rust-lang.org/src/std/os/windows/io/raw.rs.html#127-129)#### fn as\_raw\_handle(&self) -> RawHandle
Extracts the raw handle. [Read more](../os/windows/io/trait.asrawhandle#tymethod.as_raw_handle)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#476-492)### impl BufRead for StdinLock<'\_>
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#477-479)#### fn fill\_buf(&mut self) -> Result<&[u8]>
Returns the contents of the internal buffer, filling it with more data from the inner reader if it is empty. [Read more](trait.bufread#tymethod.fill_buf)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#481-483)#### fn consume(&mut self, n: usize)
Tells this buffer that `amt` bytes have been consumed from the buffer, so they should no longer be returned in calls to `read`. [Read more](trait.bufread#tymethod.consume)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#485-487)#### fn read\_until(&mut self, byte: u8, buf: &mut Vec<u8>) -> Result<usize>
Read all bytes into `buf` until the delimiter `byte` or EOF is reached. [Read more](trait.bufread#method.read_until)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#489-491)#### fn read\_line(&mut self, buf: &mut String) -> Result<usize>
Read all bytes until a newline (the `0xA` byte) is reached, and append them to the provided buffer. You do not need to clear the buffer before appending. [Read more](trait.bufread#method.read_line)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2073-2075)#### fn has\_data\_left(&mut self) -> Result<bool>
🔬This is a nightly-only experimental API. (`buf_read_has_data_left` [#86423](https://github.com/rust-lang/rust/issues/86423))
Check if the underlying `Read` has any data left to be read. [Read more](trait.bufread#method.has_data_left)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2234-2239)#### fn split(self, byte: u8) -> Split<Self>where Self: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Notable traits for [Split](struct.split "struct std::io::Split")<B>
```
impl<B: BufRead> Iterator for Split<B>
type Item = Result<Vec<u8>>;
```
Returns an iterator over the contents of this reader split on the byte `byte`. [Read more](trait.bufread#method.split)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2271-2276)#### fn lines(self) -> Lines<Self>where Self: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Notable traits for [Lines](struct.lines "struct std::io::Lines")<B>
```
impl<B: BufRead> Iterator for Lines<B>
type Item = Result<String>;
```
Returns an iterator over the lines of this reader. [Read more](trait.bufread#method.lines)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#495-499)1.16.0 · ### impl Debug for StdinLock<'\_>
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#496-498)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#448-473)### impl Read for StdinLock<'\_>
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#449-451)#### fn read(&mut self, buf: &mut [u8]) -> Result<usize>
Pull some bytes from this source into the specified buffer, returning how many bytes were read. [Read more](trait.read#tymethod.read)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#453-455)#### fn read\_vectored(&mut self, bufs: &mut [IoSliceMut<'\_>]) -> Result<usize>
Like `read`, except that it reads into a slice of buffers. [Read more](trait.read#method.read_vectored)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#458-460)#### fn is\_read\_vectored(&self) -> bool
🔬This is a nightly-only experimental API. (`can_vector` [#69941](https://github.com/rust-lang/rust/issues/69941))
Determines if this `Read`er has an efficient `read_vectored` implementation. [Read more](trait.read#method.is_read_vectored)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#462-464)#### fn read\_to\_end(&mut self, buf: &mut Vec<u8>) -> Result<usize>
Read all bytes until EOF in this source, placing them into `buf`. [Read more](trait.read#method.read_to_end)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#466-468)#### fn read\_to\_string(&mut self, buf: &mut String) -> Result<usize>
Read all bytes until EOF in this source, appending them to `buf`. [Read more](trait.read#method.read_to_string)
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#470-472)#### fn read\_exact(&mut self, buf: &mut [u8]) -> Result<()>
Read the exact number of bytes required to fill `buf`. [Read more](trait.read#method.read_exact)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#815-817)#### fn read\_buf(&mut self, buf: BorrowedCursor<'\_>) -> Result<()>
🔬This is a nightly-only experimental API. (`read_buf` [#78485](https://github.com/rust-lang/rust/issues/78485))
Pull some bytes from this source into the specified buffer. [Read more](trait.read#method.read_buf)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#824-839)#### fn read\_buf\_exact(&mut self, cursor: BorrowedCursor<'\_>) -> Result<()>
🔬This is a nightly-only experimental API. (`read_buf` [#78485](https://github.com/rust-lang/rust/issues/78485))
Read the exact number of bytes required to fill `cursor`. [Read more](trait.read#method.read_buf_exact)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#876-881)#### fn by\_ref(&mut self) -> &mut Selfwhere Self: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Creates a “by reference” adaptor for this instance of `Read`. [Read more](trait.read#method.by_ref)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#919-924)#### fn bytes(self) -> Bytes<Self>where Self: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Notable traits for [Bytes](struct.bytes "struct std::io::Bytes")<R>
```
impl<R: Read> Iterator for Bytes<R>
type Item = Result<u8>;
```
Transforms this `Read` instance to an [`Iterator`](../iter/trait.iterator "Iterator") over its bytes. [Read more](trait.read#method.bytes)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#957-962)#### fn chain<R: Read>(self, next: R) -> Chain<Self, R>where Self: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Notable traits for [Chain](struct.chain "struct std::io::Chain")<T, U>
```
impl<T: Read, U: Read> Read for Chain<T, U>
```
Creates an adapter which will chain this stream with another. [Read more](trait.read#method.chain)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#996-1001)#### fn take(self, limit: u64) -> Take<Self>where Self: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Notable traits for [Take](struct.take "struct std::io::Take")<T>
```
impl<T: Read> Read for Take<T>
```
Creates an adapter which will read at most `limit` bytes from it. [Read more](trait.read#method.take)
Auto Trait Implementations
--------------------------
### impl<'a> RefUnwindSafe for StdinLock<'a>
### impl<'a> !Send for StdinLock<'a>
### impl<'a> Sync for StdinLock<'a>
### impl<'a> Unpin for StdinLock<'a>
### impl<'a> UnwindSafe for StdinLock<'a>
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Function std::io::sink Function std::io::sink
======================
```
pub fn sink() -> SinkⓘNotable traits for Sinkimpl Write for Sinkimpl Write for &Sink
```
Creates an instance of a writer which will successfully consume all data.
All calls to [`write`](trait.write#tymethod.write) on the returned instance will return `Ok(buf.len())` and the contents of the buffer will not be inspected.
Examples
--------
```
use std::io::{self, Write};
let buffer = vec![1, 2, 3, 5, 8];
let num_bytes = io::sink().write(&buffer).unwrap();
assert_eq!(num_bytes, 5);
```
rust Struct std::io::Take Struct std::io::Take
====================
```
pub struct Take<T> { /* private fields */ }
```
Reader adapter which limits the bytes read from an underlying reader.
This struct is generally created by calling [`take`](trait.read#method.take) on a reader. Please see the documentation of [`take`](trait.read#method.take) for more details.
Implementations
---------------
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2438-2575)### impl<T> Take<T>
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2465-2467)#### pub fn limit(&self) -> u64
Returns the number of bytes that can be read before this instance will return EOF.
##### Note
This instance may reach `EOF` after reading fewer bytes than indicated by this method if the underlying [`Read`](trait.read "Read") instance reaches EOF.
##### Examples
```
use std::io;
use std::io::prelude::*;
use std::fs::File;
fn main() -> io::Result<()> {
let f = File::open("foo.txt")?;
// read at most five bytes
let handle = f.take(5);
println!("limit: {}", handle.limit());
Ok(())
}
```
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2493-2495)1.27.0 · #### pub fn set\_limit(&mut self, limit: u64)
Sets the number of bytes that can be read before this instance will return EOF. This is the same as constructing a new `Take` instance, so the amount of bytes read and the previous limit value don’t matter when calling this method.
##### Examples
```
use std::io;
use std::io::prelude::*;
use std::fs::File;
fn main() -> io::Result<()> {
let f = File::open("foo.txt")?;
// read at most five bytes
let mut handle = f.take(5);
handle.set_limit(10);
assert_eq!(handle.limit(), 10);
Ok(())
}
```
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2518-2520)1.15.0 · #### pub fn into\_inner(self) -> T
Consumes the `Take`, returning the wrapped reader.
##### Examples
```
use std::io;
use std::io::prelude::*;
use std::fs::File;
fn main() -> io::Result<()> {
let mut file = File::open("foo.txt")?;
let mut buffer = [0; 5];
let mut handle = file.take(5);
handle.read(&mut buffer)?;
let file = handle.into_inner();
Ok(())
}
```
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2543-2545)1.20.0 · #### pub fn get\_ref(&self) -> &T
Gets a reference to the underlying reader.
##### Examples
```
use std::io;
use std::io::prelude::*;
use std::fs::File;
fn main() -> io::Result<()> {
let mut file = File::open("foo.txt")?;
let mut buffer = [0; 5];
let mut handle = file.take(5);
handle.read(&mut buffer)?;
let file = handle.get_ref();
Ok(())
}
```
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2572-2574)1.20.0 · #### pub fn get\_mut(&mut self) -> &mut T
Gets a mutable reference to the underlying reader.
Care should be taken to avoid modifying the internal I/O state of the underlying reader as doing so may corrupt the internal limit of this `Take`.
##### Examples
```
use std::io;
use std::io::prelude::*;
use std::fs::File;
fn main() -> io::Result<()> {
let mut file = File::open("foo.txt")?;
let mut buffer = [0; 5];
let mut handle = file.take(5);
handle.read(&mut buffer)?;
let file = handle.get_mut();
Ok(())
}
```
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2641-2659)### impl<T: BufRead> BufRead for Take<T>
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2642-2651)#### fn fill\_buf(&mut self) -> Result<&[u8]>
Returns the contents of the internal buffer, filling it with more data from the inner reader if it is empty. [Read more](trait.bufread#tymethod.fill_buf)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2653-2658)#### fn consume(&mut self, amt: usize)
Tells this buffer that `amt` bytes have been consumed from the buffer, so they should no longer be returned in calls to `read`. [Read more](trait.bufread#tymethod.consume)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2073-2075)#### fn has\_data\_left(&mut self) -> Result<bool>
🔬This is a nightly-only experimental API. (`buf_read_has_data_left` [#86423](https://github.com/rust-lang/rust/issues/86423))
Check if the underlying `Read` has any data left to be read. [Read more](trait.bufread#method.has_data_left)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2132-2134)#### fn read\_until(&mut self, byte: u8, buf: &mut Vec<u8>) -> Result<usize>
Read all bytes into `buf` until the delimiter `byte` or EOF is reached. [Read more](trait.bufread#method.read_until)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2196-2201)#### fn read\_line(&mut self, buf: &mut String) -> Result<usize>
Read all bytes until a newline (the `0xA` byte) is reached, and append them to the provided buffer. You do not need to clear the buffer before appending. [Read more](trait.bufread#method.read_line)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2234-2239)#### fn split(self, byte: u8) -> Split<Self>where Self: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Notable traits for [Split](struct.split "struct std::io::Split")<B>
```
impl<B: BufRead> Iterator for Split<B>
type Item = Result<Vec<u8>>;
```
Returns an iterator over the contents of this reader split on the byte `byte`. [Read more](trait.bufread#method.split)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2271-2276)#### fn lines(self) -> Lines<Self>where Self: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Notable traits for [Lines](struct.lines "struct std::io::Lines")<B>
```
impl<B: BufRead> Iterator for Lines<B>
type Item = Result<String>;
```
Returns an iterator over the lines of this reader. [Read more](trait.bufread#method.lines)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2432)### impl<T: Debug> Debug for Take<T>
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2432)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2578-2638)### impl<T: Read> Read for Take<T>
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2579-2590)#### fn read(&mut self, buf: &mut [u8]) -> Result<usize>
Pull some bytes from this source into the specified buffer, returning how many bytes were read. [Read more](trait.read#tymethod.read)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2592-2637)#### fn read\_buf(&mut self, buf: BorrowedCursor<'\_>) -> Result<()>
🔬This is a nightly-only experimental API. (`read_buf` [#78485](https://github.com/rust-lang/rust/issues/78485))
Pull some bytes from this source into the specified buffer. [Read more](trait.read#method.read_buf)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#642-644)1.36.0 · #### fn read\_vectored(&mut self, bufs: &mut [IoSliceMut<'\_>]) -> Result<usize>
Like `read`, except that it reads into a slice of buffers. [Read more](trait.read#method.read_vectored)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#655-657)#### fn is\_read\_vectored(&self) -> bool
🔬This is a nightly-only experimental API. (`can_vector` [#69941](https://github.com/rust-lang/rust/issues/69941))
Determines if this `Read`er has an efficient `read_vectored` implementation. [Read more](trait.read#method.is_read_vectored)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#706-708)#### fn read\_to\_end(&mut self, buf: &mut Vec<u8>) -> Result<usize>
Read all bytes until EOF in this source, placing them into `buf`. [Read more](trait.read#method.read_to_end)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#749-751)#### fn read\_to\_string(&mut self, buf: &mut String) -> Result<usize>
Read all bytes until EOF in this source, appending them to `buf`. [Read more](trait.read#method.read_to_string)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#804-806)1.6.0 · #### fn read\_exact(&mut self, buf: &mut [u8]) -> Result<()>
Read the exact number of bytes required to fill `buf`. [Read more](trait.read#method.read_exact)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#824-839)#### fn read\_buf\_exact(&mut self, cursor: BorrowedCursor<'\_>) -> Result<()>
🔬This is a nightly-only experimental API. (`read_buf` [#78485](https://github.com/rust-lang/rust/issues/78485))
Read the exact number of bytes required to fill `cursor`. [Read more](trait.read#method.read_buf_exact)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#876-881)#### fn by\_ref(&mut self) -> &mut Selfwhere Self: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Creates a “by reference” adaptor for this instance of `Read`. [Read more](trait.read#method.by_ref)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#919-924)#### fn bytes(self) -> Bytes<Self>where Self: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Notable traits for [Bytes](struct.bytes "struct std::io::Bytes")<R>
```
impl<R: Read> Iterator for Bytes<R>
type Item = Result<u8>;
```
Transforms this `Read` instance to an [`Iterator`](../iter/trait.iterator "Iterator") over its bytes. [Read more](trait.read#method.bytes)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#957-962)#### fn chain<R: Read>(self, next: R) -> Chain<Self, R>where Self: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Notable traits for [Chain](struct.chain "struct std::io::Chain")<T, U>
```
impl<T: Read, U: Read> Read for Chain<T, U>
```
Creates an adapter which will chain this stream with another. [Read more](trait.read#method.chain)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#996-1001)#### fn take(self, limit: u64) -> Take<Self>where Self: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Notable traits for [Take](struct.take "struct std::io::Take")<T>
```
impl<T: Read> Read for Take<T>
```
Creates an adapter which will read at most `limit` bytes from it. [Read more](trait.read#method.take)
Auto Trait Implementations
--------------------------
### impl<T> RefUnwindSafe for Take<T>where T: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<T> Send for Take<T>where T: [Send](../marker/trait.send "trait std::marker::Send"),
### impl<T> Sync for Take<T>where T: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<T> Unpin for Take<T>where T: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"),
### impl<T> UnwindSafe for Take<T>where T: [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"),
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
rust Function std::io::stderr Function std::io::stderr
========================
```
pub fn stderr() -> StderrⓘNotable traits for Stderrimpl Write for Stderrimpl Write for &Stderr
```
Constructs a new handle to the standard error of the current process.
This handle is not buffered.
#### Note: Windows Portability Considerations
When operating in a console, the Windows implementation of this stream does not support non-UTF-8 byte sequences. Attempting to write bytes that are not valid UTF-8 will return an error.
In a process with a detached console, such as one using `#![windows_subsystem = "windows"]`, or in a child process spawned from such a process, the contained handle will be null. In such cases, the standard library’s `Read` and `Write` will do nothing and silently succeed. All other I/O operations, via the standard library or via raw Windows API calls, will fail.
Examples
--------
Using implicit synchronization:
```
use std::io::{self, Write};
fn main() -> io::Result<()> {
io::stderr().write_all(b"hello world")?;
Ok(())
}
```
Using explicit synchronization:
```
use std::io::{self, Write};
fn main() -> io::Result<()> {
let stderr = io::stderr();
let mut handle = stderr.lock();
handle.write_all(b"hello world")?;
Ok(())
}
```
rust Struct std::io::Error Struct std::io::Error
=====================
```
pub struct Error { /* private fields */ }
```
The error type for I/O operations of the [`Read`](trait.read), [`Write`](trait.write), [`Seek`](trait.seek), and associated traits.
Errors mostly originate from the underlying OS, but custom instances of `Error` can be created with crafted error messages and a particular value of [`ErrorKind`](enum.errorkind "ErrorKind").
Implementations
---------------
[source](https://doc.rust-lang.org/src/std/io/error.rs.html#477-900)### impl Error
[source](https://doc.rust-lang.org/src/std/io/error.rs.html#503-508)#### pub fn new<E>(kind: ErrorKind, error: E) -> Errorwhere E: [Into](../convert/trait.into "trait std::convert::Into")<[Box](../boxed/struct.box "struct std::boxed::Box")<dyn [Error](../error/trait.error "trait std::error::Error") + [Send](../marker/trait.send "trait std::marker::Send") + [Sync](../marker/trait.sync "trait std::marker::Sync")>>,
Creates a new I/O error from a known kind of error as well as an arbitrary error payload.
This function is used to generically create I/O errors which do not originate from the OS itself. The `error` argument is an arbitrary payload which will be contained in this [`Error`](struct.error "Error").
If no extra payload is required, use the `From` conversion from `ErrorKind`.
##### Examples
```
use std::io::{Error, ErrorKind};
// errors can be created from strings
let custom_error = Error::new(ErrorKind::Other, "oh no!");
// errors can also be created from other errors
let custom_error2 = Error::new(ErrorKind::Interrupted, custom_error);
// creating an error without payload
let eof_error = Error::from(ErrorKind::UnexpectedEof);
```
[source](https://doc.rust-lang.org/src/std/io/error.rs.html#530-535)#### pub fn other<E>(error: E) -> Errorwhere E: [Into](../convert/trait.into "trait std::convert::Into")<[Box](../boxed/struct.box "struct std::boxed::Box")<dyn [Error](../error/trait.error "trait std::error::Error") + [Send](../marker/trait.send "trait std::marker::Send") + [Sync](../marker/trait.sync "trait std::marker::Sync")>>,
🔬This is a nightly-only experimental API. (`io_error_other` [#91946](https://github.com/rust-lang/rust/issues/91946))
Creates a new I/O error from an arbitrary error payload.
This function is used to generically create I/O errors which do not originate from the OS itself. It is a shortcut for [`Error::new`](struct.error#method.new "Error::new") with [`ErrorKind::Other`](enum.errorkind#variant.Other "ErrorKind::Other").
##### Examples
```
#![feature(io_error_other)]
use std::io::Error;
// errors can be created from strings
let custom_error = Error::other("oh no!");
// errors can also be created from other errors
let custom_error2 = Error::other(custom_error);
```
[source](https://doc.rust-lang.org/src/std/io/error.rs.html#580-582)#### pub fn last\_os\_error() -> Error
Returns an error representing the last OS error which occurred.
This function reads the value of `errno` for the target platform (e.g. `GetLastError` on Windows) and will return a corresponding instance of [`Error`](struct.error "Error") for the error code.
This should be called immediately after a call to a platform function, otherwise the state of the error value is indeterminate. In particular, other standard library functions may call platform functions that may (or may not) reset the error value even if they succeed.
##### Examples
```
use std::io::Error;
let os_error = Error::last_os_error();
println!("last OS error: {os_error:?}");
```
[source](https://doc.rust-lang.org/src/std/io/error.rs.html#612-614)#### pub fn from\_raw\_os\_error(code: i32) -> Error
Creates a new instance of an [`Error`](struct.error "Error") from a particular OS error code.
##### Examples
On Linux:
```
use std::io;
let error = io::Error::from_raw_os_error(22);
assert_eq!(error.kind(), io::ErrorKind::InvalidInput);
```
On Windows:
```
use std::io;
let error = io::Error::from_raw_os_error(10022);
assert_eq!(error.kind(), io::ErrorKind::InvalidInput);
```
[source](https://doc.rust-lang.org/src/std/io/error.rs.html#648-655)#### pub fn raw\_os\_error(&self) -> Option<i32>
Returns the OS error that this error represents (if any).
If this [`Error`](struct.error "Error") was constructed via [`last_os_error`](struct.error#method.last_os_error) or [`from_raw_os_error`](struct.error#method.from_raw_os_error), then this function will return [`Some`](../option/enum.option#variant.Some "Some"), otherwise it will return [`None`](../option/enum.option#variant.None "None").
##### Examples
```
use std::io::{Error, ErrorKind};
fn print_os_error(err: &Error) {
if let Some(raw_os_err) = err.raw_os_error() {
println!("raw OS error: {raw_os_err:?}");
} else {
println!("Not an OS error");
}
}
fn main() {
// Will print "raw OS error: ...".
print_os_error(&Error::last_os_error());
// Will print "Not an OS error".
print_os_error(&Error::new(ErrorKind::Other, "oh no!"));
}
```
[source](https://doc.rust-lang.org/src/std/io/error.rs.html#687-694)1.3.0 · #### pub fn get\_ref(&self) -> Option<&(dyn Error + Send + Sync + 'static)>
Returns a reference to the inner error wrapped by this error (if any).
If this [`Error`](struct.error "Error") was constructed via [`new`](struct.error#method.new) then this function will return [`Some`](../option/enum.option#variant.Some "Some"), otherwise it will return [`None`](../option/enum.option#variant.None "None").
##### Examples
```
use std::io::{Error, ErrorKind};
fn print_error(err: &Error) {
if let Some(inner_err) = err.get_ref() {
println!("Inner error: {inner_err:?}");
} else {
println!("No inner error");
}
}
fn main() {
// Will print "No inner error".
print_error(&Error::last_os_error());
// Will print "Inner error: ...".
print_error(&Error::new(ErrorKind::Other, "oh no!"));
}
```
[source](https://doc.rust-lang.org/src/std/io/error.rs.html#761-768)1.3.0 · #### pub fn get\_mut(&mut self) -> Option<&mut (dyn Error + Send + Sync + 'static)>
Returns a mutable reference to the inner error wrapped by this error (if any).
If this [`Error`](struct.error "Error") was constructed via [`new`](struct.error#method.new) then this function will return [`Some`](../option/enum.option#variant.Some "Some"), otherwise it will return [`None`](../option/enum.option#variant.None "None").
##### Examples
```
use std::io::{Error, ErrorKind};
use std::{error, fmt};
use std::fmt::Display;
#[derive(Debug)]
struct MyError {
v: String,
}
impl MyError {
fn new() -> MyError {
MyError {
v: "oh no!".to_string()
}
}
fn change_message(&mut self, new_message: &str) {
self.v = new_message.to_string();
}
}
impl error::Error for MyError {}
impl Display for MyError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "MyError: {}", &self.v)
}
}
fn change_error(mut err: Error) -> Error {
if let Some(inner_err) = err.get_mut() {
inner_err.downcast_mut::<MyError>().unwrap().change_message("I've been changed!");
}
err
}
fn print_error(err: &Error) {
if let Some(inner_err) = err.get_ref() {
println!("Inner error: {inner_err}");
} else {
println!("No inner error");
}
}
fn main() {
// Will print "No inner error".
print_error(&change_error(Error::last_os_error()));
// Will print "Inner error: ...".
print_error(&change_error(Error::new(ErrorKind::Other, MyError::new())));
}
```
[source](https://doc.rust-lang.org/src/std/io/error.rs.html#800-807)1.3.0 · #### pub fn into\_inner(self) -> Option<Box<dyn Error + Send + Sync>>
Consumes the `Error`, returning its inner error (if any).
If this [`Error`](struct.error "Error") was constructed via [`new`](struct.error#method.new) then this function will return [`Some`](../option/enum.option#variant.Some "Some"), otherwise it will return [`None`](../option/enum.option#variant.None "None").
##### Examples
```
use std::io::{Error, ErrorKind};
fn print_error(err: Error) {
if let Some(inner_err) = err.into_inner() {
println!("Inner error: {inner_err}");
} else {
println!("No inner error");
}
}
fn main() {
// Will print "No inner error".
print_error(Error::last_os_error());
// Will print "Inner error: ...".
print_error(Error::new(ErrorKind::Other, "oh no!"));
}
```
[source](https://doc.rust-lang.org/src/std/io/error.rs.html#851-869)#### pub fn downcast<E>(self) -> Result<Box<E>, Self>where E: [Error](../error/trait.error "trait std::error::Error") + [Send](../marker/trait.send "trait std::marker::Send") + [Sync](../marker/trait.sync "trait std::marker::Sync") + 'static,
🔬This is a nightly-only experimental API. (`io_error_downcast` [#99262](https://github.com/rust-lang/rust/issues/99262))
Attempt to downgrade the inner error to `E` if any.
If this [`Error`](struct.error "Error") was constructed via [`new`](struct.error#method.new) then this function will attempt to perform downgrade on it, otherwise it will return [`Err`](../result/enum.result#variant.Err "Err").
If downgrade succeeds, it will return [`Ok`](../result/enum.result#variant.Ok "Ok"), otherwise it will also return [`Err`](../result/enum.result#variant.Err "Err").
##### Examples
```
#![feature(io_error_downcast)]
use std::fmt;
use std::io;
use std::error::Error;
#[derive(Debug)]
enum E {
Io(io::Error),
SomeOtherVariant,
}
impl fmt::Display for E {
// ...
}
impl Error for E {}
impl From<io::Error> for E {
fn from(err: io::Error) -> E {
err.downcast::<E>()
.map(|b| *b)
.unwrap_or_else(E::Io)
}
}
```
[source](https://doc.rust-lang.org/src/std/io/error.rs.html#892-899)#### pub fn kind(&self) -> ErrorKind
Returns the corresponding [`ErrorKind`](enum.errorkind "ErrorKind") for this error.
##### Examples
```
use std::io::{Error, ErrorKind};
fn print_error(err: Error) {
println!("{:?}", err.kind());
}
fn main() {
// Will print "Uncategorized".
print_error(Error::last_os_error());
// Will print "AddrInUse".
print_error(Error::new(ErrorKind::AddrInUse, "oh no!"));
}
```
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/std/io/error.rs.html#73-77)### impl Debug for Error
[source](https://doc.rust-lang.org/src/std/io/error.rs.html#74-76)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/std/io/error.rs.html#923-935)### impl Display for Error
[source](https://doc.rust-lang.org/src/std/io/error.rs.html#924-934)#### fn fmt(&self, fmt: &mut Formatter<'\_>) -> Result
Formats the value using the given formatter. [Read more](../fmt/trait.display#tymethod.fmt)
[source](https://doc.rust-lang.org/src/std/io/error.rs.html#938-966)### impl Error for Error
[source](https://doc.rust-lang.org/src/std/io/error.rs.html#940-946)#### fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to\_string()
[Read more](../error/trait.error#method.description)
[source](https://doc.rust-lang.org/src/std/io/error.rs.html#949-956)#### fn cause(&self) -> Option<&dyn Error>
👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
[source](https://doc.rust-lang.org/src/std/io/error.rs.html#958-965)#### fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. [Read more](../error/trait.error#method.source)
[source](https://doc.rust-lang.org/src/core/error.rs.html#193)#### fn provide(&'a self, demand: &mut Demand<'a>)
🔬This is a nightly-only experimental API. (`error_generic_member_access` [#99301](https://github.com/rust-lang/rust/issues/99301))
Provides type based access to context intended for error reports. [Read more](../error/trait.error#method.provide)
[source](https://doc.rust-lang.org/src/std/io/error.rs.html#457-475)1.14.0 · ### impl From<ErrorKind> for Error
Intended for use for errors not exposed to the user, where allocating onto the heap (for normal construction via Error::new) is too costly.
[source](https://doc.rust-lang.org/src/std/io/error.rs.html#472-474)#### fn from(kind: ErrorKind) -> Error
Converts an [`ErrorKind`](enum.errorkind "ErrorKind") into an [`Error`](struct.error "Error").
This conversion creates a new error with a simple representation of error kind.
##### Examples
```
use std::io::{Error, ErrorKind};
let not_found = ErrorKind::NotFound;
let error = Error::from(not_found);
assert_eq!("entity not found", format!("{error}"));
```
[source](https://doc.rust-lang.org/src/std/io/buffered/mod.rs.html#177-181)### impl<W> From<IntoInnerError<W>> for Error
[source](https://doc.rust-lang.org/src/std/io/buffered/mod.rs.html#178-180)#### fn from(iie: IntoInnerError<W>) -> Error
Converts to this type from the input type.
[source](https://doc.rust-lang.org/src/std/io/error.rs.html#81-86)### impl From<NulError> for Error
[source](https://doc.rust-lang.org/src/std/io/error.rs.html#83-85)#### fn from(\_: NulError) -> Error
Converts a [`alloc::ffi::NulError`](../ffi/struct.nulerror "alloc::ffi::NulError") into a [`Error`](struct.error "Error").
Auto Trait Implementations
--------------------------
### impl !RefUnwindSafe for Error
### impl Send for Error
### impl Sync for Error
### impl Unpin for Error
### impl !UnwindSafe for Error
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/error.rs.html#197)### impl<E> Provider for Ewhere E: [Error](../error/trait.error "trait std::error::Error") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/error.rs.html#201)#### fn provide(&'a self, demand: &mut Demand<'a>)
🔬This is a nightly-only experimental API. (`provide_any` [#96024](https://github.com/rust-lang/rust/issues/96024))
Data providers should implement this method to provide *all* values they are able to provide by using `demand`. [Read more](../any/trait.provider#tymethod.provide)
[source](https://doc.rust-lang.org/src/alloc/string.rs.html#2500)### impl<T> ToString for Twhere T: [Display](../fmt/trait.display "trait std::fmt::Display") + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/alloc/string.rs.html#2506)#### default fn to\_string(&self) -> String
Converts the given value to a `String`. [Read more](../string/trait.tostring#tymethod.to_string)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Function std::io::repeat Function std::io::repeat
========================
```
pub fn repeat(byte: u8) -> RepeatⓘNotable traits for Repeatimpl Read for Repeat
```
Creates an instance of a reader that infinitely repeats one byte.
All reads from this reader will succeed by filling the specified buffer with the given byte.
Examples
--------
```
use std::io::{self, Read};
let mut buffer = [0; 3];
io::repeat(0b101).read_exact(&mut buffer).unwrap();
assert_eq!(buffer, [0b101, 0b101, 0b101]);
```
rust Struct std::io::Empty Struct std::io::Empty
=====================
```
#[non_exhaustive]pub struct Empty;
```
A reader which is always at EOF.
This struct is generally created by calling [`empty()`](fn.empty "empty()"). Please see the documentation of [`empty()`](fn.empty "empty()") for more details.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/std/io/util.rs.html#55-62)### impl BufRead for Empty
[source](https://doc.rust-lang.org/src/std/io/util.rs.html#57-59)#### fn fill\_buf(&mut self) -> Result<&[u8]>
Returns the contents of the internal buffer, filling it with more data from the inner reader if it is empty. [Read more](trait.bufread#tymethod.fill_buf)
[source](https://doc.rust-lang.org/src/std/io/util.rs.html#61)#### fn consume(&mut self, \_n: usize)
Tells this buffer that `amt` bytes have been consumed from the buffer, so they should no longer be returned in calls to `read`. [Read more](trait.bufread#tymethod.consume)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2073-2075)#### fn has\_data\_left(&mut self) -> Result<bool>
🔬This is a nightly-only experimental API. (`buf_read_has_data_left` [#86423](https://github.com/rust-lang/rust/issues/86423))
Check if the underlying `Read` has any data left to be read. [Read more](trait.bufread#method.has_data_left)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2132-2134)#### fn read\_until(&mut self, byte: u8, buf: &mut Vec<u8>) -> Result<usize>
Read all bytes into `buf` until the delimiter `byte` or EOF is reached. [Read more](trait.bufread#method.read_until)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2196-2201)#### fn read\_line(&mut self, buf: &mut String) -> Result<usize>
Read all bytes until a newline (the `0xA` byte) is reached, and append them to the provided buffer. You do not need to clear the buffer before appending. [Read more](trait.bufread#method.read_line)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2234-2239)#### fn split(self, byte: u8) -> Split<Self>where Self: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Notable traits for [Split](struct.split "struct std::io::Split")<B>
```
impl<B: BufRead> Iterator for Split<B>
type Item = Result<Vec<u8>>;
```
Returns an iterator over the contents of this reader split on the byte `byte`. [Read more](trait.bufread#method.split)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2271-2276)#### fn lines(self) -> Lines<Self>where Self: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Notable traits for [Lines](struct.lines "struct std::io::Lines")<B>
```
impl<B: BufRead> Iterator for Lines<B>
type Item = Result<String>;
```
Returns an iterator over the lines of this reader. [Read more](trait.bufread#method.lines)
[source](https://doc.rust-lang.org/src/std/io/util.rs.html#17)### impl Clone for Empty
[source](https://doc.rust-lang.org/src/std/io/util.rs.html#17)#### fn clone(&self) -> Empty
Notable traits for [Empty](struct.empty "struct std::io::Empty")
```
impl Read for Empty
```
Returns a copy of the value. [Read more](../clone/trait.clone#tymethod.clone)
[source](https://doc.rust-lang.org/src/core/clone.rs.html#132-134)#### fn clone\_from(&mut self, source: &Self)
Performs copy-assignment from `source`. [Read more](../clone/trait.clone#method.clone_from)
[source](https://doc.rust-lang.org/src/std/io/util.rs.html#80-84)1.16.0 · ### impl Debug for Empty
[source](https://doc.rust-lang.org/src/std/io/util.rs.html#81-83)#### fn fmt(&self, f: &mut Formatter<'\_>) -> Result
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/std/io/util.rs.html#17)### impl Default for Empty
[source](https://doc.rust-lang.org/src/std/io/util.rs.html#17)#### fn default() -> Empty
Notable traits for [Empty](struct.empty "struct std::io::Empty")
```
impl Read for Empty
```
Returns the “default value” for a type. [Read more](../default/trait.default#tymethod.default)
[source](https://doc.rust-lang.org/src/std/io/util.rs.html#43-53)### impl Read for Empty
[source](https://doc.rust-lang.org/src/std/io/util.rs.html#45-47)#### fn read(&mut self, \_buf: &mut [u8]) -> Result<usize>
Pull some bytes from this source into the specified buffer, returning how many bytes were read. [Read more](trait.read#tymethod.read)
[source](https://doc.rust-lang.org/src/std/io/util.rs.html#50-52)#### fn read\_buf(&mut self, \_cursor: BorrowedCursor<'\_>) -> Result<()>
🔬This is a nightly-only experimental API. (`read_buf` [#78485](https://github.com/rust-lang/rust/issues/78485))
Pull some bytes from this source into the specified buffer. [Read more](trait.read#method.read_buf)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#642-644)1.36.0 · #### fn read\_vectored(&mut self, bufs: &mut [IoSliceMut<'\_>]) -> Result<usize>
Like `read`, except that it reads into a slice of buffers. [Read more](trait.read#method.read_vectored)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#655-657)#### fn is\_read\_vectored(&self) -> bool
🔬This is a nightly-only experimental API. (`can_vector` [#69941](https://github.com/rust-lang/rust/issues/69941))
Determines if this `Read`er has an efficient `read_vectored` implementation. [Read more](trait.read#method.is_read_vectored)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#706-708)#### fn read\_to\_end(&mut self, buf: &mut Vec<u8>) -> Result<usize>
Read all bytes until EOF in this source, placing them into `buf`. [Read more](trait.read#method.read_to_end)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#749-751)#### fn read\_to\_string(&mut self, buf: &mut String) -> Result<usize>
Read all bytes until EOF in this source, appending them to `buf`. [Read more](trait.read#method.read_to_string)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#804-806)1.6.0 · #### fn read\_exact(&mut self, buf: &mut [u8]) -> Result<()>
Read the exact number of bytes required to fill `buf`. [Read more](trait.read#method.read_exact)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#824-839)#### fn read\_buf\_exact(&mut self, cursor: BorrowedCursor<'\_>) -> Result<()>
🔬This is a nightly-only experimental API. (`read_buf` [#78485](https://github.com/rust-lang/rust/issues/78485))
Read the exact number of bytes required to fill `cursor`. [Read more](trait.read#method.read_buf_exact)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#876-881)#### fn by\_ref(&mut self) -> &mut Selfwhere Self: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Creates a “by reference” adaptor for this instance of `Read`. [Read more](trait.read#method.by_ref)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#919-924)#### fn bytes(self) -> Bytes<Self>where Self: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Notable traits for [Bytes](struct.bytes "struct std::io::Bytes")<R>
```
impl<R: Read> Iterator for Bytes<R>
type Item = Result<u8>;
```
Transforms this `Read` instance to an [`Iterator`](../iter/trait.iterator "Iterator") over its bytes. [Read more](trait.read#method.bytes)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#957-962)#### fn chain<R: Read>(self, next: R) -> Chain<Self, R>where Self: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Notable traits for [Chain](struct.chain "struct std::io::Chain")<T, U>
```
impl<T: Read, U: Read> Read for Chain<T, U>
```
Creates an adapter which will chain this stream with another. [Read more](trait.read#method.chain)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#996-1001)#### fn take(self, limit: u64) -> Take<Self>where Self: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Notable traits for [Take](struct.take "struct std::io::Take")<T>
```
impl<T: Read> Read for Take<T>
```
Creates an adapter which will read at most `limit` bytes from it. [Read more](trait.read#method.take)
[source](https://doc.rust-lang.org/src/std/io/util.rs.html#65-77)1.51.0 · ### impl Seek for Empty
[source](https://doc.rust-lang.org/src/std/io/util.rs.html#66-68)#### fn seek(&mut self, \_pos: SeekFrom) -> Result<u64>
Seek to an offset, in bytes, in a stream. [Read more](trait.seek#tymethod.seek)
[source](https://doc.rust-lang.org/src/std/io/util.rs.html#70-72)#### fn stream\_len(&mut self) -> Result<u64>
🔬This is a nightly-only experimental API. (`seek_stream_len` [#59359](https://github.com/rust-lang/rust/issues/59359))
Returns the length of this stream (in bytes). [Read more](trait.seek#method.stream_len)
[source](https://doc.rust-lang.org/src/std/io/util.rs.html#74-76)#### fn stream\_position(&mut self) -> Result<u64>
Returns the current seek position from the start of the stream. [Read more](trait.seek#method.stream_position)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1796-1799)1.55.0 · #### fn rewind(&mut self) -> Result<()>
Rewind to the beginning of a stream. [Read more](trait.seek#method.rewind)
[source](https://doc.rust-lang.org/src/std/io/util.rs.html#17)### impl Copy for Empty
Auto Trait Implementations
--------------------------
### impl RefUnwindSafe for Empty
### impl Send for Empty
### impl Sync for Empty
### impl Unpin for Empty
### impl UnwindSafe for Empty
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#83)### impl<T> ToOwned for Twhere T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
#### type Owned = T
The resulting type after obtaining ownership.
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#88)#### fn to\_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. [Read more](../borrow/trait.toowned#tymethod.to_owned)
[source](https://doc.rust-lang.org/src/alloc/borrow.rs.html#92)#### fn clone\_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. [Read more](../borrow/trait.toowned#method.clone_into)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
rust Trait std::io::Write Trait std::io::Write
====================
```
pub trait Write {
fn write(&mut self, buf: &[u8]) -> Result<usize>;
fn flush(&mut self) -> Result<()>;
fn write_vectored(&mut self, bufs: &[IoSlice<'_>]) -> Result<usize> { ... }
fn is_write_vectored(&self) -> bool { ... }
fn write_all(&mut self, buf: &[u8]) -> Result<()> { ... }
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<()> { ... }
fn write_fmt(&mut self, fmt: Arguments<'_>) -> Result<()> { ... }
fn by_ref(&mut self) -> &mut Self where Self: Sized,
{ ... }
}
```
A trait for objects which are byte-oriented sinks.
Implementors of the `Write` trait are sometimes called ‘writers’.
Writers are defined by two required methods, [`write`](trait.write#tymethod.write) and [`flush`](trait.write#tymethod.flush):
* The [`write`](trait.write#tymethod.write) method will attempt to write some data into the object, returning how many bytes were successfully written.
* The [`flush`](trait.write#tymethod.flush) method is useful for adapters and explicit buffers themselves for ensuring that all buffered data has been pushed out to the ‘true sink’.
Writers are intended to be composable with one another. Many implementors throughout [`std::io`](index) take and provide types which implement the `Write` trait.
Examples
--------
```
use std::io::prelude::*;
use std::fs::File;
fn main() -> std::io::Result<()> {
let data = b"some bytes";
let mut pos = 0;
let mut buffer = File::create("foo.txt")?;
while pos < data.len() {
let bytes_written = buffer.write(&data[pos..])?;
pos += bytes_written;
}
Ok(())
}
```
The trait also provides convenience methods like [`write_all`](trait.write#method.write_all), which calls `write` in a loop until its entire input has been written.
Required Methods
----------------
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1426)#### fn write(&mut self, buf: &[u8]) -> Result<usize>
Write a buffer into this writer, returning how many bytes were written.
This function will attempt to write the entire contents of `buf`, but the entire write might not succeed, or the write may also generate an error. A call to `write` represents *at most one* attempt to write to any wrapped object.
Calls to `write` are not guaranteed to block waiting for data to be written, and a write which would otherwise block can be indicated through an [`Err`](../result/enum.result#variant.Err "Err") variant.
If the return value is [`Ok(n)`](../result/enum.result#variant.Ok) then it must be guaranteed that `n <= buf.len()`. A return value of `0` typically means that the underlying object is no longer able to accept bytes and will likely not be able to in the future as well, or that the buffer provided is empty.
##### Errors
Each call to `write` may generate an I/O error indicating that the operation could not be completed. If an error is returned then no bytes in the buffer were written to this writer.
It is **not** considered an error if the entire buffer could not be written to this writer.
An error of the [`ErrorKind::Interrupted`](enum.errorkind#variant.Interrupted "ErrorKind::Interrupted") kind is non-fatal and the write operation should be retried if there is nothing else to do.
##### Examples
```
use std::io::prelude::*;
use std::fs::File;
fn main() -> std::io::Result<()> {
let mut buffer = File::create("foo.txt")?;
// Writes some prefix of the byte string, not necessarily all of it.
buffer.write(b"some bytes")?;
Ok(())
}
```
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1503)#### fn flush(&mut self) -> Result<()>
Flush this output stream, ensuring that all intermediately buffered contents reach their destination.
##### Errors
It is considered an error if not all bytes could be written due to I/O errors or EOF being reached.
##### Examples
```
use std::io::prelude::*;
use std::io::BufWriter;
use std::fs::File;
fn main() -> std::io::Result<()> {
let mut buffer = BufWriter::new(File::create("foo.txt")?);
buffer.write_all(b"some bytes")?;
buffer.flush()?;
Ok(())
}
```
Provided Methods
----------------
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1460-1462)1.36.0 · #### fn write\_vectored(&mut self, bufs: &[IoSlice<'\_>]) -> Result<usize>
Like [`write`](trait.write#tymethod.write), except that it writes from a slice of buffers.
Data is copied from each buffer in order, with the final buffer read from possibly being only partially consumed. This method must behave as a call to [`write`](trait.write#tymethod.write) with the buffers concatenated would.
The default implementation calls [`write`](trait.write#tymethod.write) with either the first nonempty buffer provided, or an empty one if none exists.
##### Examples
```
use std::io::IoSlice;
use std::io::prelude::*;
use std::fs::File;
fn main() -> std::io::Result<()> {
let data1 = [1; 8];
let data2 = [15; 8];
let io_slice1 = IoSlice::new(&data1);
let io_slice2 = IoSlice::new(&data2);
let mut buffer = File::create("foo.txt")?;
// Writes some prefix of the byte string, not necessarily all of it.
buffer.write_vectored(&[io_slice1, io_slice2])?;
Ok(())
}
```
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1475-1477)#### fn is\_write\_vectored(&self) -> bool
🔬This is a nightly-only experimental API. (`can_vector` [#69941](https://github.com/rust-lang/rust/issues/69941))
Determines if this `Write`r has an efficient [`write_vectored`](trait.write#method.write_vectored) implementation.
If a `Write`r does not override the default [`write_vectored`](trait.write#method.write_vectored) implementation, code using it may want to avoid the method all together and coalesce writes into a single buffer for higher performance.
The default implementation returns `false`.
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1537-1552)#### fn write\_all(&mut self, buf: &[u8]) -> Result<()>
Attempts to write an entire buffer into this writer.
This method will continuously call [`write`](trait.write#tymethod.write) until there is no more data to be written or an error of non-[`ErrorKind::Interrupted`](enum.errorkind#variant.Interrupted "ErrorKind::Interrupted") kind is returned. This method will not return until the entire buffer has been successfully written or such an error occurs. The first error that is not of [`ErrorKind::Interrupted`](enum.errorkind#variant.Interrupted "ErrorKind::Interrupted") kind generated from this method will be returned.
If the buffer contains no data, this will never call [`write`](trait.write#tymethod.write).
##### Errors
This function will return the first error of non-[`ErrorKind::Interrupted`](enum.errorkind#variant.Interrupted "ErrorKind::Interrupted") kind that [`write`](trait.write#tymethod.write) returns.
##### Examples
```
use std::io::prelude::*;
use std::fs::File;
fn main() -> std::io::Result<()> {
let mut buffer = File::create("foo.txt")?;
buffer.write_all(b"some bytes")?;
Ok(())
}
```
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1602-1620)#### fn write\_all\_vectored(&mut self, bufs: &mut [IoSlice<'\_>]) -> Result<()>
🔬This is a nightly-only experimental API. (`write_all_vectored` [#70436](https://github.com/rust-lang/rust/issues/70436))
Attempts to write multiple buffers into this writer.
This method will continuously call [`write_vectored`](trait.write#method.write_vectored) until there is no more data to be written or an error of non-[`ErrorKind::Interrupted`](enum.errorkind#variant.Interrupted "ErrorKind::Interrupted") kind is returned. This method will not return until all buffers have been successfully written or such an error occurs. The first error that is not of [`ErrorKind::Interrupted`](enum.errorkind#variant.Interrupted "ErrorKind::Interrupted") kind generated from this method will be returned.
If the buffer contains no data, this will never call [`write_vectored`](trait.write#method.write_vectored).
##### Notes
Unlike [`write_vectored`](trait.write#method.write_vectored), this takes a *mutable* reference to a slice of [`IoSlice`](struct.ioslice "IoSlice")s, not an immutable one. That’s because we need to modify the slice to keep track of the bytes already written.
Once this function returns, the contents of `bufs` are unspecified, as this depends on how many calls to [`write_vectored`](trait.write#method.write_vectored) were necessary. It is best to understand this function as taking ownership of `bufs` and to not use `bufs` afterwards. The underlying buffers, to which the [`IoSlice`](struct.ioslice "IoSlice")s point (but not the [`IoSlice`](struct.ioslice "IoSlice")s themselves), are unchanged and can be reused.
##### Examples
```
#![feature(write_all_vectored)]
use std::io::{Write, IoSlice};
let mut writer = Vec::new();
let bufs = &mut [
IoSlice::new(&[1]),
IoSlice::new(&[2, 3]),
IoSlice::new(&[4, 5, 6]),
];
writer.write_all_vectored(bufs)?;
// Note: the contents of `bufs` is now undefined, see the Notes section.
assert_eq!(writer, &[1, 2, 3, 4, 5, 6]);
```
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1658-1690)#### fn write\_fmt(&mut self, fmt: Arguments<'\_>) -> Result<()>
Writes a formatted string into this writer, returning any error encountered.
This method is primarily used to interface with the [`format_args!()`](../macro.format_args "format_args!()") macro, and it is rare that this should explicitly be called. The [`write!()`](../macro.write "write!()") macro should be favored to invoke this method instead.
This function internally uses the [`write_all`](trait.write#method.write_all) method on this trait and hence will continuously write data so long as no errors are received. This also means that partial writes are not indicated in this signature.
##### Errors
This function will return any I/O error reported while formatting.
##### Examples
```
use std::io::prelude::*;
use std::fs::File;
fn main() -> std::io::Result<()> {
let mut buffer = File::create("foo.txt")?;
// this call
write!(buffer, "{:.*}", 2, 1.234567)?;
// turns into this:
buffer.write_fmt(format_args!("{:.*}", 2, 1.234567))?;
Ok(())
}
```
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1714-1719)#### fn by\_ref(&mut self) -> &mut Selfwhere Self: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Creates a “by reference” adapter for this instance of `Write`.
The returned adapter also implements `Write` and will simply borrow this current writer.
##### Examples
```
use std::io::Write;
use std::fs::File;
fn main() -> std::io::Result<()> {
let mut buffer = File::create("foo.txt")?;
let reference = buffer.by_ref();
// we can use reference just like our original buffer
reference.write_all(b"some bytes")?;
Ok(())
}
```
Implementors
------------
[source](https://doc.rust-lang.org/src/std/fs.rs.html#813-830)### impl Write for &File
[source](https://doc.rust-lang.org/src/std/net/tcp.rs.html#666-683)### impl Write for &TcpStream
[source](https://doc.rust-lang.org/src/std/process.rs.html#288-304)1.48.0 · ### impl Write for &ChildStdin
[source](https://doc.rust-lang.org/src/std/io/util.rs.html#240-261)1.48.0 · ### impl Write for &Sink
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#913-936)1.48.0 · ### impl Write for &Stderr
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#694-717)1.48.0 · ### impl Write for &Stdout
[source](https://doc.rust-lang.org/src/std/io/impls.rs.html#335-376)### impl Write for &mut [u8]
Write is implemented for `&mut [u8]` by copying into the slice, overwriting its data.
Note that writing updates the slice to point to the yet unwritten part. The slice will be empty when it has been completely overwritten.
If the number of bytes to be written exceeds the size of the slice, write operations will return short writes: ultimately, `Ok(0)`; in this situation, `write_all` returns an error of kind `ErrorKind::WriteZero`.
[source](https://doc.rust-lang.org/src/std/fs.rs.html#757-774)### impl Write for File
[source](https://doc.rust-lang.org/src/std/net/tcp.rs.html#632-649)### impl Write for TcpStream
[source](https://doc.rust-lang.org/src/std/os/unix/net/stream.rs.html#651-668)1.10.0 · ### impl Write for UnixStream
Available on **Unix** only.[source](https://doc.rust-lang.org/src/std/process.rs.html#269-285)### impl Write for ChildStdin
[source](https://doc.rust-lang.org/src/std/io/cursor.rs.html#523-543)### impl Write for Cursor<&mut [u8]>
[source](https://doc.rust-lang.org/src/std/io/util.rs.html#216-237)### impl Write for Sink
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#887-910)### impl Write for Stderr
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#939-959)### impl Write for StderrLock<'\_>
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#668-691)### impl Write for Stdout
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#720-740)### impl Write for StdoutLock<'\_>
[source](https://doc.rust-lang.org/src/std/os/unix/net/stream.rs.html#671-688)1.10.0 · ### impl<'a> Write for &'a UnixStream
Available on **Unix** only.[source](https://doc.rust-lang.org/src/std/io/readbuf.rs.html#297-306)### impl<'a> Write for BorrowedCursor<'a>
[source](https://doc.rust-lang.org/src/std/io/cursor.rs.html#546-567)1.25.0 · ### impl<A> Write for Cursor<&mut Vec<u8, A>>where A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator"),
[source](https://doc.rust-lang.org/src/std/io/cursor.rs.html#594-617)1.5.0 · ### impl<A> Write for Cursor<Box<[u8], A>>where A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator"),
[source](https://doc.rust-lang.org/src/std/io/cursor.rs.html#570-591)### impl<A> Write for Cursor<Vec<u8, A>>where A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator"),
[source](https://doc.rust-lang.org/src/std/io/impls.rs.html#441-458)1.63.0 · ### impl<A: Allocator> Write for VecDeque<u8, A>
Write is implemented for `VecDeque<u8>` by appending to the `VecDeque`, growing it as needed.
[source](https://doc.rust-lang.org/src/std/io/impls.rs.html#381-413)### impl<A: Allocator> Write for Vec<u8, A>
Write is implemented for `Vec<u8>` by appending to the vector. The vector will grow as needed.
[source](https://doc.rust-lang.org/src/std/io/impls.rs.html#54-84)### impl<W: Write + ?Sized> Write for &mut W
[source](https://doc.rust-lang.org/src/std/io/impls.rs.html#158-188)### impl<W: Write + ?Sized> Write for Box<W>
[source](https://doc.rust-lang.org/src/std/io/buffered/bufwriter.rs.html#514-640)### impl<W: Write> Write for BufWriter<W>
[source](https://doc.rust-lang.org/src/std/io/buffered/linewriter.rs.html#188-216)### impl<W: Write> Write for LineWriter<W>
[source](https://doc.rust-lang.org/src/std/io/cursor.rs.html#620-640)1.61.0 · ### impl<const N: usize> Write for Cursor<[u8; N]>
| programming_docs |
rust Trait std::io::BufRead Trait std::io::BufRead
======================
```
pub trait BufRead: Read {
fn fill_buf(&mut self) -> Result<&[u8]>;
fn consume(&mut self, amt: usize);
fn has_data_left(&mut self) -> Result<bool> { ... }
fn read_until(&mut self, byte: u8, buf: &mut Vec<u8>) -> Result<usize> { ... }
fn read_line(&mut self, buf: &mut String) -> Result<usize> { ... }
fn split(self, byte: u8) -> Split<Self> where Self: Sized,
{ ... }
fn lines(self) -> Lines<Self>ⓘNotable traits for Lines<B>impl<B: BufRead> Iterator for Lines<B> type Item = Result<String>; where Self: Sized,
{ ... }
}
```
Notable traits for [Split](struct.split "struct std::io::Split")<B>
```
impl<B: BufRead> Iterator for Split<B>
type Item = Result<Vec<u8>>;
```
A `BufRead` is a type of `Read`er which has an internal buffer, allowing it to perform extra ways of reading.
For example, reading line-by-line is inefficient without using a buffer, so if you want to read by line, you’ll need `BufRead`, which includes a [`read_line`](trait.bufread#method.read_line) method as well as a [`lines`](trait.bufread#method.lines) iterator.
Examples
--------
A locked standard input implements `BufRead`:
```
use std::io;
use std::io::prelude::*;
let stdin = io::stdin();
for line in stdin.lock().lines() {
println!("{}", line.unwrap());
}
```
If you have something that implements [`Read`](trait.read "Read"), you can use the [`BufReader` type](struct.bufreader "BufReader") to turn it into a `BufRead`.
For example, [`File`](../fs/struct.file) implements [`Read`](trait.read "Read"), but not `BufRead`. [`BufReader`](struct.bufreader "BufReader") to the rescue!
```
use std::io::{self, BufReader};
use std::io::prelude::*;
use std::fs::File;
fn main() -> io::Result<()> {
let f = File::open("foo.txt")?;
let f = BufReader::new(f);
for line in f.lines() {
println!("{}", line.unwrap());
}
Ok(())
}
```
Required Methods
----------------
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2022)#### fn fill\_buf(&mut self) -> Result<&[u8]>
Returns the contents of the internal buffer, filling it with more data from the inner reader if it is empty.
This function is a lower-level call. It needs to be paired with the [`consume`](trait.bufread#tymethod.consume) method to function properly. When calling this method, none of the contents will be “read” in the sense that later calling `read` may return the same contents. As such, [`consume`](trait.bufread#tymethod.consume) must be called with the number of bytes that are consumed from this buffer to ensure that the bytes are never returned twice.
An empty buffer returned indicates that the stream has reached EOF.
##### Errors
This function will return an I/O error if the underlying reader was read, but returned an error.
##### Examples
A locked standard input implements `BufRead`:
```
use std::io;
use std::io::prelude::*;
let stdin = io::stdin();
let mut stdin = stdin.lock();
let buffer = stdin.fill_buf().unwrap();
// work with buffer
println!("{buffer:?}");
// ensure the bytes we worked with aren't returned again later
let length = buffer.len();
stdin.consume(length);
```
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2044)#### fn consume(&mut self, amt: usize)
Tells this buffer that `amt` bytes have been consumed from the buffer, so they should no longer be returned in calls to `read`.
This function is a lower-level call. It needs to be paired with the [`fill_buf`](trait.bufread#tymethod.fill_buf) method to function properly. This function does not perform any I/O, it simply informs this object that some amount of its buffer, returned from [`fill_buf`](trait.bufread#tymethod.fill_buf), has been consumed and should no longer be returned. As such, this function may do odd things if [`fill_buf`](trait.bufread#tymethod.fill_buf) isn’t called before calling it.
The `amt` must be `<=` the number of bytes in the buffer returned by [`fill_buf`](trait.bufread#tymethod.fill_buf).
##### Examples
Since `consume()` is meant to be used with [`fill_buf`](trait.bufread#tymethod.fill_buf), that method’s example includes an example of `consume()`.
Provided Methods
----------------
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2073-2075)#### fn has\_data\_left(&mut self) -> Result<bool>
🔬This is a nightly-only experimental API. (`buf_read_has_data_left` [#86423](https://github.com/rust-lang/rust/issues/86423))
Check if the underlying `Read` has any data left to be read.
This function may fill the buffer to check for data, so this functions returns `Result<bool>`, not `bool`.
Default implementation calls `fill_buf` and checks that returned slice is empty (which means that there is no data left, since EOF is reached).
Examples
```
#![feature(buf_read_has_data_left)]
use std::io;
use std::io::prelude::*;
let stdin = io::stdin();
let mut stdin = stdin.lock();
while stdin.has_data_left().unwrap() {
let mut line = String::new();
stdin.read_line(&mut line).unwrap();
// work with line
println!("{line:?}");
}
```
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2132-2134)#### fn read\_until(&mut self, byte: u8, buf: &mut Vec<u8>) -> Result<usize>
Read all bytes into `buf` until the delimiter `byte` or EOF is reached.
This function will read bytes from the underlying stream until the delimiter or EOF is found. Once found, all bytes up to, and including, the delimiter (if found) will be appended to `buf`.
If successful, this function will return the total number of bytes read.
This function is blocking and should be used carefully: it is possible for an attacker to continuously send bytes without ever sending the delimiter or EOF.
##### Errors
This function will ignore all instances of [`ErrorKind::Interrupted`](enum.errorkind#variant.Interrupted "ErrorKind::Interrupted") and will otherwise return any errors returned by [`fill_buf`](trait.bufread#tymethod.fill_buf).
If an I/O error is encountered then all bytes read so far will be present in `buf` and its length will have been adjusted appropriately.
##### Examples
[`std::io::Cursor`](struct.cursor "Cursor") is a type that implements `BufRead`. In this example, we use [`Cursor`](struct.cursor "Cursor") to read all the bytes in a byte slice in hyphen delimited segments:
```
use std::io::{self, BufRead};
let mut cursor = io::Cursor::new(b"lorem-ipsum");
let mut buf = vec![];
// cursor is at 'l'
let num_bytes = cursor.read_until(b'-', &mut buf)
.expect("reading from cursor won't fail");
assert_eq!(num_bytes, 6);
assert_eq!(buf, b"lorem-");
buf.clear();
// cursor is at 'i'
let num_bytes = cursor.read_until(b'-', &mut buf)
.expect("reading from cursor won't fail");
assert_eq!(num_bytes, 5);
assert_eq!(buf, b"ipsum");
buf.clear();
// cursor is at EOF
let num_bytes = cursor.read_until(b'-', &mut buf)
.expect("reading from cursor won't fail");
assert_eq!(num_bytes, 0);
assert_eq!(buf, b"");
```
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2196-2201)#### fn read\_line(&mut self, buf: &mut String) -> Result<usize>
Read all bytes until a newline (the `0xA` byte) is reached, and append them to the provided buffer. You do not need to clear the buffer before appending.
This function will read bytes from the underlying stream until the newline delimiter (the `0xA` byte) or EOF is found. Once found, all bytes up to, and including, the delimiter (if found) will be appended to `buf`.
If successful, this function will return the total number of bytes read.
If this function returns [`Ok(0)`](../result/enum.result#variant.Ok), the stream has reached EOF.
This function is blocking and should be used carefully: it is possible for an attacker to continuously send bytes without ever sending a newline or EOF.
##### Errors
This function has the same error semantics as [`read_until`](trait.bufread#method.read_until) and will also return an error if the read bytes are not valid UTF-8. If an I/O error is encountered then `buf` may contain some bytes already read in the event that all data read so far was valid UTF-8.
##### Examples
[`std::io::Cursor`](struct.cursor "Cursor") is a type that implements `BufRead`. In this example, we use [`Cursor`](struct.cursor "Cursor") to read all the lines in a byte slice:
```
use std::io::{self, BufRead};
let mut cursor = io::Cursor::new(b"foo\nbar");
let mut buf = String::new();
// cursor is at 'f'
let num_bytes = cursor.read_line(&mut buf)
.expect("reading from cursor won't fail");
assert_eq!(num_bytes, 4);
assert_eq!(buf, "foo\n");
buf.clear();
// cursor is at 'b'
let num_bytes = cursor.read_line(&mut buf)
.expect("reading from cursor won't fail");
assert_eq!(num_bytes, 3);
assert_eq!(buf, "bar");
buf.clear();
// cursor is at EOF
let num_bytes = cursor.read_line(&mut buf)
.expect("reading from cursor won't fail");
assert_eq!(num_bytes, 0);
assert_eq!(buf, "");
```
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2234-2239)#### fn split(self, byte: u8) -> Split<Self>where Self: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Notable traits for [Split](struct.split "struct std::io::Split")<B>
```
impl<B: BufRead> Iterator for Split<B>
type Item = Result<Vec<u8>>;
```
Returns an iterator over the contents of this reader split on the byte `byte`.
The iterator returned from this function will return instances of `[io::Result](type.result "io::Result")<[Vec](../vec/struct.vec "Vec")<u8>>`. Each vector returned will *not* have the delimiter byte at the end.
This function will yield errors whenever [`read_until`](trait.bufread#method.read_until) would have also yielded an error.
##### Examples
[`std::io::Cursor`](struct.cursor "Cursor") is a type that implements `BufRead`. In this example, we use [`Cursor`](struct.cursor "Cursor") to iterate over all hyphen delimited segments in a byte slice
```
use std::io::{self, BufRead};
let cursor = io::Cursor::new(b"lorem-ipsum-dolor");
let mut split_iter = cursor.split(b'-').map(|l| l.unwrap());
assert_eq!(split_iter.next(), Some(b"lorem".to_vec()));
assert_eq!(split_iter.next(), Some(b"ipsum".to_vec()));
assert_eq!(split_iter.next(), Some(b"dolor".to_vec()));
assert_eq!(split_iter.next(), None);
```
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2271-2276)#### fn lines(self) -> Lines<Self>where Self: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Notable traits for [Lines](struct.lines "struct std::io::Lines")<B>
```
impl<B: BufRead> Iterator for Lines<B>
type Item = Result<String>;
```
Returns an iterator over the lines of this reader.
The iterator returned from this function will yield instances of `[io::Result](type.result "io::Result")<[String](../string/struct.string "String")>`. Each string returned will *not* have a newline byte (the `0xA` byte) or `CRLF` (`0xD`, `0xA` bytes) at the end.
##### Examples
[`std::io::Cursor`](struct.cursor "Cursor") is a type that implements `BufRead`. In this example, we use [`Cursor`](struct.cursor "Cursor") to iterate over all the lines in a byte slice.
```
use std::io::{self, BufRead};
let cursor = io::Cursor::new(b"lorem\nipsum\r\ndolor");
let mut lines_iter = cursor.lines().map(|l| l.unwrap());
assert_eq!(lines_iter.next(), Some(String::from("lorem")));
assert_eq!(lines_iter.next(), Some(String::from("ipsum")));
assert_eq!(lines_iter.next(), Some(String::from("dolor")));
assert_eq!(lines_iter.next(), None);
```
##### Errors
Each line of the iterator has the same error semantics as [`BufRead::read_line`](trait.bufread#method.read_line "BufRead::read_line").
Implementors
------------
[source](https://doc.rust-lang.org/src/std/io/impls.rs.html#313-323)### impl BufRead for &[u8]
[source](https://doc.rust-lang.org/src/std/io/util.rs.html#55-62)### impl BufRead for Empty
[source](https://doc.rust-lang.org/src/std/io/stdio.rs.html#476-492)### impl BufRead for StdinLock<'\_>
[source](https://doc.rust-lang.org/src/std/io/impls.rs.html#98-118)### impl<B: BufRead + ?Sized> BufRead for &mut B
[source](https://doc.rust-lang.org/src/std/io/impls.rs.html#202-222)### impl<B: BufRead + ?Sized> BufRead for Box<B>
[source](https://doc.rust-lang.org/src/std/io/buffered/bufreader.rs.html#374-382)### impl<R: Read> BufRead for BufReader<R>
[source](https://doc.rust-lang.org/src/std/io/cursor.rs.html#361-371)### impl<T> BufRead for Cursor<T>where T: [AsRef](../convert/trait.asref "trait std::convert::AsRef")<[[u8](../primitive.u8)]>,
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2641-2659)### impl<T: BufRead> BufRead for Take<T>
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2392-2408)1.9.0 · ### impl<T: BufRead, U: BufRead> BufRead for Chain<T, U>
rust Function std::io::empty Function std::io::empty
=======================
```
pub fn empty() -> EmptyⓘNotable traits for Emptyimpl Read for Empty
```
Constructs a new handle to an empty reader.
All reads from the returned reader will return `[Ok](../result/enum.result#variant.Ok "Ok")(0)`.
Examples
--------
A slightly sad example of not reading anything into a buffer:
```
use std::io::{self, Read};
let mut buffer = String::new();
io::empty().read_to_string(&mut buffer).unwrap();
assert!(buffer.is_empty());
```
rust Trait std::io::Seek Trait std::io::Seek
===================
```
pub trait Seek {
fn seek(&mut self, pos: SeekFrom) -> Result<u64>;
fn rewind(&mut self) -> Result<()> { ... }
fn stream_len(&mut self) -> Result<u64> { ... }
fn stream_position(&mut self) -> Result<u64> { ... }
}
```
The `Seek` trait provides a cursor which can be moved within a stream of bytes.
The stream typically has a fixed size, allowing seeking relative to either end or the current offset.
Examples
--------
[`File`](../fs/struct.file)s implement `Seek`:
```
use std::io;
use std::io::prelude::*;
use std::fs::File;
use std::io::SeekFrom;
fn main() -> io::Result<()> {
let mut f = File::open("foo.txt")?;
// move the cursor 42 bytes from the start of the file
f.seek(SeekFrom::Start(42))?;
Ok(())
}
```
Required Methods
----------------
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1765)#### fn seek(&mut self, pos: SeekFrom) -> Result<u64>
Seek to an offset, in bytes, in a stream.
A seek beyond the end of a stream is allowed, but behavior is defined by the implementation.
If the seek operation completed successfully, this method returns the new position from the start of the stream. That position can be used later with [`SeekFrom::Start`](enum.seekfrom#variant.Start "SeekFrom::Start").
##### Errors
Seeking can fail, for example because it might involve flushing a buffer.
Seeking to a negative offset is considered an error.
Provided Methods
----------------
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1796-1799)1.55.0 · #### fn rewind(&mut self) -> Result<()>
Rewind to the beginning of a stream.
This is a convenience method, equivalent to `seek(SeekFrom::Start(0))`.
##### Errors
Rewinding can fail, for example because it might involve flushing a buffer.
##### Example
```
use std::io::{Read, Seek, Write};
use std::fs::OpenOptions;
let mut f = OpenOptions::new()
.write(true)
.read(true)
.create(true)
.open("foo.txt").unwrap();
let hello = "Hello!\n";
write!(f, "{hello}").unwrap();
f.rewind().unwrap();
let mut buf = String::new();
f.read_to_string(&mut buf).unwrap();
assert_eq!(&buf, hello);
```
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1836-1847)#### fn stream\_len(&mut self) -> Result<u64>
🔬This is a nightly-only experimental API. (`seek_stream_len` [#59359](https://github.com/rust-lang/rust/issues/59359))
Returns the length of this stream (in bytes).
This method is implemented using up to three seek operations. If this method returns successfully, the seek position is unchanged (i.e. the position before calling this method is the same as afterwards). However, if this method returns an error, the seek position is unspecified.
If you need to obtain the length of *many* streams and you don’t care about the seek position afterwards, you can reduce the number of seek operations by simply calling `seek(SeekFrom::End(0))` and using its return value (it is also the stream length).
Note that length of a stream can change over time (for example, when data is appended to a file). So calling this method multiple times does not necessarily return the same length each time.
##### Example
```
#![feature(seek_stream_len)]
use std::{
io::{self, Seek},
fs::File,
};
fn main() -> io::Result<()> {
let mut f = File::open("foo.txt")?;
let len = f.stream_len()?;
println!("The file is currently {len} bytes long");
Ok(())
}
```
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1873-1875)1.51.0 · #### fn stream\_position(&mut self) -> Result<u64>
Returns the current seek position from the start of the stream.
This is equivalent to `self.seek(SeekFrom::Current(0))`.
##### Example
```
use std::{
io::{self, BufRead, BufReader, Seek},
fs::File,
};
fn main() -> io::Result<()> {
let mut f = BufReader::new(File::open("foo.txt")?);
let before = f.stream_position()?;
f.read_line(&mut String::new())?;
let after = f.stream_position()?;
println!("The first line was {} bytes long", after - before);
Ok(())
}
```
Implementors
------------
[source](https://doc.rust-lang.org/src/std/fs.rs.html#832-836)### impl Seek for &File
[source](https://doc.rust-lang.org/src/std/fs.rs.html#776-780)### impl Seek for File
[source](https://doc.rust-lang.org/src/std/io/util.rs.html#65-77)1.51.0 · ### impl Seek for Empty
[source](https://doc.rust-lang.org/src/std/io/buffered/bufreader.rs.html#401-492)### impl<R: Seek> Seek for BufReader<R>
[source](https://doc.rust-lang.org/src/std/io/impls.rs.html#86-96)### impl<S: Seek + ?Sized> Seek for &mut S
[source](https://doc.rust-lang.org/src/std/io/impls.rs.html#190-200)### impl<S: Seek + ?Sized> Seek for Box<S>
[source](https://doc.rust-lang.org/src/std/io/cursor.rs.html#281-313)### impl<T> Seek for Cursor<T>where T: [AsRef](../convert/trait.asref "trait std::convert::AsRef")<[[u8](../primitive.u8)]>,
[source](https://doc.rust-lang.org/src/std/io/buffered/bufwriter.rs.html#656-664)### impl<W: Write + Seek> Seek for BufWriter<W>
rust Struct std::io::IoSliceMut Struct std::io::IoSliceMut
==========================
```
#[repr(transparent)]pub struct IoSliceMut<'a>(_);
```
A buffer type used with `Read::read_vectored`.
It is semantically a wrapper around an `&mut [u8]`, but is guaranteed to be ABI compatible with the `iovec` type on Unix platforms and `WSABUF` on Windows.
Implementations
---------------
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1077-1177)### impl<'a> IoSliceMut<'a>
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1085-1087)#### pub fn new(buf: &'a mut [u8]) -> IoSliceMut<'a>
Creates a new `IoSliceMut` wrapping a byte slice.
##### Panics
Panics on Windows if the slice is larger than 4GB.
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1115-1117)#### pub fn advance(&mut self, n: usize)
🔬This is a nightly-only experimental API. (`io_slice_advance` [#62726](https://github.com/rust-lang/rust/issues/62726))
Advance the internal cursor of the slice.
Also see [`IoSliceMut::advance_slices`](struct.ioslicemut#method.advance_slices "IoSliceMut::advance_slices") to advance the cursors of multiple buffers.
##### Panics
Panics when trying to advance beyond the end of the slice.
##### Examples
```
#![feature(io_slice_advance)]
use std::io::IoSliceMut;
use std::ops::Deref;
let mut data = [1; 8];
let mut buf = IoSliceMut::new(&mut data);
// Mark 3 bytes as read.
buf.advance(3);
assert_eq!(buf.deref(), [1; 5].as_ref());
```
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1156-1176)#### pub fn advance\_slices(bufs: &mut &mut [IoSliceMut<'a>], n: usize)
🔬This is a nightly-only experimental API. (`io_slice_advance` [#62726](https://github.com/rust-lang/rust/issues/62726))
Advance a slice of slices.
Shrinks the slice to remove any `IoSliceMut`s that are fully advanced over. If the cursor ends up in the middle of an `IoSliceMut`, it is modified to start at that cursor.
For example, if we have a slice of two 8-byte `IoSliceMut`s, and we advance by 10 bytes, the result will only include the second `IoSliceMut`, advanced by 2 bytes.
##### Panics
Panics when trying to advance beyond the end of the slices.
##### Examples
```
#![feature(io_slice_advance)]
use std::io::IoSliceMut;
use std::ops::Deref;
let mut buf1 = [1; 8];
let mut buf2 = [2; 16];
let mut buf3 = [3; 8];
let mut bufs = &mut [
IoSliceMut::new(&mut buf1),
IoSliceMut::new(&mut buf2),
IoSliceMut::new(&mut buf3),
][..];
// Mark 10 bytes as read.
IoSliceMut::advance_slices(&mut bufs, 10);
assert_eq!(bufs[0].deref(), [2; 14].as_ref());
assert_eq!(bufs[1].deref(), [3; 8].as_ref());
```
Methods from [Deref](../ops/trait.deref "trait std::ops::Deref")<Target = [[u8](../primitive.u8)]>
--------------------------------------------------------------------------------------------------
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#4068)#### pub fn flatten(&self) -> &[T]
Notable traits for &[[u8](../primitive.u8)]
```
impl Read for &[u8]
impl Write for &mut [u8]
```
🔬This is a nightly-only experimental API. (`slice_flatten` [#95629](https://github.com/rust-lang/rust/issues/95629))
Takes a `&[[T; N]]`, and flattens it to a `&[T]`.
##### Panics
This panics if the length of the resulting slice would overflow a `usize`.
This is only possible when flattening a slice of arrays of zero-sized types, and thus tends to be irrelevant in practice. If `size_of::<T>() > 0`, this will never panic.
##### Examples
```
#![feature(slice_flatten)]
assert_eq!([[1, 2, 3], [4, 5, 6]].flatten(), &[1, 2, 3, 4, 5, 6]);
assert_eq!(
[[1, 2, 3], [4, 5, 6]].flatten(),
[[1, 2], [3, 4], [5, 6]].flatten(),
);
let slice_of_empty_arrays: &[[i32; 0]] = &[[], [], [], [], []];
assert!(slice_of_empty_arrays.flatten().is_empty());
let empty_slice_of_arrays: &[[u32; 10]] = &[];
assert!(empty_slice_of_arrays.flatten().is_empty());
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#4106)#### pub fn flatten\_mut(&mut self) -> &mut [T]
Notable traits for &[[u8](../primitive.u8)]
```
impl Read for &[u8]
impl Write for &mut [u8]
```
🔬This is a nightly-only experimental API. (`slice_flatten` [#95629](https://github.com/rust-lang/rust/issues/95629))
Takes a `&mut [[T; N]]`, and flattens it to a `&mut [T]`.
##### Panics
This panics if the length of the resulting slice would overflow a `usize`.
This is only possible when flattening a slice of arrays of zero-sized types, and thus tends to be irrelevant in practice. If `size_of::<T>() > 0`, this will never panic.
##### Examples
```
#![feature(slice_flatten)]
fn add_5_to_all(slice: &mut [i32]) {
for i in slice {
*i += 5;
}
}
let mut array = [[1, 2, 3], [4, 5, 6], [7, 8, 9]];
add_5_to_all(array.flatten_mut());
assert_eq!(array, [[6, 7, 8], [9, 10, 11], [12, 13, 14]]);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#4172)#### pub fn sort\_floats(&mut self)
🔬This is a nightly-only experimental API. (`sort_floats` [#93396](https://github.com/rust-lang/rust/issues/93396))
Sorts the slice of floats.
This sort is in-place (i.e. does not allocate), *O*(*n* \* log(*n*)) worst-case, and uses the ordering defined by [`f64::total_cmp`](../primitive.f64#method.total_cmp "f64::total_cmp").
##### Current implementation
This uses the same sorting algorithm as [`sort_unstable_by`](../primitive.slice#method.sort_unstable_by).
##### Examples
```
#![feature(sort_floats)]
let mut v = [2.6, -5e-8, f64::NAN, 8.29, f64::INFINITY, -1.0, 0.0, -f64::INFINITY, -0.0];
v.sort_floats();
let sorted = [-f64::INFINITY, -1.0, -5e-8, -0.0, 0.0, 2.6, 8.29, f64::INFINITY, f64::NAN];
assert_eq!(&v[..8], &sorted[..8]);
assert!(v[8].is_nan());
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#4143)#### pub fn sort\_floats(&mut self)
🔬This is a nightly-only experimental API. (`sort_floats` [#93396](https://github.com/rust-lang/rust/issues/93396))
Sorts the slice of floats.
This sort is in-place (i.e. does not allocate), *O*(*n* \* log(*n*)) worst-case, and uses the ordering defined by [`f32::total_cmp`](../primitive.f32#method.total_cmp "f32::total_cmp").
##### Current implementation
This uses the same sorting algorithm as [`sort_unstable_by`](../primitive.slice#method.sort_unstable_by).
##### Examples
```
#![feature(sort_floats)]
let mut v = [2.6, -5e-8, f32::NAN, 8.29, f32::INFINITY, -1.0, 0.0, -f32::INFINITY, -0.0];
v.sort_floats();
let sorted = [-f32::INFINITY, -1.0, -5e-8, -0.0, 0.0, 2.6, 8.29, f32::INFINITY, f32::NAN];
assert_eq!(&v[..8], &sorted[..8]);
assert!(v[8].is_nan());
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#129)1.0.0 · #### pub fn len(&self) -> usize
Returns the number of elements in the slice.
##### Examples
```
let a = [1, 2, 3];
assert_eq!(a.len(), 3);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#152)1.0.0 · #### pub fn is\_empty(&self) -> bool
Returns `true` if the slice has a length of 0.
##### Examples
```
let a = [1, 2, 3];
assert!(!a.is_empty());
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#171)1.0.0 · #### pub fn first(&self) -> Option<&T>
Returns the first element of the slice, or `None` if it is empty.
##### Examples
```
let v = [10, 40, 30];
assert_eq!(Some(&10), v.first());
let w: &[i32] = &[];
assert_eq!(None, w.first());
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#191)1.0.0 · #### pub fn first\_mut(&mut self) -> Option<&mut T>
Returns a mutable pointer to the first element of the slice, or `None` if it is empty.
##### Examples
```
let x = &mut [0, 1, 2];
if let Some(first) = x.first_mut() {
*first = 5;
}
assert_eq!(x, &[5, 1, 2]);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#211)1.5.0 · #### pub fn split\_first(&self) -> Option<(&T, &[T])>
Returns the first and all the rest of the elements of the slice, or `None` if it is empty.
##### Examples
```
let x = &[0, 1, 2];
if let Some((first, elements)) = x.split_first() {
assert_eq!(first, &0);
assert_eq!(elements, &[1, 2]);
}
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#233)1.5.0 · #### pub fn split\_first\_mut(&mut self) -> Option<(&mut T, &mut [T])>
Returns the first and all the rest of the elements of the slice, or `None` if it is empty.
##### Examples
```
let x = &mut [0, 1, 2];
if let Some((first, elements)) = x.split_first_mut() {
*first = 3;
elements[0] = 4;
elements[1] = 5;
}
assert_eq!(x, &[3, 4, 5]);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#253)1.5.0 · #### pub fn split\_last(&self) -> Option<(&T, &[T])>
Returns the last and all the rest of the elements of the slice, or `None` if it is empty.
##### Examples
```
let x = &[0, 1, 2];
if let Some((last, elements)) = x.split_last() {
assert_eq!(last, &2);
assert_eq!(elements, &[0, 1]);
}
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#275)1.5.0 · #### pub fn split\_last\_mut(&mut self) -> Option<(&mut T, &mut [T])>
Returns the last and all the rest of the elements of the slice, or `None` if it is empty.
##### Examples
```
let x = &mut [0, 1, 2];
if let Some((last, elements)) = x.split_last_mut() {
*last = 3;
elements[0] = 4;
elements[1] = 5;
}
assert_eq!(x, &[4, 5, 3]);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#294)1.0.0 · #### pub fn last(&self) -> Option<&T>
Returns the last element of the slice, or `None` if it is empty.
##### Examples
```
let v = [10, 40, 30];
assert_eq!(Some(&30), v.last());
let w: &[i32] = &[];
assert_eq!(None, w.last());
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#314)1.0.0 · #### pub fn last\_mut(&mut self) -> Option<&mut T>
Returns a mutable pointer to the last item in the slice.
##### Examples
```
let x = &mut [0, 1, 2];
if let Some(last) = x.last_mut() {
*last = 10;
}
assert_eq!(x, &[0, 1, 10]);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#339-341)1.0.0 · #### pub fn get<I>(&self, index: I) -> Option<&<I as SliceIndex<[T]>>::Output>where I: [SliceIndex](../slice/trait.sliceindex "trait std::slice::SliceIndex")<[[T]](../primitive.slice)>,
Returns a reference to an element or subslice depending on the type of index.
* If given a position, returns a reference to the element at that position or `None` if out of bounds.
* If given a range, returns the subslice corresponding to that range, or `None` if out of bounds.
##### Examples
```
let v = [10, 40, 30];
assert_eq!(Some(&40), v.get(1));
assert_eq!(Some(&[10, 40][..]), v.get(0..2));
assert_eq!(None, v.get(3));
assert_eq!(None, v.get(0..4));
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#365-367)1.0.0 · #### pub fn get\_mut<I>( &mut self, index: I) -> Option<&mut <I as SliceIndex<[T]>>::Output>where I: [SliceIndex](../slice/trait.sliceindex "trait std::slice::SliceIndex")<[[T]](../primitive.slice)>,
Returns a mutable reference to an element or subslice depending on the type of index (see [`get`](../primitive.slice#method.get)) or `None` if the index is out of bounds.
##### Examples
```
let x = &mut [0, 1, 2];
if let Some(elem) = x.get_mut(1) {
*elem = 42;
}
assert_eq!(x, &[0, 42, 2]);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#398-400)1.0.0 · #### pub unsafe fn get\_unchecked<I>( &self, index: I) -> &<I as SliceIndex<[T]>>::Outputwhere I: [SliceIndex](../slice/trait.sliceindex "trait std::slice::SliceIndex")<[[T]](../primitive.slice)>,
Returns a reference to an element or subslice, without doing bounds checking.
For a safe alternative see [`get`](../primitive.slice#method.get).
##### Safety
Calling this method with an out-of-bounds index is *[undefined behavior](../../reference/behavior-considered-undefined)* even if the resulting reference is not used.
##### Examples
```
let x = &[1, 2, 4];
unsafe {
assert_eq!(x.get_unchecked(1), &2);
}
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#436-438)1.0.0 · #### pub unsafe fn get\_unchecked\_mut<I>( &mut self, index: I) -> &mut <I as SliceIndex<[T]>>::Outputwhere I: [SliceIndex](../slice/trait.sliceindex "trait std::slice::SliceIndex")<[[T]](../primitive.slice)>,
Returns a mutable reference to an element or subslice, without doing bounds checking.
For a safe alternative see [`get_mut`](../primitive.slice#method.get_mut).
##### Safety
Calling this method with an out-of-bounds index is *[undefined behavior](../../reference/behavior-considered-undefined)* even if the resulting reference is not used.
##### Examples
```
let x = &mut [1, 2, 4];
unsafe {
let elem = x.get_unchecked_mut(1);
*elem = 13;
}
assert_eq!(x, &[1, 13, 4]);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#476)1.0.0 · #### pub fn as\_ptr(&self) -> \*const T
Returns a raw pointer to the slice’s buffer.
The caller must ensure that the slice outlives the pointer this function returns, or else it will end up pointing to garbage.
The caller must also ensure that the memory the pointer (non-transitively) points to is never written to (except inside an `UnsafeCell`) using this pointer or any pointer derived from it. If you need to mutate the contents of the slice, use [`as_mut_ptr`](../primitive.slice#method.as_mut_ptr).
Modifying the container referenced by this slice may cause its buffer to be reallocated, which would also make any pointers to it invalid.
##### Examples
```
let x = &[1, 2, 4];
let x_ptr = x.as_ptr();
unsafe {
for i in 0..x.len() {
assert_eq!(x.get_unchecked(i), &*x_ptr.add(i));
}
}
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#506)1.0.0 · #### pub fn as\_mut\_ptr(&mut self) -> \*mut T
Returns an unsafe mutable pointer to the slice’s buffer.
The caller must ensure that the slice outlives the pointer this function returns, or else it will end up pointing to garbage.
Modifying the container referenced by this slice may cause its buffer to be reallocated, which would also make any pointers to it invalid.
##### Examples
```
let x = &mut [1, 2, 4];
let x_ptr = x.as_mut_ptr();
unsafe {
for i in 0..x.len() {
*x_ptr.add(i) += 2;
}
}
assert_eq!(x, &[3, 4, 6]);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#542)1.48.0 · #### pub fn as\_ptr\_range(&self) -> Range<\*const T>
Notable traits for [Range](../ops/struct.range "struct std::ops::Range")<A>
```
impl<A> Iterator for Range<A>where
A: Step,
type Item = A;
```
Returns the two raw pointers spanning the slice.
The returned range is half-open, which means that the end pointer points *one past* the last element of the slice. This way, an empty slice is represented by two equal pointers, and the difference between the two pointers represents the size of the slice.
See [`as_ptr`](../primitive.slice#method.as_ptr) for warnings on using these pointers. The end pointer requires extra caution, as it does not point to a valid element in the slice.
This function is useful for interacting with foreign interfaces which use two pointers to refer to a range of elements in memory, as is common in C++.
It can also be useful to check if a pointer to an element refers to an element of this slice:
```
let a = [1, 2, 3];
let x = &a[1] as *const _;
let y = &5 as *const _;
assert!(a.as_ptr_range().contains(&x));
assert!(!a.as_ptr_range().contains(&y));
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#586)1.48.0 · #### pub fn as\_mut\_ptr\_range(&mut self) -> Range<\*mut T>
Notable traits for [Range](../ops/struct.range "struct std::ops::Range")<A>
```
impl<A> Iterator for Range<A>where
A: Step,
type Item = A;
```
Returns the two unsafe mutable pointers spanning the slice.
The returned range is half-open, which means that the end pointer points *one past* the last element of the slice. This way, an empty slice is represented by two equal pointers, and the difference between the two pointers represents the size of the slice.
See [`as_mut_ptr`](../primitive.slice#method.as_mut_ptr) for warnings on using these pointers. The end pointer requires extra caution, as it does not point to a valid element in the slice.
This function is useful for interacting with foreign interfaces which use two pointers to refer to a range of elements in memory, as is common in C++.
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#615)1.0.0 · #### pub fn swap(&mut self, a: usize, b: usize)
Swaps two elements in the slice.
##### Arguments
* a - The index of the first element
* b - The index of the second element
##### Panics
Panics if `a` or `b` are out of bounds.
##### Examples
```
let mut v = ["a", "b", "c", "d", "e"];
v.swap(2, 4);
assert!(v == ["a", "b", "e", "d", "c"]);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#658)#### pub unsafe fn swap\_unchecked(&mut self, a: usize, b: usize)
🔬This is a nightly-only experimental API. (`slice_swap_unchecked` [#88539](https://github.com/rust-lang/rust/issues/88539))
Swaps two elements in the slice, without doing bounds checking.
For a safe alternative see [`swap`](../primitive.slice#method.swap).
##### Arguments
* a - The index of the first element
* b - The index of the second element
##### Safety
Calling this method with an out-of-bounds index is *[undefined behavior](../../reference/behavior-considered-undefined)*. The caller has to ensure that `a < self.len()` and `b < self.len()`.
##### Examples
```
#![feature(slice_swap_unchecked)]
let mut v = ["a", "b", "c", "d"];
// SAFETY: we know that 1 and 3 are both indices of the slice
unsafe { v.swap_unchecked(1, 3) };
assert!(v == ["a", "d", "c", "b"]);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#680)1.0.0 · #### pub fn reverse(&mut self)
Reverses the order of elements in the slice, in place.
##### Examples
```
let mut v = [1, 2, 3];
v.reverse();
assert!(v == [3, 2, 1]);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#738)1.0.0 · #### pub fn iter(&self) -> Iter<'\_, T>
Notable traits for [Iter](../slice/struct.iter "struct std::slice::Iter")<'a, T>
```
impl<'a, T> Iterator for Iter<'a, T>
type Item = &'a T;
```
Returns an iterator over the slice.
The iterator yields all items from start to end.
##### Examples
```
let x = &[1, 2, 4];
let mut iterator = x.iter();
assert_eq!(iterator.next(), Some(&1));
assert_eq!(iterator.next(), Some(&2));
assert_eq!(iterator.next(), Some(&4));
assert_eq!(iterator.next(), None);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#757)1.0.0 · #### pub fn iter\_mut(&mut self) -> IterMut<'\_, T>
Notable traits for [IterMut](../slice/struct.itermut "struct std::slice::IterMut")<'a, T>
```
impl<'a, T> Iterator for IterMut<'a, T>
type Item = &'a mut T;
```
Returns an iterator that allows modifying each value.
The iterator yields all items from start to end.
##### Examples
```
let x = &mut [1, 2, 4];
for elem in x.iter_mut() {
*elem += 2;
}
assert_eq!(x, &[3, 4, 6]);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#789)1.0.0 · #### pub fn windows(&self, size: usize) -> Windows<'\_, T>
Notable traits for [Windows](../slice/struct.windows "struct std::slice::Windows")<'a, T>
```
impl<'a, T> Iterator for Windows<'a, T>
type Item = &'a [T];
```
Returns an iterator over all contiguous windows of length `size`. The windows overlap. If the slice is shorter than `size`, the iterator returns no values.
##### Panics
Panics if `size` is 0.
##### Examples
```
let slice = ['r', 'u', 's', 't'];
let mut iter = slice.windows(2);
assert_eq!(iter.next().unwrap(), &['r', 'u']);
assert_eq!(iter.next().unwrap(), &['u', 's']);
assert_eq!(iter.next().unwrap(), &['s', 't']);
assert!(iter.next().is_none());
```
If the slice is shorter than `size`:
```
let slice = ['f', 'o', 'o'];
let mut iter = slice.windows(4);
assert!(iter.next().is_none());
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#823)1.0.0 · #### pub fn chunks(&self, chunk\_size: usize) -> Chunks<'\_, T>
Notable traits for [Chunks](../slice/struct.chunks "struct std::slice::Chunks")<'a, T>
```
impl<'a, T> Iterator for Chunks<'a, T>
type Item = &'a [T];
```
Returns an iterator over `chunk_size` elements of the slice at a time, starting at the beginning of the slice.
The chunks are slices and do not overlap. If `chunk_size` does not divide the length of the slice, then the last chunk will not have length `chunk_size`.
See [`chunks_exact`](../primitive.slice#method.chunks_exact) for a variant of this iterator that returns chunks of always exactly `chunk_size` elements, and [`rchunks`](../primitive.slice#method.rchunks) for the same iterator but starting at the end of the slice.
##### Panics
Panics if `chunk_size` is 0.
##### Examples
```
let slice = ['l', 'o', 'r', 'e', 'm'];
let mut iter = slice.chunks(2);
assert_eq!(iter.next().unwrap(), &['l', 'o']);
assert_eq!(iter.next().unwrap(), &['r', 'e']);
assert_eq!(iter.next().unwrap(), &['m']);
assert!(iter.next().is_none());
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#861)1.0.0 · #### pub fn chunks\_mut(&mut self, chunk\_size: usize) -> ChunksMut<'\_, T>
Notable traits for [ChunksMut](../slice/struct.chunksmut "struct std::slice::ChunksMut")<'a, T>
```
impl<'a, T> Iterator for ChunksMut<'a, T>
type Item = &'a mut [T];
```
Returns an iterator over `chunk_size` elements of the slice at a time, starting at the beginning of the slice.
The chunks are mutable slices, and do not overlap. If `chunk_size` does not divide the length of the slice, then the last chunk will not have length `chunk_size`.
See [`chunks_exact_mut`](../primitive.slice#method.chunks_exact_mut) for a variant of this iterator that returns chunks of always exactly `chunk_size` elements, and [`rchunks_mut`](../primitive.slice#method.rchunks_mut) for the same iterator but starting at the end of the slice.
##### Panics
Panics if `chunk_size` is 0.
##### Examples
```
let v = &mut [0, 0, 0, 0, 0];
let mut count = 1;
for chunk in v.chunks_mut(2) {
for elem in chunk.iter_mut() {
*elem += count;
}
count += 1;
}
assert_eq!(v, &[1, 1, 2, 2, 3]);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#898)1.31.0 · #### pub fn chunks\_exact(&self, chunk\_size: usize) -> ChunksExact<'\_, T>
Notable traits for [ChunksExact](../slice/struct.chunksexact "struct std::slice::ChunksExact")<'a, T>
```
impl<'a, T> Iterator for ChunksExact<'a, T>
type Item = &'a [T];
```
Returns an iterator over `chunk_size` elements of the slice at a time, starting at the beginning of the slice.
The chunks are slices and do not overlap. If `chunk_size` does not divide the length of the slice, then the last up to `chunk_size-1` elements will be omitted and can be retrieved from the `remainder` function of the iterator.
Due to each chunk having exactly `chunk_size` elements, the compiler can often optimize the resulting code better than in the case of [`chunks`](../primitive.slice#method.chunks).
See [`chunks`](../primitive.slice#method.chunks) for a variant of this iterator that also returns the remainder as a smaller chunk, and [`rchunks_exact`](../primitive.slice#method.rchunks_exact) for the same iterator but starting at the end of the slice.
##### Panics
Panics if `chunk_size` is 0.
##### Examples
```
let slice = ['l', 'o', 'r', 'e', 'm'];
let mut iter = slice.chunks_exact(2);
assert_eq!(iter.next().unwrap(), &['l', 'o']);
assert_eq!(iter.next().unwrap(), &['r', 'e']);
assert!(iter.next().is_none());
assert_eq!(iter.remainder(), &['m']);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#940)1.31.0 · #### pub fn chunks\_exact\_mut(&mut self, chunk\_size: usize) -> ChunksExactMut<'\_, T>
Notable traits for [ChunksExactMut](../slice/struct.chunksexactmut "struct std::slice::ChunksExactMut")<'a, T>
```
impl<'a, T> Iterator for ChunksExactMut<'a, T>
type Item = &'a mut [T];
```
Returns an iterator over `chunk_size` elements of the slice at a time, starting at the beginning of the slice.
The chunks are mutable slices, and do not overlap. If `chunk_size` does not divide the length of the slice, then the last up to `chunk_size-1` elements will be omitted and can be retrieved from the `into_remainder` function of the iterator.
Due to each chunk having exactly `chunk_size` elements, the compiler can often optimize the resulting code better than in the case of [`chunks_mut`](../primitive.slice#method.chunks_mut).
See [`chunks_mut`](../primitive.slice#method.chunks_mut) for a variant of this iterator that also returns the remainder as a smaller chunk, and [`rchunks_exact_mut`](../primitive.slice#method.rchunks_exact_mut) for the same iterator but starting at the end of the slice.
##### Panics
Panics if `chunk_size` is 0.
##### Examples
```
let v = &mut [0, 0, 0, 0, 0];
let mut count = 1;
for chunk in v.chunks_exact_mut(2) {
for elem in chunk.iter_mut() {
*elem += count;
}
count += 1;
}
assert_eq!(v, &[1, 1, 2, 2, 0]);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#975)#### pub unsafe fn as\_chunks\_unchecked<const N: usize>(&self) -> &[[T; N]]
🔬This is a nightly-only experimental API. (`slice_as_chunks` [#74985](https://github.com/rust-lang/rust/issues/74985))
Splits the slice into a slice of `N`-element arrays, assuming that there’s no remainder.
##### Safety
This may only be called when
* The slice splits exactly into `N`-element chunks (aka `self.len() % N == 0`).
* `N != 0`.
##### Examples
```
#![feature(slice_as_chunks)]
let slice: &[char] = &['l', 'o', 'r', 'e', 'm', '!'];
let chunks: &[[char; 1]] =
// SAFETY: 1-element chunks never have remainder
unsafe { slice.as_chunks_unchecked() };
assert_eq!(chunks, &[['l'], ['o'], ['r'], ['e'], ['m'], ['!']]);
let chunks: &[[char; 3]] =
// SAFETY: The slice length (6) is a multiple of 3
unsafe { slice.as_chunks_unchecked() };
assert_eq!(chunks, &[['l', 'o', 'r'], ['e', 'm', '!']]);
// These would be unsound:
// let chunks: &[[_; 5]] = slice.as_chunks_unchecked() // The slice length is not a multiple of 5
// let chunks: &[[_; 0]] = slice.as_chunks_unchecked() // Zero-length chunks are never allowed
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#1008)#### pub fn as\_chunks<const N: usize>(&self) -> (&[[T; N]], &[T])
🔬This is a nightly-only experimental API. (`slice_as_chunks` [#74985](https://github.com/rust-lang/rust/issues/74985))
Splits the slice into a slice of `N`-element arrays, starting at the beginning of the slice, and a remainder slice with length strictly less than `N`.
##### Panics
Panics if `N` is 0. This check will most probably get changed to a compile time error before this method gets stabilized.
##### Examples
```
#![feature(slice_as_chunks)]
let slice = ['l', 'o', 'r', 'e', 'm'];
let (chunks, remainder) = slice.as_chunks();
assert_eq!(chunks, &[['l', 'o'], ['r', 'e']]);
assert_eq!(remainder, &['m']);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#1039)#### pub fn as\_rchunks<const N: usize>(&self) -> (&[T], &[[T; N]])
🔬This is a nightly-only experimental API. (`slice_as_chunks` [#74985](https://github.com/rust-lang/rust/issues/74985))
Splits the slice into a slice of `N`-element arrays, starting at the end of the slice, and a remainder slice with length strictly less than `N`.
##### Panics
Panics if `N` is 0. This check will most probably get changed to a compile time error before this method gets stabilized.
##### Examples
```
#![feature(slice_as_chunks)]
let slice = ['l', 'o', 'r', 'e', 'm'];
let (remainder, chunks) = slice.as_rchunks();
assert_eq!(remainder, &['l']);
assert_eq!(chunks, &[['o', 'r'], ['e', 'm']]);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#1078)#### pub fn array\_chunks<const N: usize>(&self) -> ArrayChunks<'\_, T, N>
Notable traits for [ArrayChunks](../slice/struct.arraychunks "struct std::slice::ArrayChunks")<'a, T, N>
```
impl<'a, T, const N: usize> Iterator for ArrayChunks<'a, T, N>
type Item = &'a [T; N];
```
🔬This is a nightly-only experimental API. (`array_chunks` [#74985](https://github.com/rust-lang/rust/issues/74985))
Returns an iterator over `N` elements of the slice at a time, starting at the beginning of the slice.
The chunks are array references and do not overlap. If `N` does not divide the length of the slice, then the last up to `N-1` elements will be omitted and can be retrieved from the `remainder` function of the iterator.
This method is the const generic equivalent of [`chunks_exact`](../primitive.slice#method.chunks_exact).
##### Panics
Panics if `N` is 0. This check will most probably get changed to a compile time error before this method gets stabilized.
##### Examples
```
#![feature(array_chunks)]
let slice = ['l', 'o', 'r', 'e', 'm'];
let mut iter = slice.array_chunks();
assert_eq!(iter.next().unwrap(), &['l', 'o']);
assert_eq!(iter.next().unwrap(), &['r', 'e']);
assert!(iter.next().is_none());
assert_eq!(iter.remainder(), &['m']);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#1115)#### pub unsafe fn as\_chunks\_unchecked\_mut<const N: usize>( &mut self) -> &mut [[T; N]]
🔬This is a nightly-only experimental API. (`slice_as_chunks` [#74985](https://github.com/rust-lang/rust/issues/74985))
Splits the slice into a slice of `N`-element arrays, assuming that there’s no remainder.
##### Safety
This may only be called when
* The slice splits exactly into `N`-element chunks (aka `self.len() % N == 0`).
* `N != 0`.
##### Examples
```
#![feature(slice_as_chunks)]
let slice: &mut [char] = &mut ['l', 'o', 'r', 'e', 'm', '!'];
let chunks: &mut [[char; 1]] =
// SAFETY: 1-element chunks never have remainder
unsafe { slice.as_chunks_unchecked_mut() };
chunks[0] = ['L'];
assert_eq!(chunks, &[['L'], ['o'], ['r'], ['e'], ['m'], ['!']]);
let chunks: &mut [[char; 3]] =
// SAFETY: The slice length (6) is a multiple of 3
unsafe { slice.as_chunks_unchecked_mut() };
chunks[1] = ['a', 'x', '?'];
assert_eq!(slice, &['L', 'o', 'r', 'a', 'x', '?']);
// These would be unsound:
// let chunks: &[[_; 5]] = slice.as_chunks_unchecked_mut() // The slice length is not a multiple of 5
// let chunks: &[[_; 0]] = slice.as_chunks_unchecked_mut() // Zero-length chunks are never allowed
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#1154)#### pub fn as\_chunks\_mut<const N: usize>(&mut self) -> (&mut [[T; N]], &mut [T])
🔬This is a nightly-only experimental API. (`slice_as_chunks` [#74985](https://github.com/rust-lang/rust/issues/74985))
Splits the slice into a slice of `N`-element arrays, starting at the beginning of the slice, and a remainder slice with length strictly less than `N`.
##### Panics
Panics if `N` is 0. This check will most probably get changed to a compile time error before this method gets stabilized.
##### Examples
```
#![feature(slice_as_chunks)]
let v = &mut [0, 0, 0, 0, 0];
let mut count = 1;
let (chunks, remainder) = v.as_chunks_mut();
remainder[0] = 9;
for chunk in chunks {
*chunk = [count; 2];
count += 1;
}
assert_eq!(v, &[1, 1, 2, 2, 9]);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#1191)#### pub fn as\_rchunks\_mut<const N: usize>(&mut self) -> (&mut [T], &mut [[T; N]])
🔬This is a nightly-only experimental API. (`slice_as_chunks` [#74985](https://github.com/rust-lang/rust/issues/74985))
Splits the slice into a slice of `N`-element arrays, starting at the end of the slice, and a remainder slice with length strictly less than `N`.
##### Panics
Panics if `N` is 0. This check will most probably get changed to a compile time error before this method gets stabilized.
##### Examples
```
#![feature(slice_as_chunks)]
let v = &mut [0, 0, 0, 0, 0];
let mut count = 1;
let (remainder, chunks) = v.as_rchunks_mut();
remainder[0] = 9;
for chunk in chunks {
*chunk = [count; 2];
count += 1;
}
assert_eq!(v, &[9, 1, 1, 2, 2]);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#1232)#### pub fn array\_chunks\_mut<const N: usize>(&mut self) -> ArrayChunksMut<'\_, T, N>
Notable traits for [ArrayChunksMut](../slice/struct.arraychunksmut "struct std::slice::ArrayChunksMut")<'a, T, N>
```
impl<'a, T, const N: usize> Iterator for ArrayChunksMut<'a, T, N>
type Item = &'a mut [T; N];
```
🔬This is a nightly-only experimental API. (`array_chunks` [#74985](https://github.com/rust-lang/rust/issues/74985))
Returns an iterator over `N` elements of the slice at a time, starting at the beginning of the slice.
The chunks are mutable array references and do not overlap. If `N` does not divide the length of the slice, then the last up to `N-1` elements will be omitted and can be retrieved from the `into_remainder` function of the iterator.
This method is the const generic equivalent of [`chunks_exact_mut`](../primitive.slice#method.chunks_exact_mut).
##### Panics
Panics if `N` is 0. This check will most probably get changed to a compile time error before this method gets stabilized.
##### Examples
```
#![feature(array_chunks)]
let v = &mut [0, 0, 0, 0, 0];
let mut count = 1;
for chunk in v.array_chunks_mut() {
*chunk = [count; 2];
count += 1;
}
assert_eq!(v, &[1, 1, 2, 2, 0]);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#1264)#### pub fn array\_windows<const N: usize>(&self) -> ArrayWindows<'\_, T, N>
Notable traits for [ArrayWindows](../slice/struct.arraywindows "struct std::slice::ArrayWindows")<'a, T, N>
```
impl<'a, T, const N: usize> Iterator for ArrayWindows<'a, T, N>
type Item = &'a [T; N];
```
🔬This is a nightly-only experimental API. (`array_windows` [#75027](https://github.com/rust-lang/rust/issues/75027))
Returns an iterator over overlapping windows of `N` elements of a slice, starting at the beginning of the slice.
This is the const generic equivalent of [`windows`](../primitive.slice#method.windows).
If `N` is greater than the size of the slice, it will return no windows.
##### Panics
Panics if `N` is 0. This check will most probably get changed to a compile time error before this method gets stabilized.
##### Examples
```
#![feature(array_windows)]
let slice = [0, 1, 2, 3];
let mut iter = slice.array_windows();
assert_eq!(iter.next().unwrap(), &[0, 1]);
assert_eq!(iter.next().unwrap(), &[1, 2]);
assert_eq!(iter.next().unwrap(), &[2, 3]);
assert!(iter.next().is_none());
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#1298)1.31.0 · #### pub fn rchunks(&self, chunk\_size: usize) -> RChunks<'\_, T>
Notable traits for [RChunks](../slice/struct.rchunks "struct std::slice::RChunks")<'a, T>
```
impl<'a, T> Iterator for RChunks<'a, T>
type Item = &'a [T];
```
Returns an iterator over `chunk_size` elements of the slice at a time, starting at the end of the slice.
The chunks are slices and do not overlap. If `chunk_size` does not divide the length of the slice, then the last chunk will not have length `chunk_size`.
See [`rchunks_exact`](../primitive.slice#method.rchunks_exact) for a variant of this iterator that returns chunks of always exactly `chunk_size` elements, and [`chunks`](../primitive.slice#method.chunks) for the same iterator but starting at the beginning of the slice.
##### Panics
Panics if `chunk_size` is 0.
##### Examples
```
let slice = ['l', 'o', 'r', 'e', 'm'];
let mut iter = slice.rchunks(2);
assert_eq!(iter.next().unwrap(), &['e', 'm']);
assert_eq!(iter.next().unwrap(), &['o', 'r']);
assert_eq!(iter.next().unwrap(), &['l']);
assert!(iter.next().is_none());
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#1336)1.31.0 · #### pub fn rchunks\_mut(&mut self, chunk\_size: usize) -> RChunksMut<'\_, T>
Notable traits for [RChunksMut](../slice/struct.rchunksmut "struct std::slice::RChunksMut")<'a, T>
```
impl<'a, T> Iterator for RChunksMut<'a, T>
type Item = &'a mut [T];
```
Returns an iterator over `chunk_size` elements of the slice at a time, starting at the end of the slice.
The chunks are mutable slices, and do not overlap. If `chunk_size` does not divide the length of the slice, then the last chunk will not have length `chunk_size`.
See [`rchunks_exact_mut`](../primitive.slice#method.rchunks_exact_mut) for a variant of this iterator that returns chunks of always exactly `chunk_size` elements, and [`chunks_mut`](../primitive.slice#method.chunks_mut) for the same iterator but starting at the beginning of the slice.
##### Panics
Panics if `chunk_size` is 0.
##### Examples
```
let v = &mut [0, 0, 0, 0, 0];
let mut count = 1;
for chunk in v.rchunks_mut(2) {
for elem in chunk.iter_mut() {
*elem += count;
}
count += 1;
}
assert_eq!(v, &[3, 2, 2, 1, 1]);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#1375)1.31.0 · #### pub fn rchunks\_exact(&self, chunk\_size: usize) -> RChunksExact<'\_, T>
Notable traits for [RChunksExact](../slice/struct.rchunksexact "struct std::slice::RChunksExact")<'a, T>
```
impl<'a, T> Iterator for RChunksExact<'a, T>
type Item = &'a [T];
```
Returns an iterator over `chunk_size` elements of the slice at a time, starting at the end of the slice.
The chunks are slices and do not overlap. If `chunk_size` does not divide the length of the slice, then the last up to `chunk_size-1` elements will be omitted and can be retrieved from the `remainder` function of the iterator.
Due to each chunk having exactly `chunk_size` elements, the compiler can often optimize the resulting code better than in the case of [`rchunks`](../primitive.slice#method.rchunks).
See [`rchunks`](../primitive.slice#method.rchunks) for a variant of this iterator that also returns the remainder as a smaller chunk, and [`chunks_exact`](../primitive.slice#method.chunks_exact) for the same iterator but starting at the beginning of the slice.
##### Panics
Panics if `chunk_size` is 0.
##### Examples
```
let slice = ['l', 'o', 'r', 'e', 'm'];
let mut iter = slice.rchunks_exact(2);
assert_eq!(iter.next().unwrap(), &['e', 'm']);
assert_eq!(iter.next().unwrap(), &['o', 'r']);
assert!(iter.next().is_none());
assert_eq!(iter.remainder(), &['l']);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#1418)1.31.0 · #### pub fn rchunks\_exact\_mut(&mut self, chunk\_size: usize) -> RChunksExactMut<'\_, T>
Notable traits for [RChunksExactMut](../slice/struct.rchunksexactmut "struct std::slice::RChunksExactMut")<'a, T>
```
impl<'a, T> Iterator for RChunksExactMut<'a, T>
type Item = &'a mut [T];
```
Returns an iterator over `chunk_size` elements of the slice at a time, starting at the end of the slice.
The chunks are mutable slices, and do not overlap. If `chunk_size` does not divide the length of the slice, then the last up to `chunk_size-1` elements will be omitted and can be retrieved from the `into_remainder` function of the iterator.
Due to each chunk having exactly `chunk_size` elements, the compiler can often optimize the resulting code better than in the case of [`chunks_mut`](../primitive.slice#method.chunks_mut).
See [`rchunks_mut`](../primitive.slice#method.rchunks_mut) for a variant of this iterator that also returns the remainder as a smaller chunk, and [`chunks_exact_mut`](../primitive.slice#method.chunks_exact_mut) for the same iterator but starting at the beginning of the slice.
##### Panics
Panics if `chunk_size` is 0.
##### Examples
```
let v = &mut [0, 0, 0, 0, 0];
let mut count = 1;
for chunk in v.rchunks_exact_mut(2) {
for elem in chunk.iter_mut() {
*elem += count;
}
count += 1;
}
assert_eq!(v, &[0, 2, 2, 1, 1]);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#1461-1463)#### pub fn group\_by<F>(&self, pred: F) -> GroupBy<'\_, T, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T, [&](../primitive.reference)T) -> [bool](../primitive.bool),
Notable traits for [GroupBy](../slice/struct.groupby "struct std::slice::GroupBy")<'a, T, P>
```
impl<'a, T, P> Iterator for GroupBy<'a, T, P>where
T: 'a,
P: FnMut(&T, &T) -> bool,
type Item = &'a [T];
```
🔬This is a nightly-only experimental API. (`slice_group_by` [#80552](https://github.com/rust-lang/rust/issues/80552))
Returns an iterator over the slice producing non-overlapping runs of elements using the predicate to separate them.
The predicate is called on two elements following themselves, it means the predicate is called on `slice[0]` and `slice[1]` then on `slice[1]` and `slice[2]` and so on.
##### Examples
```
#![feature(slice_group_by)]
let slice = &[1, 1, 1, 3, 3, 2, 2, 2];
let mut iter = slice.group_by(|a, b| a == b);
assert_eq!(iter.next(), Some(&[1, 1, 1][..]));
assert_eq!(iter.next(), Some(&[3, 3][..]));
assert_eq!(iter.next(), Some(&[2, 2, 2][..]));
assert_eq!(iter.next(), None);
```
This method can be used to extract the sorted subslices:
```
#![feature(slice_group_by)]
let slice = &[1, 1, 2, 3, 2, 3, 2, 3, 4];
let mut iter = slice.group_by(|a, b| a <= b);
assert_eq!(iter.next(), Some(&[1, 1, 2, 3][..]));
assert_eq!(iter.next(), Some(&[2, 3][..]));
assert_eq!(iter.next(), Some(&[2, 3, 4][..]));
assert_eq!(iter.next(), None);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#1506-1508)#### pub fn group\_by\_mut<F>(&mut self, pred: F) -> GroupByMut<'\_, T, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T, [&](../primitive.reference)T) -> [bool](../primitive.bool),
Notable traits for [GroupByMut](../slice/struct.groupbymut "struct std::slice::GroupByMut")<'a, T, P>
```
impl<'a, T, P> Iterator for GroupByMut<'a, T, P>where
T: 'a,
P: FnMut(&T, &T) -> bool,
type Item = &'a mut [T];
```
🔬This is a nightly-only experimental API. (`slice_group_by` [#80552](https://github.com/rust-lang/rust/issues/80552))
Returns an iterator over the slice producing non-overlapping mutable runs of elements using the predicate to separate them.
The predicate is called on two elements following themselves, it means the predicate is called on `slice[0]` and `slice[1]` then on `slice[1]` and `slice[2]` and so on.
##### Examples
```
#![feature(slice_group_by)]
let slice = &mut [1, 1, 1, 3, 3, 2, 2, 2];
let mut iter = slice.group_by_mut(|a, b| a == b);
assert_eq!(iter.next(), Some(&mut [1, 1, 1][..]));
assert_eq!(iter.next(), Some(&mut [3, 3][..]));
assert_eq!(iter.next(), Some(&mut [2, 2, 2][..]));
assert_eq!(iter.next(), None);
```
This method can be used to extract the sorted subslices:
```
#![feature(slice_group_by)]
let slice = &mut [1, 1, 2, 3, 2, 3, 2, 3, 4];
let mut iter = slice.group_by_mut(|a, b| a <= b);
assert_eq!(iter.next(), Some(&mut [1, 1, 2, 3][..]));
assert_eq!(iter.next(), Some(&mut [2, 3][..]));
assert_eq!(iter.next(), Some(&mut [2, 3, 4][..]));
assert_eq!(iter.next(), None);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#1551)1.0.0 · #### pub fn split\_at(&self, mid: usize) -> (&[T], &[T])
Divides one slice into two at an index.
The first will contain all indices from `[0, mid)` (excluding the index `mid` itself) and the second will contain all indices from `[mid, len)` (excluding the index `len` itself).
##### Panics
Panics if `mid > len`.
##### Examples
```
let v = [1, 2, 3, 4, 5, 6];
{
let (left, right) = v.split_at(0);
assert_eq!(left, []);
assert_eq!(right, [1, 2, 3, 4, 5, 6]);
}
{
let (left, right) = v.split_at(2);
assert_eq!(left, [1, 2]);
assert_eq!(right, [3, 4, 5, 6]);
}
{
let (left, right) = v.split_at(6);
assert_eq!(left, [1, 2, 3, 4, 5, 6]);
assert_eq!(right, []);
}
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#1583)1.0.0 · #### pub fn split\_at\_mut(&mut self, mid: usize) -> (&mut [T], &mut [T])
Divides one mutable slice into two at an index.
The first will contain all indices from `[0, mid)` (excluding the index `mid` itself) and the second will contain all indices from `[mid, len)` (excluding the index `len` itself).
##### Panics
Panics if `mid > len`.
##### Examples
```
let mut v = [1, 0, 3, 0, 5, 6];
let (left, right) = v.split_at_mut(2);
assert_eq!(left, [1, 0]);
assert_eq!(right, [3, 0, 5, 6]);
left[1] = 2;
right[1] = 4;
assert_eq!(v, [1, 2, 3, 4, 5, 6]);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#1636)#### pub unsafe fn split\_at\_unchecked(&self, mid: usize) -> (&[T], &[T])
🔬This is a nightly-only experimental API. (`slice_split_at_unchecked` [#76014](https://github.com/rust-lang/rust/issues/76014))
Divides one slice into two at an index, without doing bounds checking.
The first will contain all indices from `[0, mid)` (excluding the index `mid` itself) and the second will contain all indices from `[mid, len)` (excluding the index `len` itself).
For a safe alternative see [`split_at`](../primitive.slice#method.split_at).
##### Safety
Calling this method with an out-of-bounds index is *[undefined behavior](../../reference/behavior-considered-undefined)* even if the resulting reference is not used. The caller has to ensure that `0 <= mid <= self.len()`.
##### Examples
```
#![feature(slice_split_at_unchecked)]
let v = [1, 2, 3, 4, 5, 6];
unsafe {
let (left, right) = v.split_at_unchecked(0);
assert_eq!(left, []);
assert_eq!(right, [1, 2, 3, 4, 5, 6]);
}
unsafe {
let (left, right) = v.split_at_unchecked(2);
assert_eq!(left, [1, 2]);
assert_eq!(right, [3, 4, 5, 6]);
}
unsafe {
let (left, right) = v.split_at_unchecked(6);
assert_eq!(left, [1, 2, 3, 4, 5, 6]);
assert_eq!(right, []);
}
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#1684)#### pub unsafe fn split\_at\_mut\_unchecked( &mut self, mid: usize) -> (&mut [T], &mut [T])
🔬This is a nightly-only experimental API. (`slice_split_at_unchecked` [#76014](https://github.com/rust-lang/rust/issues/76014))
Divides one mutable slice into two at an index, without doing bounds checking.
The first will contain all indices from `[0, mid)` (excluding the index `mid` itself) and the second will contain all indices from `[mid, len)` (excluding the index `len` itself).
For a safe alternative see [`split_at_mut`](../primitive.slice#method.split_at_mut).
##### Safety
Calling this method with an out-of-bounds index is *[undefined behavior](../../reference/behavior-considered-undefined)* even if the resulting reference is not used. The caller has to ensure that `0 <= mid <= self.len()`.
##### Examples
```
#![feature(slice_split_at_unchecked)]
let mut v = [1, 0, 3, 0, 5, 6];
// scoped to restrict the lifetime of the borrows
unsafe {
let (left, right) = v.split_at_mut_unchecked(2);
assert_eq!(left, [1, 0]);
assert_eq!(right, [3, 0, 5, 6]);
left[1] = 2;
right[1] = 4;
}
assert_eq!(v, [1, 2, 3, 4, 5, 6]);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#1737)#### pub fn split\_array\_ref<const N: usize>(&self) -> (&[T; N], &[T])
🔬This is a nightly-only experimental API. (`split_array` [#90091](https://github.com/rust-lang/rust/issues/90091))
Divides one slice into an array and a remainder slice at an index.
The array will contain all indices from `[0, N)` (excluding the index `N` itself) and the slice will contain all indices from `[N, len)` (excluding the index `len` itself).
##### Panics
Panics if `N > len`.
##### Examples
```
#![feature(split_array)]
let v = &[1, 2, 3, 4, 5, 6][..];
{
let (left, right) = v.split_array_ref::<0>();
assert_eq!(left, &[]);
assert_eq!(right, [1, 2, 3, 4, 5, 6]);
}
{
let (left, right) = v.split_array_ref::<2>();
assert_eq!(left, &[1, 2]);
assert_eq!(right, [3, 4, 5, 6]);
}
{
let (left, right) = v.split_array_ref::<6>();
assert_eq!(left, &[1, 2, 3, 4, 5, 6]);
assert_eq!(right, []);
}
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#1770)#### pub fn split\_array\_mut<const N: usize>(&mut self) -> (&mut [T; N], &mut [T])
🔬This is a nightly-only experimental API. (`split_array` [#90091](https://github.com/rust-lang/rust/issues/90091))
Divides one mutable slice into an array and a remainder slice at an index.
The array will contain all indices from `[0, N)` (excluding the index `N` itself) and the slice will contain all indices from `[N, len)` (excluding the index `len` itself).
##### Panics
Panics if `N > len`.
##### Examples
```
#![feature(split_array)]
let mut v = &mut [1, 0, 3, 0, 5, 6][..];
let (left, right) = v.split_array_mut::<2>();
assert_eq!(left, &mut [1, 0]);
assert_eq!(right, [3, 0, 5, 6]);
left[1] = 2;
right[1] = 4;
assert_eq!(v, [1, 2, 3, 4, 5, 6]);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#1815)#### pub fn rsplit\_array\_ref<const N: usize>(&self) -> (&[T], &[T; N])
🔬This is a nightly-only experimental API. (`split_array` [#90091](https://github.com/rust-lang/rust/issues/90091))
Divides one slice into an array and a remainder slice at an index from the end.
The slice will contain all indices from `[0, len - N)` (excluding the index `len - N` itself) and the array will contain all indices from `[len - N, len)` (excluding the index `len` itself).
##### Panics
Panics if `N > len`.
##### Examples
```
#![feature(split_array)]
let v = &[1, 2, 3, 4, 5, 6][..];
{
let (left, right) = v.rsplit_array_ref::<0>();
assert_eq!(left, [1, 2, 3, 4, 5, 6]);
assert_eq!(right, &[]);
}
{
let (left, right) = v.rsplit_array_ref::<2>();
assert_eq!(left, [1, 2, 3, 4]);
assert_eq!(right, &[5, 6]);
}
{
let (left, right) = v.rsplit_array_ref::<6>();
assert_eq!(left, []);
assert_eq!(right, &[1, 2, 3, 4, 5, 6]);
}
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#1849)#### pub fn rsplit\_array\_mut<const N: usize>(&mut self) -> (&mut [T], &mut [T; N])
🔬This is a nightly-only experimental API. (`split_array` [#90091](https://github.com/rust-lang/rust/issues/90091))
Divides one mutable slice into an array and a remainder slice at an index from the end.
The slice will contain all indices from `[0, len - N)` (excluding the index `N` itself) and the array will contain all indices from `[len - N, len)` (excluding the index `len` itself).
##### Panics
Panics if `N > len`.
##### Examples
```
#![feature(split_array)]
let mut v = &mut [1, 0, 3, 0, 5, 6][..];
let (left, right) = v.rsplit_array_mut::<4>();
assert_eq!(left, [1, 0]);
assert_eq!(right, &mut [3, 0, 5, 6]);
left[1] = 2;
right[1] = 4;
assert_eq!(v, [1, 2, 3, 4, 5, 6]);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#1898-1900)1.0.0 · #### pub fn split<F>(&self, pred: F) -> Split<'\_, T, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
Notable traits for [Split](../slice/struct.split "struct std::slice::Split")<'a, T, P>
```
impl<'a, T, P> Iterator for Split<'a, T, P>where
P: FnMut(&T) -> bool,
type Item = &'a [T];
```
Returns an iterator over subslices separated by elements that match `pred`. The matched element is not contained in the subslices.
##### Examples
```
let slice = [10, 40, 33, 20];
let mut iter = slice.split(|num| num % 3 == 0);
assert_eq!(iter.next().unwrap(), &[10, 40]);
assert_eq!(iter.next().unwrap(), &[20]);
assert!(iter.next().is_none());
```
If the first element is matched, an empty slice will be the first item returned by the iterator. Similarly, if the last element in the slice is matched, an empty slice will be the last item returned by the iterator:
```
let slice = [10, 40, 33];
let mut iter = slice.split(|num| num % 3 == 0);
assert_eq!(iter.next().unwrap(), &[10, 40]);
assert_eq!(iter.next().unwrap(), &[]);
assert!(iter.next().is_none());
```
If two matched elements are directly adjacent, an empty slice will be present between them:
```
let slice = [10, 6, 33, 20];
let mut iter = slice.split(|num| num % 3 == 0);
assert_eq!(iter.next().unwrap(), &[10]);
assert_eq!(iter.next().unwrap(), &[]);
assert_eq!(iter.next().unwrap(), &[20]);
assert!(iter.next().is_none());
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#1920-1922)1.0.0 · #### pub fn split\_mut<F>(&mut self, pred: F) -> SplitMut<'\_, T, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
Notable traits for [SplitMut](../slice/struct.splitmut "struct std::slice::SplitMut")<'a, T, P>
```
impl<'a, T, P> Iterator for SplitMut<'a, T, P>where
P: FnMut(&T) -> bool,
type Item = &'a mut [T];
```
Returns an iterator over mutable subslices separated by elements that match `pred`. The matched element is not contained in the subslices.
##### Examples
```
let mut v = [10, 40, 30, 20, 60, 50];
for group in v.split_mut(|num| *num % 3 == 0) {
group[0] = 1;
}
assert_eq!(v, [1, 40, 30, 1, 60, 1]);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#1956-1958)1.51.0 · #### pub fn split\_inclusive<F>(&self, pred: F) -> SplitInclusive<'\_, T, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
Notable traits for [SplitInclusive](../slice/struct.splitinclusive "struct std::slice::SplitInclusive")<'a, T, P>
```
impl<'a, T, P> Iterator for SplitInclusive<'a, T, P>where
P: FnMut(&T) -> bool,
type Item = &'a [T];
```
Returns an iterator over subslices separated by elements that match `pred`. The matched element is contained in the end of the previous subslice as a terminator.
##### Examples
```
let slice = [10, 40, 33, 20];
let mut iter = slice.split_inclusive(|num| num % 3 == 0);
assert_eq!(iter.next().unwrap(), &[10, 40, 33]);
assert_eq!(iter.next().unwrap(), &[20]);
assert!(iter.next().is_none());
```
If the last element of the slice is matched, that element will be considered the terminator of the preceding slice. That slice will be the last item returned by the iterator.
```
let slice = [3, 10, 40, 33];
let mut iter = slice.split_inclusive(|num| num % 3 == 0);
assert_eq!(iter.next().unwrap(), &[3]);
assert_eq!(iter.next().unwrap(), &[10, 40, 33]);
assert!(iter.next().is_none());
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#1980-1982)1.51.0 · #### pub fn split\_inclusive\_mut<F>(&mut self, pred: F) -> SplitInclusiveMut<'\_, T, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
Notable traits for [SplitInclusiveMut](../slice/struct.splitinclusivemut "struct std::slice::SplitInclusiveMut")<'a, T, P>
```
impl<'a, T, P> Iterator for SplitInclusiveMut<'a, T, P>where
P: FnMut(&T) -> bool,
type Item = &'a mut [T];
```
Returns an iterator over mutable subslices separated by elements that match `pred`. The matched element is contained in the previous subslice as a terminator.
##### Examples
```
let mut v = [10, 40, 30, 20, 60, 50];
for group in v.split_inclusive_mut(|num| *num % 3 == 0) {
let terminator_idx = group.len()-1;
group[terminator_idx] = 1;
}
assert_eq!(v, [10, 40, 1, 20, 1, 1]);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#2016-2018)1.27.0 · #### pub fn rsplit<F>(&self, pred: F) -> RSplit<'\_, T, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
Notable traits for [RSplit](../slice/struct.rsplit "struct std::slice::RSplit")<'a, T, P>
```
impl<'a, T, P> Iterator for RSplit<'a, T, P>where
P: FnMut(&T) -> bool,
type Item = &'a [T];
```
Returns an iterator over subslices separated by elements that match `pred`, starting at the end of the slice and working backwards. The matched element is not contained in the subslices.
##### Examples
```
let slice = [11, 22, 33, 0, 44, 55];
let mut iter = slice.rsplit(|num| *num == 0);
assert_eq!(iter.next().unwrap(), &[44, 55]);
assert_eq!(iter.next().unwrap(), &[11, 22, 33]);
assert_eq!(iter.next(), None);
```
As with `split()`, if the first or last element is matched, an empty slice will be the first (or last) item returned by the iterator.
```
let v = &[0, 1, 1, 2, 3, 5, 8];
let mut it = v.rsplit(|n| *n % 2 == 0);
assert_eq!(it.next().unwrap(), &[]);
assert_eq!(it.next().unwrap(), &[3, 5]);
assert_eq!(it.next().unwrap(), &[1, 1]);
assert_eq!(it.next().unwrap(), &[]);
assert_eq!(it.next(), None);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#2042-2044)1.27.0 · #### pub fn rsplit\_mut<F>(&mut self, pred: F) -> RSplitMut<'\_, T, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
Notable traits for [RSplitMut](../slice/struct.rsplitmut "struct std::slice::RSplitMut")<'a, T, P>
```
impl<'a, T, P> Iterator for RSplitMut<'a, T, P>where
P: FnMut(&T) -> bool,
type Item = &'a mut [T];
```
Returns an iterator over mutable subslices separated by elements that match `pred`, starting at the end of the slice and working backwards. The matched element is not contained in the subslices.
##### Examples
```
let mut v = [100, 400, 300, 200, 600, 500];
let mut count = 0;
for group in v.rsplit_mut(|num| *num % 3 == 0) {
count += 1;
group[0] = count;
}
assert_eq!(v, [3, 400, 300, 2, 600, 1]);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#2070-2072)1.0.0 · #### pub fn splitn<F>(&self, n: usize, pred: F) -> SplitN<'\_, T, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
Notable traits for [SplitN](../slice/struct.splitn "struct std::slice::SplitN")<'a, T, P>
```
impl<'a, T, P> Iterator for SplitN<'a, T, P>where
P: FnMut(&T) -> bool,
type Item = &'a [T];
```
Returns an iterator over subslices separated by elements that match `pred`, limited to returning at most `n` items. The matched element is not contained in the subslices.
The last element returned, if any, will contain the remainder of the slice.
##### Examples
Print the slice split once by numbers divisible by 3 (i.e., `[10, 40]`, `[20, 60, 50]`):
```
let v = [10, 40, 30, 20, 60, 50];
for group in v.splitn(2, |num| *num % 3 == 0) {
println!("{group:?}");
}
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#2096-2098)1.0.0 · #### pub fn splitn\_mut<F>(&mut self, n: usize, pred: F) -> SplitNMut<'\_, T, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
Notable traits for [SplitNMut](../slice/struct.splitnmut "struct std::slice::SplitNMut")<'a, T, P>
```
impl<'a, T, P> Iterator for SplitNMut<'a, T, P>where
P: FnMut(&T) -> bool,
type Item = &'a mut [T];
```
Returns an iterator over subslices separated by elements that match `pred`, limited to returning at most `n` items. The matched element is not contained in the subslices.
The last element returned, if any, will contain the remainder of the slice.
##### Examples
```
let mut v = [10, 40, 30, 20, 60, 50];
for group in v.splitn_mut(2, |num| *num % 3 == 0) {
group[0] = 1;
}
assert_eq!(v, [1, 40, 30, 1, 60, 50]);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#2125-2127)1.0.0 · #### pub fn rsplitn<F>(&self, n: usize, pred: F) -> RSplitN<'\_, T, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
Notable traits for [RSplitN](../slice/struct.rsplitn "struct std::slice::RSplitN")<'a, T, P>
```
impl<'a, T, P> Iterator for RSplitN<'a, T, P>where
P: FnMut(&T) -> bool,
type Item = &'a [T];
```
Returns an iterator over subslices separated by elements that match `pred` limited to returning at most `n` items. This starts at the end of the slice and works backwards. The matched element is not contained in the subslices.
The last element returned, if any, will contain the remainder of the slice.
##### Examples
Print the slice split once, starting from the end, by numbers divisible by 3 (i.e., `[50]`, `[10, 40, 30, 20]`):
```
let v = [10, 40, 30, 20, 60, 50];
for group in v.rsplitn(2, |num| *num % 3 == 0) {
println!("{group:?}");
}
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#2152-2154)1.0.0 · #### pub fn rsplitn\_mut<F>(&mut self, n: usize, pred: F) -> RSplitNMut<'\_, T, F>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
Notable traits for [RSplitNMut](../slice/struct.rsplitnmut "struct std::slice::RSplitNMut")<'a, T, P>
```
impl<'a, T, P> Iterator for RSplitNMut<'a, T, P>where
P: FnMut(&T) -> bool,
type Item = &'a mut [T];
```
Returns an iterator over subslices separated by elements that match `pred` limited to returning at most `n` items. This starts at the end of the slice and works backwards. The matched element is not contained in the subslices.
The last element returned, if any, will contain the remainder of the slice.
##### Examples
```
let mut s = [10, 40, 30, 20, 60, 50];
for group in s.rsplitn_mut(2, |num| *num % 3 == 0) {
group[0] = 1;
}
assert_eq!(s, [1, 40, 30, 20, 60, 1]);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#2187-2189)1.0.0 · #### pub fn contains(&self, x: &T) -> boolwhere T: [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<T>,
Returns `true` if the slice contains an element with the given value.
This operation is *O*(*n*).
Note that if you have a sorted slice, [`binary_search`](../primitive.slice#method.binary_search) may be faster.
##### Examples
```
let v = [10, 40, 30];
assert!(v.contains(&30));
assert!(!v.contains(&50));
```
If you do not have a `&T`, but some other value that you can compare with one (for example, `String` implements `PartialEq<str>`), you can use `iter().any`:
```
let v = [String::from("hello"), String::from("world")]; // slice of `String`
assert!(v.iter().any(|e| e == "hello")); // search with `&str`
assert!(!v.iter().any(|e| e == "hi"));
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#2216-2218)1.0.0 · #### pub fn starts\_with(&self, needle: &[T]) -> boolwhere T: [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<T>,
Returns `true` if `needle` is a prefix of the slice.
##### Examples
```
let v = [10, 40, 30];
assert!(v.starts_with(&[10]));
assert!(v.starts_with(&[10, 40]));
assert!(!v.starts_with(&[50]));
assert!(!v.starts_with(&[10, 50]));
```
Always returns `true` if `needle` is an empty slice:
```
let v = &[10, 40, 30];
assert!(v.starts_with(&[]));
let v: &[u8] = &[];
assert!(v.starts_with(&[]));
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#2246-2248)1.0.0 · #### pub fn ends\_with(&self, needle: &[T]) -> boolwhere T: [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<T>,
Returns `true` if `needle` is a suffix of the slice.
##### Examples
```
let v = [10, 40, 30];
assert!(v.ends_with(&[30]));
assert!(v.ends_with(&[40, 30]));
assert!(!v.ends_with(&[50]));
assert!(!v.ends_with(&[50, 30]));
```
Always returns `true` if `needle` is an empty slice:
```
let v = &[10, 40, 30];
assert!(v.ends_with(&[]));
let v: &[u8] = &[];
assert!(v.ends_with(&[]));
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#2276-2278)1.51.0 · #### pub fn strip\_prefix<P>(&self, prefix: &P) -> Option<&[T]>where P: [SlicePattern](https://doc.rust-lang.org/core/slice/trait.SlicePattern.html "trait core::slice::SlicePattern")<Item = T> + ?[Sized](../marker/trait.sized "trait std::marker::Sized"), T: [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<T>,
Returns a subslice with the prefix removed.
If the slice starts with `prefix`, returns the subslice after the prefix, wrapped in `Some`. If `prefix` is empty, simply returns the original slice.
If the slice does not start with `prefix`, returns `None`.
##### Examples
```
let v = &[10, 40, 30];
assert_eq!(v.strip_prefix(&[10]), Some(&[40, 30][..]));
assert_eq!(v.strip_prefix(&[10, 40]), Some(&[30][..]));
assert_eq!(v.strip_prefix(&[50]), None);
assert_eq!(v.strip_prefix(&[10, 50]), None);
let prefix : &str = "he";
assert_eq!(b"hello".strip_prefix(prefix.as_bytes()),
Some(b"llo".as_ref()));
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#2310-2312)1.51.0 · #### pub fn strip\_suffix<P>(&self, suffix: &P) -> Option<&[T]>where P: [SlicePattern](https://doc.rust-lang.org/core/slice/trait.SlicePattern.html "trait core::slice::SlicePattern")<Item = T> + ?[Sized](../marker/trait.sized "trait std::marker::Sized"), T: [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<T>,
Returns a subslice with the suffix removed.
If the slice ends with `suffix`, returns the subslice before the suffix, wrapped in `Some`. If `suffix` is empty, simply returns the original slice.
If the slice does not end with `suffix`, returns `None`.
##### Examples
```
let v = &[10, 40, 30];
assert_eq!(v.strip_suffix(&[30]), Some(&[10, 40][..]));
assert_eq!(v.strip_suffix(&[40, 30]), Some(&[10][..]));
assert_eq!(v.strip_suffix(&[50]), None);
assert_eq!(v.strip_suffix(&[50, 30]), None);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#2372-2374)1.0.0 · #### pub fn binary\_search(&self, x: &T) -> Result<usize, usize>where T: [Ord](../cmp/trait.ord "trait std::cmp::Ord"),
Binary searches this slice for a given element. This behaves similarly to [`contains`](../primitive.slice#method.contains) if this slice is sorted.
If the value is found then [`Result::Ok`](../result/enum.result#variant.Ok "Result::Ok") is returned, containing the index of the matching element. If there are multiple matches, then any one of the matches could be returned. The index is chosen deterministically, but is subject to change in future versions of Rust. If the value is not found then [`Result::Err`](../result/enum.result#variant.Err "Result::Err") is returned, containing the index where a matching element could be inserted while maintaining sorted order.
See also [`binary_search_by`](../primitive.slice#method.binary_search_by), [`binary_search_by_key`](../primitive.slice#method.binary_search_by_key), and [`partition_point`](../primitive.slice#method.partition_point).
##### Examples
Looks up a series of four elements. The first is found, with a uniquely determined position; the second and third are not found; the fourth could match any position in `[1, 4]`.
```
let s = [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55];
assert_eq!(s.binary_search(&13), Ok(9));
assert_eq!(s.binary_search(&4), Err(7));
assert_eq!(s.binary_search(&100), Err(13));
let r = s.binary_search(&1);
assert!(match r { Ok(1..=4) => true, _ => false, });
```
If you want to insert an item to a sorted vector, while maintaining sort order, consider using [`partition_point`](../primitive.slice#method.partition_point):
```
let mut s = vec![0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55];
let num = 42;
let idx = s.partition_point(|&x| x < num);
// The above is equivalent to `let idx = s.binary_search(&num).unwrap_or_else(|x| x);`
s.insert(idx, num);
assert_eq!(s, [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 42, 55]);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#2423-2425)1.0.0 · #### pub fn binary\_search\_by<'a, F>(&'a self, f: F) -> Result<usize, usize>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&'a](../primitive.reference) T) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Binary searches this slice with a comparator function. This behaves similarly to [`contains`](../primitive.slice#method.contains) if this slice is sorted.
The comparator function should implement an order consistent with the sort order of the underlying slice, returning an order code that indicates whether its argument is `Less`, `Equal` or `Greater` the desired target.
If the value is found then [`Result::Ok`](../result/enum.result#variant.Ok "Result::Ok") is returned, containing the index of the matching element. If there are multiple matches, then any one of the matches could be returned. The index is chosen deterministically, but is subject to change in future versions of Rust. If the value is not found then [`Result::Err`](../result/enum.result#variant.Err "Result::Err") is returned, containing the index where a matching element could be inserted while maintaining sorted order.
See also [`binary_search`](../primitive.slice#method.binary_search), [`binary_search_by_key`](../primitive.slice#method.binary_search_by_key), and [`partition_point`](../primitive.slice#method.partition_point).
##### Examples
Looks up a series of four elements. The first is found, with a uniquely determined position; the second and third are not found; the fourth could match any position in `[1, 4]`.
```
let s = [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55];
let seek = 13;
assert_eq!(s.binary_search_by(|probe| probe.cmp(&seek)), Ok(9));
let seek = 4;
assert_eq!(s.binary_search_by(|probe| probe.cmp(&seek)), Err(7));
let seek = 100;
assert_eq!(s.binary_search_by(|probe| probe.cmp(&seek)), Err(13));
let seek = 1;
let r = s.binary_search_by(|probe| probe.cmp(&seek));
assert!(match r { Ok(1..=4) => true, _ => false, });
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#2503-2506)1.10.0 · #### pub fn binary\_search\_by\_key<'a, B, F>( &'a self, b: &B, f: F) -> Result<usize, usize>where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&'a](../primitive.reference) T) -> B, B: [Ord](../cmp/trait.ord "trait std::cmp::Ord"),
Binary searches this slice with a key extraction function. This behaves similarly to [`contains`](../primitive.slice#method.contains) if this slice is sorted.
Assumes that the slice is sorted by the key, for instance with [`sort_by_key`](../primitive.slice#method.sort_by_key) using the same key extraction function.
If the value is found then [`Result::Ok`](../result/enum.result#variant.Ok "Result::Ok") is returned, containing the index of the matching element. If there are multiple matches, then any one of the matches could be returned. The index is chosen deterministically, but is subject to change in future versions of Rust. If the value is not found then [`Result::Err`](../result/enum.result#variant.Err "Result::Err") is returned, containing the index where a matching element could be inserted while maintaining sorted order.
See also [`binary_search`](../primitive.slice#method.binary_search), [`binary_search_by`](../primitive.slice#method.binary_search_by), and [`partition_point`](../primitive.slice#method.partition_point).
##### Examples
Looks up a series of four elements in a slice of pairs sorted by their second elements. The first is found, with a uniquely determined position; the second and third are not found; the fourth could match any position in `[1, 4]`.
```
let s = [(0, 0), (2, 1), (4, 1), (5, 1), (3, 1),
(1, 2), (2, 3), (4, 5), (5, 8), (3, 13),
(1, 21), (2, 34), (4, 55)];
assert_eq!(s.binary_search_by_key(&13, |&(a, b)| b), Ok(9));
assert_eq!(s.binary_search_by_key(&4, |&(a, b)| b), Err(7));
assert_eq!(s.binary_search_by_key(&100, |&(a, b)| b), Err(13));
let r = s.binary_search_by_key(&1, |&(a, b)| b);
assert!(match r { Ok(1..=4) => true, _ => false, });
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#2539-2541)1.20.0 · #### pub fn sort\_unstable(&mut self)where T: [Ord](../cmp/trait.ord "trait std::cmp::Ord"),
Sorts the slice, but might not preserve the order of equal elements.
This sort is unstable (i.e., may reorder equal elements), in-place (i.e., does not allocate), and *O*(*n* \* log(*n*)) worst-case.
##### Current implementation
The current algorithm is based on [pattern-defeating quicksort](https://github.com/orlp/pdqsort) by Orson Peters, which combines the fast average case of randomized quicksort with the fast worst case of heapsort, while achieving linear time on slices with certain patterns. It uses some randomization to avoid degenerate cases, but with a fixed seed to always provide deterministic behavior.
It is typically faster than stable sorting, except in a few special cases, e.g., when the slice consists of several concatenated sorted sequences.
##### Examples
```
let mut v = [-5, 4, 1, -3, 2];
v.sort_unstable();
assert!(v == [-5, -3, 1, 2, 4]);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#2594-2596)1.20.0 · #### pub fn sort\_unstable\_by<F>(&mut self, compare: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T, [&](../primitive.reference)T) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Sorts the slice with a comparator function, but might not preserve the order of equal elements.
This sort is unstable (i.e., may reorder equal elements), in-place (i.e., does not allocate), and *O*(*n* \* log(*n*)) worst-case.
The comparator function must define a total ordering for the elements in the slice. If the ordering is not total, the order of the elements is unspecified. An order is a total order if it is (for all `a`, `b` and `c`):
* total and antisymmetric: exactly one of `a < b`, `a == b` or `a > b` is true, and
* transitive, `a < b` and `b < c` implies `a < c`. The same must hold for both `==` and `>`.
For example, while [`f64`](../primitive.f64 "f64") doesn’t implement [`Ord`](../cmp/trait.ord "Ord") because `NaN != NaN`, we can use `partial_cmp` as our sort function when we know the slice doesn’t contain a `NaN`.
```
let mut floats = [5f64, 4.0, 1.0, 3.0, 2.0];
floats.sort_unstable_by(|a, b| a.partial_cmp(b).unwrap());
assert_eq!(floats, [1.0, 2.0, 3.0, 4.0, 5.0]);
```
##### Current implementation
The current algorithm is based on [pattern-defeating quicksort](https://github.com/orlp/pdqsort) by Orson Peters, which combines the fast average case of randomized quicksort with the fast worst case of heapsort, while achieving linear time on slices with certain patterns. It uses some randomization to avoid degenerate cases, but with a fixed seed to always provide deterministic behavior.
It is typically faster than stable sorting, except in a few special cases, e.g., when the slice consists of several concatenated sorted sequences.
##### Examples
```
let mut v = [5, 4, 1, 3, 2];
v.sort_unstable_by(|a, b| a.cmp(b));
assert!(v == [1, 2, 3, 4, 5]);
// reverse sorting
v.sort_unstable_by(|a, b| b.cmp(a));
assert!(v == [5, 4, 3, 2, 1]);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#2632-2635)1.20.0 · #### pub fn sort\_unstable\_by\_key<K, F>(&mut self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> K, K: [Ord](../cmp/trait.ord "trait std::cmp::Ord"),
Sorts the slice with a key extraction function, but might not preserve the order of equal elements.
This sort is unstable (i.e., may reorder equal elements), in-place (i.e., does not allocate), and *O*(m \* *n* \* log(*n*)) worst-case, where the key function is *O*(*m*).
##### Current implementation
The current algorithm is based on [pattern-defeating quicksort](https://github.com/orlp/pdqsort) by Orson Peters, which combines the fast average case of randomized quicksort with the fast worst case of heapsort, while achieving linear time on slices with certain patterns. It uses some randomization to avoid degenerate cases, but with a fixed seed to always provide deterministic behavior.
Due to its key calling strategy, [`sort_unstable_by_key`](#method.sort_unstable_by_key) is likely to be slower than [`sort_by_cached_key`](#method.sort_by_cached_key) in cases where the key function is expensive.
##### Examples
```
let mut v = [-5i32, 4, 1, -3, 2];
v.sort_unstable_by_key(|k| k.abs());
assert!(v == [1, 2, -3, 4, -5]);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#2678-2680)1.49.0 · #### pub fn select\_nth\_unstable( &mut self, index: usize) -> (&mut [T], &mut T, &mut [T])where T: [Ord](../cmp/trait.ord "trait std::cmp::Ord"),
Reorder the slice such that the element at `index` is at its final sorted position.
This reordering has the additional property that any value at position `i < index` will be less than or equal to any value at a position `j > index`. Additionally, this reordering is unstable (i.e. any number of equal elements may end up at position `index`), in-place (i.e. does not allocate), and *O*(*n*) worst-case. This function is also/ known as “kth element” in other libraries. It returns a triplet of the following values: all elements less than the one at the given index, the value at the given index, and all elements greater than the one at the given index.
##### Current implementation
The current algorithm is based on the quickselect portion of the same quicksort algorithm used for [`sort_unstable`](../primitive.slice#method.sort_unstable).
##### Panics
Panics when `index >= len()`, meaning it always panics on empty slices.
##### Examples
```
let mut v = [-5i32, 4, 1, -3, 2];
// Find the median
v.select_nth_unstable(2);
// We are only guaranteed the slice will be one of the following, based on the way we sort
// about the specified index.
assert!(v == [-3, -5, 1, 2, 4] ||
v == [-5, -3, 1, 2, 4] ||
v == [-3, -5, 1, 4, 2] ||
v == [-5, -3, 1, 4, 2]);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#2726-2732)1.49.0 · #### pub fn select\_nth\_unstable\_by<F>( &mut self, index: usize, compare: F) -> (&mut [T], &mut T, &mut [T])where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T, [&](../primitive.reference)T) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Reorder the slice with a comparator function such that the element at `index` is at its final sorted position.
This reordering has the additional property that any value at position `i < index` will be less than or equal to any value at a position `j > index` using the comparator function. Additionally, this reordering is unstable (i.e. any number of equal elements may end up at position `index`), in-place (i.e. does not allocate), and *O*(*n*) worst-case. This function is also known as “kth element” in other libraries. It returns a triplet of the following values: all elements less than the one at the given index, the value at the given index, and all elements greater than the one at the given index, using the provided comparator function.
##### Current implementation
The current algorithm is based on the quickselect portion of the same quicksort algorithm used for [`sort_unstable`](../primitive.slice#method.sort_unstable).
##### Panics
Panics when `index >= len()`, meaning it always panics on empty slices.
##### Examples
```
let mut v = [-5i32, 4, 1, -3, 2];
// Find the median as if the slice were sorted in descending order.
v.select_nth_unstable_by(2, |a, b| b.cmp(a));
// We are only guaranteed the slice will be one of the following, based on the way we sort
// about the specified index.
assert!(v == [2, 4, 1, -5, -3] ||
v == [2, 4, 1, -3, -5] ||
v == [4, 2, 1, -5, -3] ||
v == [4, 2, 1, -3, -5]);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#2778-2785)1.49.0 · #### pub fn select\_nth\_unstable\_by\_key<K, F>( &mut self, index: usize, f: F) -> (&mut [T], &mut T, &mut [T])where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> K, K: [Ord](../cmp/trait.ord "trait std::cmp::Ord"),
Reorder the slice with a key extraction function such that the element at `index` is at its final sorted position.
This reordering has the additional property that any value at position `i < index` will be less than or equal to any value at a position `j > index` using the key extraction function. Additionally, this reordering is unstable (i.e. any number of equal elements may end up at position `index`), in-place (i.e. does not allocate), and *O*(*n*) worst-case. This function is also known as “kth element” in other libraries. It returns a triplet of the following values: all elements less than the one at the given index, the value at the given index, and all elements greater than the one at the given index, using the provided key extraction function.
##### Current implementation
The current algorithm is based on the quickselect portion of the same quicksort algorithm used for [`sort_unstable`](../primitive.slice#method.sort_unstable).
##### Panics
Panics when `index >= len()`, meaning it always panics on empty slices.
##### Examples
```
let mut v = [-5i32, 4, 1, -3, 2];
// Return the median as if the array were sorted according to absolute value.
v.select_nth_unstable_by_key(2, |a| a.abs());
// We are only guaranteed the slice will be one of the following, based on the way we sort
// about the specified index.
assert!(v == [1, 2, -3, 4, -5] ||
v == [1, 2, -3, -5, 4] ||
v == [2, 1, -3, 4, -5] ||
v == [2, 1, -3, -5, 4]);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#2813-2815)#### pub fn partition\_dedup(&mut self) -> (&mut [T], &mut [T])where T: [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<T>,
🔬This is a nightly-only experimental API. (`slice_partition_dedup` [#54279](https://github.com/rust-lang/rust/issues/54279))
Moves all consecutive repeated elements to the end of the slice according to the [`PartialEq`](../cmp/trait.partialeq "PartialEq") trait implementation.
Returns two slices. The first contains no consecutive repeated elements. The second contains all the duplicates in no specified order.
If the slice is sorted, the first returned slice contains no duplicates.
##### Examples
```
#![feature(slice_partition_dedup)]
let mut slice = [1, 2, 2, 3, 3, 2, 1, 1];
let (dedup, duplicates) = slice.partition_dedup();
assert_eq!(dedup, [1, 2, 3, 2, 1]);
assert_eq!(duplicates, [2, 3, 1]);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#2847-2849)#### pub fn partition\_dedup\_by<F>(&mut self, same\_bucket: F) -> (&mut [T], &mut [T])where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) T, [&mut](../primitive.reference) T) -> [bool](../primitive.bool),
🔬This is a nightly-only experimental API. (`slice_partition_dedup` [#54279](https://github.com/rust-lang/rust/issues/54279))
Moves all but the first of consecutive elements to the end of the slice satisfying a given equality relation.
Returns two slices. The first contains no consecutive repeated elements. The second contains all the duplicates in no specified order.
The `same_bucket` function is passed references to two elements from the slice and must determine if the elements compare equal. The elements are passed in opposite order from their order in the slice, so if `same_bucket(a, b)` returns `true`, `a` is moved at the end of the slice.
If the slice is sorted, the first returned slice contains no duplicates.
##### Examples
```
#![feature(slice_partition_dedup)]
let mut slice = ["foo", "Foo", "BAZ", "Bar", "bar", "baz", "BAZ"];
let (dedup, duplicates) = slice.partition_dedup_by(|a, b| a.eq_ignore_ascii_case(b));
assert_eq!(dedup, ["foo", "BAZ", "Bar", "baz"]);
assert_eq!(duplicates, ["bar", "Foo", "BAZ"]);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#2973-2976)#### pub fn partition\_dedup\_by\_key<K, F>(&mut self, key: F) -> (&mut [T], &mut [T])where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&mut](../primitive.reference) T) -> K, K: [PartialEq](../cmp/trait.partialeq "trait std::cmp::PartialEq")<K>,
🔬This is a nightly-only experimental API. (`slice_partition_dedup` [#54279](https://github.com/rust-lang/rust/issues/54279))
Moves all but the first of consecutive elements to the end of the slice that resolve to the same key.
Returns two slices. The first contains no consecutive repeated elements. The second contains all the duplicates in no specified order.
If the slice is sorted, the first returned slice contains no duplicates.
##### Examples
```
#![feature(slice_partition_dedup)]
let mut slice = [10, 20, 21, 30, 30, 20, 11, 13];
let (dedup, duplicates) = slice.partition_dedup_by_key(|i| *i / 10);
assert_eq!(dedup, [10, 20, 30, 20, 11]);
assert_eq!(duplicates, [21, 30, 13]);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#3012)1.26.0 · #### pub fn rotate\_left(&mut self, mid: usize)
Rotates the slice in-place such that the first `mid` elements of the slice move to the end while the last `self.len() - mid` elements move to the front. After calling `rotate_left`, the element previously at index `mid` will become the first element in the slice.
##### Panics
This function will panic if `mid` is greater than the length of the slice. Note that `mid == self.len()` does *not* panic and is a no-op rotation.
##### Complexity
Takes linear (in `self.len()`) time.
##### Examples
```
let mut a = ['a', 'b', 'c', 'd', 'e', 'f'];
a.rotate_left(2);
assert_eq!(a, ['c', 'd', 'e', 'f', 'a', 'b']);
```
Rotating a subslice:
```
let mut a = ['a', 'b', 'c', 'd', 'e', 'f'];
a[1..5].rotate_left(1);
assert_eq!(a, ['a', 'c', 'd', 'e', 'b', 'f']);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#3055)1.26.0 · #### pub fn rotate\_right(&mut self, k: usize)
Rotates the slice in-place such that the first `self.len() - k` elements of the slice move to the end while the last `k` elements move to the front. After calling `rotate_right`, the element previously at index `self.len() - k` will become the first element in the slice.
##### Panics
This function will panic if `k` is greater than the length of the slice. Note that `k == self.len()` does *not* panic and is a no-op rotation.
##### Complexity
Takes linear (in `self.len()`) time.
##### Examples
```
let mut a = ['a', 'b', 'c', 'd', 'e', 'f'];
a.rotate_right(2);
assert_eq!(a, ['e', 'f', 'a', 'b', 'c', 'd']);
```
Rotate a subslice:
```
let mut a = ['a', 'b', 'c', 'd', 'e', 'f'];
a[1..5].rotate_right(1);
assert_eq!(a, ['a', 'e', 'b', 'c', 'd', 'f']);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#3078-3080)1.50.0 · #### pub fn fill(&mut self, value: T)where T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
Fills `self` with elements by cloning `value`.
##### Examples
```
let mut buf = vec![0; 10];
buf.fill(1);
assert_eq!(buf, vec![1; 10]);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#3102-3104)1.51.0 · #### pub fn fill\_with<F>(&mut self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")() -> T,
Fills `self` with elements returned by calling a closure repeatedly.
This method uses a closure to create new values. If you’d rather [`Clone`](../clone/trait.clone "Clone") a given value, use [`fill`](../primitive.slice#method.fill). If you want to use the [`Default`](../default/trait.default "Default") trait to generate values, you can pass [`Default::default`](../default/trait.default#tymethod.default "Default::default") as the argument.
##### Examples
```
let mut buf = vec![1; 10];
buf.fill_with(Default::default);
assert_eq!(buf, vec![0; 10]);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#3165-3167)1.7.0 · #### pub fn clone\_from\_slice(&mut self, src: &[T])where T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
Copies the elements from `src` into `self`.
The length of `src` must be the same as `self`.
##### Panics
This function will panic if the two slices have different lengths.
##### Examples
Cloning two elements from a slice into another:
```
let src = [1, 2, 3, 4];
let mut dst = [0, 0];
// Because the slices have to be the same length,
// we slice the source slice from four elements
// to two. It will panic if we don't do this.
dst.clone_from_slice(&src[2..]);
assert_eq!(src, [1, 2, 3, 4]);
assert_eq!(dst, [3, 4]);
```
Rust enforces that there can only be one mutable reference with no immutable references to a particular piece of data in a particular scope. Because of this, attempting to use `clone_from_slice` on a single slice will result in a compile failure:
ⓘ
```
let mut slice = [1, 2, 3, 4, 5];
slice[..2].clone_from_slice(&slice[3..]); // compile fail!
```
To work around this, we can use [`split_at_mut`](../primitive.slice#method.split_at_mut) to create two distinct sub-slices from a slice:
```
let mut slice = [1, 2, 3, 4, 5];
{
let (left, right) = slice.split_at_mut(2);
left.clone_from_slice(&right[1..]);
}
assert_eq!(slice, [4, 5, 3, 4, 5]);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#3229-3231)1.9.0 · #### pub fn copy\_from\_slice(&mut self, src: &[T])where T: [Copy](../marker/trait.copy "trait std::marker::Copy"),
Copies all elements from `src` into `self`, using a memcpy.
The length of `src` must be the same as `self`.
If `T` does not implement `Copy`, use [`clone_from_slice`](../primitive.slice#method.clone_from_slice).
##### Panics
This function will panic if the two slices have different lengths.
##### Examples
Copying two elements from a slice into another:
```
let src = [1, 2, 3, 4];
let mut dst = [0, 0];
// Because the slices have to be the same length,
// we slice the source slice from four elements
// to two. It will panic if we don't do this.
dst.copy_from_slice(&src[2..]);
assert_eq!(src, [1, 2, 3, 4]);
assert_eq!(dst, [3, 4]);
```
Rust enforces that there can only be one mutable reference with no immutable references to a particular piece of data in a particular scope. Because of this, attempting to use `copy_from_slice` on a single slice will result in a compile failure:
ⓘ
```
let mut slice = [1, 2, 3, 4, 5];
slice[..2].copy_from_slice(&slice[3..]); // compile fail!
```
To work around this, we can use [`split_at_mut`](../primitive.slice#method.split_at_mut) to create two distinct sub-slices from a slice:
```
let mut slice = [1, 2, 3, 4, 5];
{
let (left, right) = slice.split_at_mut(2);
left.copy_from_slice(&right[1..]);
}
assert_eq!(slice, [4, 5, 3, 4, 5]);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#3283-3285)1.37.0 · #### pub fn copy\_within<R>(&mut self, src: R, dest: usize)where R: [RangeBounds](../ops/trait.rangebounds "trait std::ops::RangeBounds")<[usize](../primitive.usize)>, T: [Copy](../marker/trait.copy "trait std::marker::Copy"),
Copies elements from one part of the slice to another part of itself, using a memmove.
`src` is the range within `self` to copy from. `dest` is the starting index of the range within `self` to copy to, which will have the same length as `src`. The two ranges may overlap. The ends of the two ranges must be less than or equal to `self.len()`.
##### Panics
This function will panic if either range exceeds the end of the slice, or if the end of `src` is before the start.
##### Examples
Copying four bytes within a slice:
```
let mut bytes = *b"Hello, World!";
bytes.copy_within(1..5, 8);
assert_eq!(&bytes, b"Hello, Wello!");
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#3350)1.27.0 · #### pub fn swap\_with\_slice(&mut self, other: &mut [T])
Swaps all elements in `self` with those in `other`.
The length of `other` must be the same as `self`.
##### Panics
This function will panic if the two slices have different lengths.
##### Example
Swapping two elements across slices:
```
let mut slice1 = [0, 0];
let mut slice2 = [1, 2, 3, 4];
slice1.swap_with_slice(&mut slice2[2..]);
assert_eq!(slice1, [3, 4]);
assert_eq!(slice2, [1, 2, 0, 0]);
```
Rust enforces that there can only be one mutable reference to a particular piece of data in a particular scope. Because of this, attempting to use `swap_with_slice` on a single slice will result in a compile failure:
ⓘ
```
let mut slice = [1, 2, 3, 4, 5];
slice[..2].swap_with_slice(&mut slice[3..]); // compile fail!
```
To work around this, we can use [`split_at_mut`](../primitive.slice#method.split_at_mut) to create two distinct mutable sub-slices from a slice:
```
let mut slice = [1, 2, 3, 4, 5];
{
let (left, right) = slice.split_at_mut(2);
left.swap_with_slice(&mut right[1..]);
}
assert_eq!(slice, [4, 5, 3, 1, 2]);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#3460)1.30.0 · #### pub unsafe fn align\_to<U>(&self) -> (&[T], &[U], &[T])
Transmute the slice to a slice of another type, ensuring alignment of the types is maintained.
This method splits the slice into three distinct slices: prefix, correctly aligned middle slice of a new type, and the suffix slice. The method may make the middle slice the greatest length possible for a given type and input slice, but only your algorithm’s performance should depend on that, not its correctness. It is permissible for all of the input data to be returned as the prefix or suffix slice.
This method has no purpose when either input element `T` or output element `U` are zero-sized and will return the original slice without splitting anything.
##### Safety
This method is essentially a `transmute` with respect to the elements in the returned middle slice, so all the usual caveats pertaining to `transmute::<T, U>` also apply here.
##### Examples
Basic usage:
```
unsafe {
let bytes: [u8; 7] = [1, 2, 3, 4, 5, 6, 7];
let (prefix, shorts, suffix) = bytes.align_to::<u16>();
// less_efficient_algorithm_for_bytes(prefix);
// more_efficient_algorithm_for_aligned_shorts(shorts);
// less_efficient_algorithm_for_bytes(suffix);
}
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#3521)1.30.0 · #### pub unsafe fn align\_to\_mut<U>(&mut self) -> (&mut [T], &mut [U], &mut [T])
Transmute the slice to a slice of another type, ensuring alignment of the types is maintained.
This method splits the slice into three distinct slices: prefix, correctly aligned middle slice of a new type, and the suffix slice. The method may make the middle slice the greatest length possible for a given type and input slice, but only your algorithm’s performance should depend on that, not its correctness. It is permissible for all of the input data to be returned as the prefix or suffix slice.
This method has no purpose when either input element `T` or output element `U` are zero-sized and will return the original slice without splitting anything.
##### Safety
This method is essentially a `transmute` with respect to the elements in the returned middle slice, so all the usual caveats pertaining to `transmute::<T, U>` also apply here.
##### Examples
Basic usage:
```
unsafe {
let mut bytes: [u8; 7] = [1, 2, 3, 4, 5, 6, 7];
let (prefix, shorts, suffix) = bytes.align_to_mut::<u16>();
// less_efficient_algorithm_for_bytes(prefix);
// more_efficient_algorithm_for_aligned_shorts(shorts);
// less_efficient_algorithm_for_bytes(suffix);
}
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#3616-3620)#### pub fn as\_simd<const LANES: usize>(&self) -> (&[T], &[Simd<T, LANES>], &[T])where T: [SimdElement](../simd/trait.simdelement "trait std::simd::SimdElement"), [Simd](../simd/struct.simd "struct std::simd::Simd")<T, LANES>: [AsRef](../convert/trait.asref "trait std::convert::AsRef")<[[](../primitive.array)T[; LANES]](../primitive.array)>, [LaneCount](../simd/struct.lanecount "struct std::simd::LaneCount")<LANES>: [SupportedLaneCount](../simd/trait.supportedlanecount "trait std::simd::SupportedLaneCount"),
🔬This is a nightly-only experimental API. (`portable_simd` [#86656](https://github.com/rust-lang/rust/issues/86656))
Split a slice into a prefix, a middle of aligned SIMD types, and a suffix.
This is a safe wrapper around [`slice::align_to`](../primitive.slice#method.align_to "slice::align_to"), so has the same weak postconditions as that method. You’re only assured that `self.len() == prefix.len() + middle.len() * LANES + suffix.len()`.
Notably, all of the following are possible:
* `prefix.len() >= LANES`.
* `middle.is_empty()` despite `self.len() >= 3 * LANES`.
* `suffix.len() >= LANES`.
That said, this is a safe method, so if you’re only writing safe code, then this can at most cause incorrect logic, not unsoundness.
##### Panics
This will panic if the size of the SIMD type is different from `LANES` times that of the scalar.
At the time of writing, the trait restrictions on `Simd<T, LANES>` keeps that from ever happening, as only power-of-two numbers of lanes are supported. It’s possible that, in the future, those restrictions might be lifted in a way that would make it possible to see panics from this method for something like `LANES == 3`.
##### Examples
```
#![feature(portable_simd)]
use core::simd::SimdFloat;
let short = &[1, 2, 3];
let (prefix, middle, suffix) = short.as_simd::<4>();
assert_eq!(middle, []); // Not enough elements for anything in the middle
// They might be split in any possible way between prefix and suffix
let it = prefix.iter().chain(suffix).copied();
assert_eq!(it.collect::<Vec<_>>(), vec![1, 2, 3]);
fn basic_simd_sum(x: &[f32]) -> f32 {
use std::ops::Add;
use std::simd::f32x4;
let (prefix, middle, suffix) = x.as_simd();
let sums = f32x4::from_array([
prefix.iter().copied().sum(),
0.0,
0.0,
suffix.iter().copied().sum(),
]);
let sums = middle.iter().copied().fold(sums, f32x4::add);
sums.reduce_sum()
}
let numbers: Vec<f32> = (1..101).map(|x| x as _).collect();
assert_eq!(basic_simd_sum(&numbers[1..99]), 4949.0);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#3660-3664)#### pub fn as\_simd\_mut<const LANES: usize>( &mut self) -> (&mut [T], &mut [Simd<T, LANES>], &mut [T])where T: [SimdElement](../simd/trait.simdelement "trait std::simd::SimdElement"), [Simd](../simd/struct.simd "struct std::simd::Simd")<T, LANES>: [AsMut](../convert/trait.asmut "trait std::convert::AsMut")<[[](../primitive.array)T[; LANES]](../primitive.array)>, [LaneCount](../simd/struct.lanecount "struct std::simd::LaneCount")<LANES>: [SupportedLaneCount](../simd/trait.supportedlanecount "trait std::simd::SupportedLaneCount"),
🔬This is a nightly-only experimental API. (`portable_simd` [#86656](https://github.com/rust-lang/rust/issues/86656))
Split a slice into a prefix, a middle of aligned SIMD types, and a suffix.
This is a safe wrapper around [`slice::align_to_mut`](../primitive.slice#method.align_to_mut "slice::align_to_mut"), so has the same weak postconditions as that method. You’re only assured that `self.len() == prefix.len() + middle.len() * LANES + suffix.len()`.
Notably, all of the following are possible:
* `prefix.len() >= LANES`.
* `middle.is_empty()` despite `self.len() >= 3 * LANES`.
* `suffix.len() >= LANES`.
That said, this is a safe method, so if you’re only writing safe code, then this can at most cause incorrect logic, not unsoundness.
This is the mutable version of [`slice::as_simd`](../primitive.slice#method.as_simd "slice::as_simd"); see that for examples.
##### Panics
This will panic if the size of the SIMD type is different from `LANES` times that of the scalar.
At the time of writing, the trait restrictions on `Simd<T, LANES>` keeps that from ever happening, as only power-of-two numbers of lanes are supported. It’s possible that, in the future, those restrictions might be lifted in a way that would make it possible to see panics from this method for something like `LANES == 3`.
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#3700-3702)#### pub fn is\_sorted(&self) -> boolwhere T: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<T>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this slice are sorted.
That is, for each element `a` and its following element `b`, `a <= b` must hold. If the slice yields exactly zero or one element, `true` is returned.
Note that if `Self::Item` is only `PartialOrd`, but not `Ord`, the above definition implies that this function returns `false` if any two consecutive items are not comparable.
##### Examples
```
#![feature(is_sorted)]
let empty: [i32; 0] = [];
assert!([1, 2, 2, 9].is_sorted());
assert!(![1, 3, 2, 4].is_sorted());
assert!([0].is_sorted());
assert!(empty.is_sorted());
assert!(![0.0, 1.0, f32::NAN].is_sorted());
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#3716-3718)#### pub fn is\_sorted\_by<F>(&self, compare: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T, [&](../primitive.reference)T) -> [Option](../option/enum.option "enum std::option::Option")<[Ordering](../cmp/enum.ordering "enum std::cmp::Ordering")>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this slice are sorted using the given comparator function.
Instead of using `PartialOrd::partial_cmp`, this function uses the given `compare` function to determine the ordering of two elements. Apart from that, it’s equivalent to [`is_sorted`](../primitive.slice#method.is_sorted); see its documentation for more information.
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#3742-3745)#### pub fn is\_sorted\_by\_key<F, K>(&self, f: F) -> boolwhere F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> K, K: [PartialOrd](../cmp/trait.partialord "trait std::cmp::PartialOrd")<K>,
🔬This is a nightly-only experimental API. (`is_sorted` [#53485](https://github.com/rust-lang/rust/issues/53485))
Checks if the elements of this slice are sorted using the given key extraction function.
Instead of comparing the slice’s elements directly, this function compares the keys of the elements, as determined by `f`. Apart from that, it’s equivalent to [`is_sorted`](../primitive.slice#method.is_sorted); see its documentation for more information.
##### Examples
```
#![feature(is_sorted)]
assert!(["c", "bb", "aaa"].is_sorted_by_key(|s| s.len()));
assert!(![-2i32, -1, 0, 3].is_sorted_by_key(|n| n.abs()));
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#3791-3793)1.52.0 · #### pub fn partition\_point<P>(&self, pred: P) -> usizewhere P: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> [bool](../primitive.bool),
Returns the index of the partition point according to the given predicate (the index of the first element of the second partition).
The slice is assumed to be partitioned according to the given predicate. This means that all elements for which the predicate returns true are at the start of the slice and all elements for which the predicate returns false are at the end. For example, [7, 15, 3, 5, 4, 12, 6] is a partitioned under the predicate x % 2 != 0 (all odd numbers are at the start, all even at the end).
If this slice is not partitioned, the returned result is unspecified and meaningless, as this method performs a kind of binary search.
See also [`binary_search`](../primitive.slice#method.binary_search), [`binary_search_by`](../primitive.slice#method.binary_search_by), and [`binary_search_by_key`](../primitive.slice#method.binary_search_by_key).
##### Examples
```
let v = [1, 2, 3, 3, 5, 6, 7];
let i = v.partition_point(|&x| x < 5);
assert_eq!(i, 4);
assert!(v[..i].iter().all(|&x| x < 5));
assert!(v[i..].iter().all(|&x| !(x < 5)));
```
If you want to insert an item to a sorted vector, while maintaining sort order:
```
let mut s = vec![0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55];
let num = 42;
let idx = s.partition_point(|&x| x < num);
s.insert(idx, num);
assert_eq!(s, [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 42, 55]);
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#3849)#### pub fn take<R>(self: &mut &'a [T], range: R) -> Option<&'a [T]>where R: [OneSidedRange](../ops/trait.onesidedrange "trait std::ops::OneSidedRange")<[usize](../primitive.usize)>,
🔬This is a nightly-only experimental API. (`slice_take` [#62280](https://github.com/rust-lang/rust/issues/62280))
Removes the subslice corresponding to the given range and returns a reference to it.
Returns `None` and does not modify the slice if the given range is out of bounds.
Note that this method only accepts one-sided ranges such as `2..` or `..6`, but not `2..6`.
##### Examples
Taking the first three elements of a slice:
```
#![feature(slice_take)]
let mut slice: &[_] = &['a', 'b', 'c', 'd'];
let mut first_three = slice.take(..3).unwrap();
assert_eq!(slice, &['d']);
assert_eq!(first_three, &['a', 'b', 'c']);
```
Taking the last two elements of a slice:
```
#![feature(slice_take)]
let mut slice: &[_] = &['a', 'b', 'c', 'd'];
let mut tail = slice.take(2..).unwrap();
assert_eq!(slice, &['a', 'b']);
assert_eq!(tail, &['c', 'd']);
```
Getting `None` when `range` is out of bounds:
```
#![feature(slice_take)]
let mut slice: &[_] = &['a', 'b', 'c', 'd'];
assert_eq!(None, slice.take(5..));
assert_eq!(None, slice.take(..5));
assert_eq!(None, slice.take(..=4));
let expected: &[char] = &['a', 'b', 'c', 'd'];
assert_eq!(Some(expected), slice.take(..4));
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#3918-3921)#### pub fn take\_mut<R>(self: &mut &'a mut [T], range: R) -> Option<&'a mut [T]>where R: [OneSidedRange](../ops/trait.onesidedrange "trait std::ops::OneSidedRange")<[usize](../primitive.usize)>,
🔬This is a nightly-only experimental API. (`slice_take` [#62280](https://github.com/rust-lang/rust/issues/62280))
Removes the subslice corresponding to the given range and returns a mutable reference to it.
Returns `None` and does not modify the slice if the given range is out of bounds.
Note that this method only accepts one-sided ranges such as `2..` or `..6`, but not `2..6`.
##### Examples
Taking the first three elements of a slice:
```
#![feature(slice_take)]
let mut slice: &mut [_] = &mut ['a', 'b', 'c', 'd'];
let mut first_three = slice.take_mut(..3).unwrap();
assert_eq!(slice, &mut ['d']);
assert_eq!(first_three, &mut ['a', 'b', 'c']);
```
Taking the last two elements of a slice:
```
#![feature(slice_take)]
let mut slice: &mut [_] = &mut ['a', 'b', 'c', 'd'];
let mut tail = slice.take_mut(2..).unwrap();
assert_eq!(slice, &mut ['a', 'b']);
assert_eq!(tail, &mut ['c', 'd']);
```
Getting `None` when `range` is out of bounds:
```
#![feature(slice_take)]
let mut slice: &mut [_] = &mut ['a', 'b', 'c', 'd'];
assert_eq!(None, slice.take_mut(5..));
assert_eq!(None, slice.take_mut(..5));
assert_eq!(None, slice.take_mut(..=4));
let expected: &mut [_] = &mut ['a', 'b', 'c', 'd'];
assert_eq!(Some(expected), slice.take_mut(..4));
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#3957)#### pub fn take\_first(self: &mut &'a [T]) -> Option<&'a T>
🔬This is a nightly-only experimental API. (`slice_take` [#62280](https://github.com/rust-lang/rust/issues/62280))
Removes the first element of the slice and returns a reference to it.
Returns `None` if the slice is empty.
##### Examples
```
#![feature(slice_take)]
let mut slice: &[_] = &['a', 'b', 'c'];
let first = slice.take_first().unwrap();
assert_eq!(slice, &['b', 'c']);
assert_eq!(first, &'a');
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#3982)#### pub fn take\_first\_mut(self: &mut &'a mut [T]) -> Option<&'a mut T>
🔬This is a nightly-only experimental API. (`slice_take` [#62280](https://github.com/rust-lang/rust/issues/62280))
Removes the first element of the slice and returns a mutable reference to it.
Returns `None` if the slice is empty.
##### Examples
```
#![feature(slice_take)]
let mut slice: &mut [_] = &mut ['a', 'b', 'c'];
let first = slice.take_first_mut().unwrap();
*first = 'd';
assert_eq!(slice, &['b', 'c']);
assert_eq!(first, &'d');
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#4006)#### pub fn take\_last(self: &mut &'a [T]) -> Option<&'a T>
🔬This is a nightly-only experimental API. (`slice_take` [#62280](https://github.com/rust-lang/rust/issues/62280))
Removes the last element of the slice and returns a reference to it.
Returns `None` if the slice is empty.
##### Examples
```
#![feature(slice_take)]
let mut slice: &[_] = &['a', 'b', 'c'];
let last = slice.take_last().unwrap();
assert_eq!(slice, &['a', 'b']);
assert_eq!(last, &'c');
```
[source](https://doc.rust-lang.org/src/core/slice/mod.rs.html#4031)#### pub fn take\_last\_mut(self: &mut &'a mut [T]) -> Option<&'a mut T>
🔬This is a nightly-only experimental API. (`slice_take` [#62280](https://github.com/rust-lang/rust/issues/62280))
Removes the last element of the slice and returns a mutable reference to it.
Returns `None` if the slice is empty.
##### Examples
```
#![feature(slice_take)]
let mut slice: &mut [_] = &mut ['a', 'b', 'c'];
let last = slice.take_last_mut().unwrap();
*last = 'd';
assert_eq!(slice, &['a', 'b']);
assert_eq!(last, &'d');
```
[source](https://doc.rust-lang.org/src/core/slice/ascii.rs.html#15)1.23.0 · #### pub fn is\_ascii(&self) -> bool
Checks if all bytes in this slice are within the ASCII range.
[source](https://doc.rust-lang.org/src/core/slice/ascii.rs.html#26)1.23.0 · #### pub fn eq\_ignore\_ascii\_case(&self, other: &[u8]) -> bool
Checks that two slices are an ASCII case-insensitive match.
Same as `to_ascii_lowercase(a) == to_ascii_lowercase(b)`, but without allocating and copying temporaries.
[source](https://doc.rust-lang.org/src/core/slice/ascii.rs.html#41)1.23.0 · #### pub fn make\_ascii\_uppercase(&mut self)
Converts this slice to its ASCII upper case equivalent in-place.
ASCII letters ‘a’ to ‘z’ are mapped to ‘A’ to ‘Z’, but non-ASCII letters are unchanged.
To return a new uppercased value without modifying the existing one, use [`to_ascii_uppercase`](#method.to_ascii_uppercase).
[source](https://doc.rust-lang.org/src/core/slice/ascii.rs.html#58)1.23.0 · #### pub fn make\_ascii\_lowercase(&mut self)
Converts this slice to its ASCII lower case equivalent in-place.
ASCII letters ‘A’ to ‘Z’ are mapped to ‘a’ to ‘z’, but non-ASCII letters are unchanged.
To return a new lowercased value without modifying the existing one, use [`to_ascii_lowercase`](#method.to_ascii_lowercase).
[source](https://doc.rust-lang.org/src/core/slice/ascii.rs.html#78)1.60.0 · #### pub fn escape\_ascii(&self) -> EscapeAscii<'\_>
Notable traits for [EscapeAscii](../slice/struct.escapeascii "struct std::slice::EscapeAscii")<'a>
```
impl<'a> Iterator for EscapeAscii<'a>
type Item = u8;
```
Returns an iterator that produces an escaped version of this slice, treating it as an ASCII string.
##### Examples
```
let s = b"0\t\r\n'\"\\\x9d";
let escaped = s.escape_ascii().to_string();
assert_eq!(escaped, "0\\t\\r\\n\\'\\\"\\\\\\x9d");
```
[source](https://doc.rust-lang.org/src/core/slice/ascii.rs.html#97)#### pub fn trim\_ascii\_start(&self) -> &[u8]
Notable traits for &[[u8](../primitive.u8)]
```
impl Read for &[u8]
impl Write for &mut [u8]
```
🔬This is a nightly-only experimental API. (`byte_slice_trim_ascii` [#94035](https://github.com/rust-lang/rust/issues/94035))
Returns a byte slice with leading ASCII whitespace bytes removed.
‘Whitespace’ refers to the definition used by `u8::is_ascii_whitespace`.
##### Examples
```
#![feature(byte_slice_trim_ascii)]
assert_eq!(b" \t hello world\n".trim_ascii_start(), b"hello world\n");
assert_eq!(b" ".trim_ascii_start(), b"");
assert_eq!(b"".trim_ascii_start(), b"");
```
[source](https://doc.rust-lang.org/src/core/slice/ascii.rs.html#126)#### pub fn trim\_ascii\_end(&self) -> &[u8]
Notable traits for &[[u8](../primitive.u8)]
```
impl Read for &[u8]
impl Write for &mut [u8]
```
🔬This is a nightly-only experimental API. (`byte_slice_trim_ascii` [#94035](https://github.com/rust-lang/rust/issues/94035))
Returns a byte slice with trailing ASCII whitespace bytes removed.
‘Whitespace’ refers to the definition used by `u8::is_ascii_whitespace`.
##### Examples
```
#![feature(byte_slice_trim_ascii)]
assert_eq!(b"\r hello world\n ".trim_ascii_end(), b"\r hello world");
assert_eq!(b" ".trim_ascii_end(), b"");
assert_eq!(b"".trim_ascii_end(), b"");
```
[source](https://doc.rust-lang.org/src/core/slice/ascii.rs.html#156)#### pub fn trim\_ascii(&self) -> &[u8]
Notable traits for &[[u8](../primitive.u8)]
```
impl Read for &[u8]
impl Write for &mut [u8]
```
🔬This is a nightly-only experimental API. (`byte_slice_trim_ascii` [#94035](https://github.com/rust-lang/rust/issues/94035))
Returns a byte slice with leading and trailing ASCII whitespace bytes removed.
‘Whitespace’ refers to the definition used by `u8::is_ascii_whitespace`.
##### Examples
```
#![feature(byte_slice_trim_ascii)]
assert_eq!(b"\r hello world\n ".trim_ascii(), b"hello world");
assert_eq!(b" ".trim_ascii(), b"");
assert_eq!(b"".trim_ascii(), b"");
```
[source](https://doc.rust-lang.org/src/alloc/slice.rs.html#618)1.23.0 · #### pub fn to\_ascii\_uppercase(&self) -> Vec<u8, Global>
Notable traits for [Vec](../vec/struct.vec "struct std::vec::Vec")<[u8](../primitive.u8), A>
```
impl<A: Allocator> Write for Vec<u8, A>
```
Returns a vector containing a copy of this slice where each byte is mapped to its ASCII upper case equivalent.
ASCII letters ‘a’ to ‘z’ are mapped to ‘A’ to ‘Z’, but non-ASCII letters are unchanged.
To uppercase the value in-place, use [`make_ascii_uppercase`](../primitive.slice#method.make_ascii_uppercase).
[source](https://doc.rust-lang.org/src/alloc/slice.rs.html#639)1.23.0 · #### pub fn to\_ascii\_lowercase(&self) -> Vec<u8, Global>
Notable traits for [Vec](../vec/struct.vec "struct std::vec::Vec")<[u8](../primitive.u8), A>
```
impl<A: Allocator> Write for Vec<u8, A>
```
Returns a vector containing a copy of this slice where each byte is mapped to its ASCII lower case equivalent.
ASCII letters ‘A’ to ‘Z’ are mapped to ‘a’ to ‘z’, but non-ASCII letters are unchanged.
To lowercase the value in-place, use [`make_ascii_lowercase`](../primitive.slice#method.make_ascii_lowercase).
[source](https://doc.rust-lang.org/src/alloc/slice.rs.html#204-206)1.0.0 · #### pub fn sort(&mut self)where T: [Ord](../cmp/trait.ord "trait std::cmp::Ord"),
Sorts the slice.
This sort is stable (i.e., does not reorder equal elements) and *O*(*n* \* log(*n*)) worst-case.
When applicable, unstable sorting is preferred because it is generally faster than stable sorting and it doesn’t allocate auxiliary memory. See [`sort_unstable`](../primitive.slice#method.sort_unstable).
##### Current implementation
The current algorithm is an adaptive, iterative merge sort inspired by [timsort](https://en.wikipedia.org/wiki/Timsort). It is designed to be very fast in cases where the slice is nearly sorted, or consists of two or more sorted sequences concatenated one after another.
Also, it allocates temporary storage half the size of `self`, but for short slices a non-allocating insertion sort is used instead.
##### Examples
```
let mut v = [-5, 4, 1, -3, 2];
v.sort();
assert!(v == [-5, -3, 1, 2, 4]);
```
[source](https://doc.rust-lang.org/src/alloc/slice.rs.html#260-262)1.0.0 · #### pub fn sort\_by<F>(&mut self, compare: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T, [&](../primitive.reference)T) -> [Ordering](../cmp/enum.ordering "enum std::cmp::Ordering"),
Sorts the slice with a comparator function.
This sort is stable (i.e., does not reorder equal elements) and *O*(*n* \* log(*n*)) worst-case.
The comparator function must define a total ordering for the elements in the slice. If the ordering is not total, the order of the elements is unspecified. An order is a total order if it is (for all `a`, `b` and `c`):
* total and antisymmetric: exactly one of `a < b`, `a == b` or `a > b` is true, and
* transitive, `a < b` and `b < c` implies `a < c`. The same must hold for both `==` and `>`.
For example, while [`f64`](../primitive.f64 "f64") doesn’t implement [`Ord`](../cmp/trait.ord "Ord") because `NaN != NaN`, we can use `partial_cmp` as our sort function when we know the slice doesn’t contain a `NaN`.
```
let mut floats = [5f64, 4.0, 1.0, 3.0, 2.0];
floats.sort_by(|a, b| a.partial_cmp(b).unwrap());
assert_eq!(floats, [1.0, 2.0, 3.0, 4.0, 5.0]);
```
When applicable, unstable sorting is preferred because it is generally faster than stable sorting and it doesn’t allocate auxiliary memory. See [`sort_unstable_by`](../primitive.slice#method.sort_unstable_by).
##### Current implementation
The current algorithm is an adaptive, iterative merge sort inspired by [timsort](https://en.wikipedia.org/wiki/Timsort). It is designed to be very fast in cases where the slice is nearly sorted, or consists of two or more sorted sequences concatenated one after another.
Also, it allocates temporary storage half the size of `self`, but for short slices a non-allocating insertion sort is used instead.
##### Examples
```
let mut v = [5, 4, 1, 3, 2];
v.sort_by(|a, b| a.cmp(b));
assert!(v == [1, 2, 3, 4, 5]);
// reverse sorting
v.sort_by(|a, b| b.cmp(a));
assert!(v == [5, 4, 3, 2, 1]);
```
[source](https://doc.rust-lang.org/src/alloc/slice.rs.html#302-305)1.7.0 · #### pub fn sort\_by\_key<K, F>(&mut self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> K, K: [Ord](../cmp/trait.ord "trait std::cmp::Ord"),
Sorts the slice with a key extraction function.
This sort is stable (i.e., does not reorder equal elements) and *O*(*m* \* *n* \* log(*n*)) worst-case, where the key function is *O*(*m*).
For expensive key functions (e.g. functions that are not simple property accesses or basic operations), [`sort_by_cached_key`](../primitive.slice#method.sort_by_cached_key) is likely to be significantly faster, as it does not recompute element keys.
When applicable, unstable sorting is preferred because it is generally faster than stable sorting and it doesn’t allocate auxiliary memory. See [`sort_unstable_by_key`](../primitive.slice#method.sort_unstable_by_key).
##### Current implementation
The current algorithm is an adaptive, iterative merge sort inspired by [timsort](https://en.wikipedia.org/wiki/Timsort). It is designed to be very fast in cases where the slice is nearly sorted, or consists of two or more sorted sequences concatenated one after another.
Also, it allocates temporary storage half the size of `self`, but for short slices a non-allocating insertion sort is used instead.
##### Examples
```
let mut v = [-5i32, 4, 1, -3, 2];
v.sort_by_key(|k| k.abs());
assert!(v == [1, 2, -3, 4, -5]);
```
[source](https://doc.rust-lang.org/src/alloc/slice.rs.html#349-352)1.34.0 · #### pub fn sort\_by\_cached\_key<K, F>(&mut self, f: F)where F: [FnMut](../ops/trait.fnmut "trait std::ops::FnMut")([&](../primitive.reference)T) -> K, K: [Ord](../cmp/trait.ord "trait std::cmp::Ord"),
Sorts the slice with a key extraction function.
During sorting, the key function is called at most once per element, by using temporary storage to remember the results of key evaluation. The order of calls to the key function is unspecified and may change in future versions of the standard library.
This sort is stable (i.e., does not reorder equal elements) and *O*(*m* \* *n* + *n* \* log(*n*)) worst-case, where the key function is *O*(*m*).
For simple key functions (e.g., functions that are property accesses or basic operations), [`sort_by_key`](../primitive.slice#method.sort_by_key) is likely to be faster.
##### Current implementation
The current algorithm is based on [pattern-defeating quicksort](https://github.com/orlp/pdqsort) by Orson Peters, which combines the fast average case of randomized quicksort with the fast worst case of heapsort, while achieving linear time on slices with certain patterns. It uses some randomization to avoid degenerate cases, but with a fixed seed to always provide deterministic behavior.
In the worst case, the algorithm allocates temporary storage in a `Vec<(K, usize)>` the length of the slice.
##### Examples
```
let mut v = [-5i32, 4, 32, -3, 2];
v.sort_by_cached_key(|k| k.to_string());
assert!(v == [-3, -5, 2, 32, 4]);
```
[source](https://doc.rust-lang.org/src/alloc/slice.rs.html#409-411)1.0.0 · #### pub fn to\_vec(&self) -> Vec<T, Global>where T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
Notable traits for [Vec](../vec/struct.vec "struct std::vec::Vec")<[u8](../primitive.u8), A>
```
impl<A: Allocator> Write for Vec<u8, A>
```
Copies `self` into a new `Vec`.
##### Examples
```
let s = [10, 40, 30];
let x = s.to_vec();
// Here, `s` and `x` can be modified independently.
```
[source](https://doc.rust-lang.org/src/alloc/slice.rs.html#433-435)#### pub fn to\_vec\_in<A>(&self, alloc: A) -> Vec<T, A>where A: [Allocator](../alloc/trait.allocator "trait std::alloc::Allocator"), T: [Clone](../clone/trait.clone "trait std::clone::Clone"),
Notable traits for [Vec](../vec/struct.vec "struct std::vec::Vec")<[u8](../primitive.u8), A>
```
impl<A: Allocator> Write for Vec<u8, A>
```
🔬This is a nightly-only experimental API. (`allocator_api` [#32838](https://github.com/rust-lang/rust/issues/32838))
Copies `self` into a new `Vec` with an allocator.
##### Examples
```
#![feature(allocator_api)]
use std::alloc::System;
let s = [10, 40, 30];
let x = s.to_vec_in(System);
// Here, `s` and `x` can be modified independently.
```
[source](https://doc.rust-lang.org/src/alloc/slice.rs.html#486-488)1.40.0 · #### pub fn repeat(&self, n: usize) -> Vec<T, Global>where T: [Copy](../marker/trait.copy "trait std::marker::Copy"),
Notable traits for [Vec](../vec/struct.vec "struct std::vec::Vec")<[u8](../primitive.u8), A>
```
impl<A: Allocator> Write for Vec<u8, A>
```
Creates a vector by repeating a slice `n` times.
##### Panics
This function will panic if the capacity would overflow.
##### Examples
Basic usage:
```
assert_eq!([1, 2].repeat(3), vec![1, 2, 1, 2, 1, 2]);
```
A panic upon overflow:
ⓘ
```
// this will panic at runtime
b"0123456789abcdef".repeat(usize::MAX);
```
[source](https://doc.rust-lang.org/src/alloc/slice.rs.html#554-556)1.0.0 · #### pub fn concat<Item>(&self) -> <[T] as Concat<Item>>::Outputwhere Item: ?[Sized](../marker/trait.sized "trait std::marker::Sized"), [[T]](../primitive.slice): [Concat](../slice/trait.concat "trait std::slice::Concat")<Item>,
Notable traits for &[[u8](../primitive.u8)]
```
impl Read for &[u8]
impl Write for &mut [u8]
```
Flattens a slice of `T` into a single value `Self::Output`.
##### Examples
```
assert_eq!(["hello", "world"].concat(), "helloworld");
assert_eq!([[1, 2], [3, 4]].concat(), [1, 2, 3, 4]);
```
[source](https://doc.rust-lang.org/src/alloc/slice.rs.html#573-575)1.3.0 · #### pub fn join<Separator>(&self, sep: Separator) -> <[T] as Join<Separator>>::Outputwhere [[T]](../primitive.slice): [Join](../slice/trait.join "trait std::slice::Join")<Separator>,
Notable traits for &[[u8](../primitive.u8)]
```
impl Read for &[u8]
impl Write for &mut [u8]
```
Flattens a slice of `T` into a single value `Self::Output`, placing a given separator between each.
##### Examples
```
assert_eq!(["hello", "world"].join(" "), "hello world");
assert_eq!([[1, 2], [3, 4]].join(&0), [1, 2, 0, 3, 4]);
assert_eq!([[1, 2], [3, 4]].join(&[0, 0][..]), [1, 2, 0, 0, 3, 4]);
```
[source](https://doc.rust-lang.org/src/alloc/slice.rs.html#593-595)1.0.0 · #### pub fn connect<Separator>( &self, sep: Separator) -> <[T] as Join<Separator>>::Outputwhere [[T]](../primitive.slice): [Join](../slice/trait.join "trait std::slice::Join")<Separator>,
Notable traits for &[[u8](../primitive.u8)]
```
impl Read for &[u8]
impl Write for &mut [u8]
```
👎Deprecated since 1.3.0: renamed to join
Flattens a slice of `T` into a single value `Self::Output`, placing a given separator between each.
##### Examples
```
assert_eq!(["hello", "world"].connect(" "), "hello world");
assert_eq!([[1, 2], [3, 4]].connect(&0), [1, 2, 0, 3, 4]);
```
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1071-1075)### impl<'a> Debug for IoSliceMut<'a>
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1072-1074)#### fn fmt(&self, fmt: &mut Formatter<'\_>) -> Result
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1180-1187)### impl<'a> Deref for IoSliceMut<'a>
#### type Target = [u8]
The resulting type after dereferencing.
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1184-1186)#### fn deref(&self) -> &[u8]
Notable traits for &[[u8](../primitive.u8)]
```
impl Read for &[u8]
impl Write for &mut [u8]
```
Dereferences the value.
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1190-1195)### impl<'a> DerefMut for IoSliceMut<'a>
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1192-1194)#### fn deref\_mut(&mut self) -> &mut [u8]
Notable traits for &[[u8](../primitive.u8)]
```
impl Read for &[u8]
impl Write for &mut [u8]
```
Mutably dereferences the value.
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1065)1.44.0 · ### impl<'a> Send for IoSliceMut<'a>
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1068)1.44.0 · ### impl<'a> Sync for IoSliceMut<'a>
Auto Trait Implementations
--------------------------
### impl<'a> RefUnwindSafe for IoSliceMut<'a>
### impl<'a> Unpin for IoSliceMut<'a>
### impl<'a> !UnwindSafe for IoSliceMut<'a>
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
rust Struct std::io::BufReader Struct std::io::BufReader
=========================
```
pub struct BufReader<R> { /* private fields */ }
```
The `BufReader<R>` struct adds buffering to any reader.
It can be excessively inefficient to work directly with a [`Read`](trait.read "Read") instance. For example, every call to [`read`](../net/struct.tcpstream#method.read) on [`TcpStream`](../net/struct.tcpstream) results in a system call. A `BufReader<R>` performs large, infrequent reads on the underlying [`Read`](trait.read "Read") and maintains an in-memory buffer of the results.
`BufReader<R>` can improve the speed of programs that make *small* and *repeated* read calls to the same file or network socket. It does not help when reading very large amounts at once, or reading just one or a few times. It also provides no advantage when reading from a source that is already in memory, like a `[Vec](../vec/struct.vec "Vec")<u8>`.
When the `BufReader<R>` is dropped, the contents of its buffer will be discarded. Creating multiple instances of a `BufReader<R>` on the same stream can cause data loss. Reading from the underlying reader after unwrapping the `BufReader<R>` with [`BufReader::into_inner`](struct.bufreader#method.into_inner "BufReader::into_inner") can also cause data loss.
Examples
--------
```
use std::io::prelude::*;
use std::io::BufReader;
use std::fs::File;
fn main() -> std::io::Result<()> {
let f = File::open("log.txt")?;
let mut reader = BufReader::new(f);
let mut line = String::new();
let len = reader.read_line(&mut line)?;
println!("First line is {len} bytes long");
Ok(())
}
```
Implementations
---------------
[source](https://doc.rust-lang.org/src/std/io/buffered/bufreader.rs.html#55-96)### impl<R: Read> BufReader<R>
[source](https://doc.rust-lang.org/src/std/io/buffered/bufreader.rs.html#72-74)#### pub fn new(inner: R) -> BufReader<R>
Notable traits for [BufReader](struct.bufreader "struct std::io::BufReader")<R>
```
impl<R: Read> Read for BufReader<R>
```
Creates a new `BufReader<R>` with a default buffer capacity. The default is currently 8 KB, but may change in the future.
##### Examples
```
use std::io::BufReader;
use std::fs::File;
fn main() -> std::io::Result<()> {
let f = File::open("log.txt")?;
let reader = BufReader::new(f);
Ok(())
}
```
[source](https://doc.rust-lang.org/src/std/io/buffered/bufreader.rs.html#93-95)#### pub fn with\_capacity(capacity: usize, inner: R) -> BufReader<R>
Notable traits for [BufReader](struct.bufreader "struct std::io::BufReader")<R>
```
impl<R: Read> Read for BufReader<R>
```
Creates a new `BufReader<R>` with the specified buffer capacity.
##### Examples
Creating a buffer with ten bytes of capacity:
```
use std::io::BufReader;
use std::fs::File;
fn main() -> std::io::Result<()> {
let f = File::open("log.txt")?;
let reader = BufReader::with_capacity(10, f);
Ok(())
}
```
[source](https://doc.rust-lang.org/src/std/io/buffered/bufreader.rs.html#98-225)### impl<R> BufReader<R>
[source](https://doc.rust-lang.org/src/std/io/buffered/bufreader.rs.html#118-120)#### pub fn get\_ref(&self) -> &R
Gets a reference to the underlying reader.
It is inadvisable to directly read from the underlying reader.
##### Examples
```
use std::io::BufReader;
use std::fs::File;
fn main() -> std::io::Result<()> {
let f1 = File::open("log.txt")?;
let reader = BufReader::new(f1);
let f2 = reader.get_ref();
Ok(())
}
```
[source](https://doc.rust-lang.org/src/std/io/buffered/bufreader.rs.html#141-143)#### pub fn get\_mut(&mut self) -> &mut R
Gets a mutable reference to the underlying reader.
It is inadvisable to directly read from the underlying reader.
##### Examples
```
use std::io::BufReader;
use std::fs::File;
fn main() -> std::io::Result<()> {
let f1 = File::open("log.txt")?;
let mut reader = BufReader::new(f1);
let f2 = reader.get_mut();
Ok(())
}
```
[source](https://doc.rust-lang.org/src/std/io/buffered/bufreader.rs.html#169-171)1.37.0 · #### pub fn buffer(&self) -> &[u8]
Notable traits for &[[u8](../primitive.u8)]
```
impl Read for &[u8]
impl Write for &mut [u8]
```
Returns a reference to the internally buffered data.
Unlike [`fill_buf`](trait.bufread#tymethod.fill_buf), this will not attempt to fill the buffer if it is empty.
##### Examples
```
use std::io::{BufReader, BufRead};
use std::fs::File;
fn main() -> std::io::Result<()> {
let f = File::open("log.txt")?;
let mut reader = BufReader::new(f);
assert!(reader.buffer().is_empty());
if reader.fill_buf()?.len() > 0 {
assert!(!reader.buffer().is_empty());
}
Ok(())
}
```
[source](https://doc.rust-lang.org/src/std/io/buffered/bufreader.rs.html#192-194)1.46.0 · #### pub fn capacity(&self) -> usize
Returns the number of bytes the internal buffer can hold at once.
##### Examples
```
use std::io::{BufReader, BufRead};
use std::fs::File;
fn main() -> std::io::Result<()> {
let f = File::open("log.txt")?;
let mut reader = BufReader::new(f);
let capacity = reader.capacity();
let buffer = reader.fill_buf()?;
assert!(buffer.len() <= capacity);
Ok(())
}
```
[source](https://doc.rust-lang.org/src/std/io/buffered/bufreader.rs.html#216-218)#### pub fn into\_inner(self) -> R
Unwraps this `BufReader<R>`, returning the underlying reader.
Note that any leftover data in the internal buffer is lost. Therefore, a following read from the underlying reader may lead to data loss.
##### Examples
```
use std::io::BufReader;
use std::fs::File;
fn main() -> std::io::Result<()> {
let f1 = File::open("log.txt")?;
let reader = BufReader::new(f1);
let f2 = reader.into_inner();
Ok(())
}
```
[source](https://doc.rust-lang.org/src/std/io/buffered/bufreader.rs.html#235-257)### impl<R: Seek> BufReader<R>
[source](https://doc.rust-lang.org/src/std/io/buffered/bufreader.rs.html#241-256)1.53.0 · #### pub fn seek\_relative(&mut self, offset: i64) -> Result<()>
Seeks relative to the current position. If the new position lies within the buffer, the buffer will not be flushed, allowing for more efficient seeks. This method does not return the location of the underlying reader, so the caller must track this information themselves if it is required.
Trait Implementations
---------------------
[source](https://doc.rust-lang.org/src/std/io/buffered/bufreader.rs.html#374-382)### impl<R: Read> BufRead for BufReader<R>
[source](https://doc.rust-lang.org/src/std/io/buffered/bufreader.rs.html#375-377)#### fn fill\_buf(&mut self) -> Result<&[u8]>
Returns the contents of the internal buffer, filling it with more data from the inner reader if it is empty. [Read more](trait.bufread#tymethod.fill_buf)
[source](https://doc.rust-lang.org/src/std/io/buffered/bufreader.rs.html#379-381)#### fn consume(&mut self, amt: usize)
Tells this buffer that `amt` bytes have been consumed from the buffer, so they should no longer be returned in calls to `read`. [Read more](trait.bufread#tymethod.consume)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2073-2075)#### fn has\_data\_left(&mut self) -> Result<bool>
🔬This is a nightly-only experimental API. (`buf_read_has_data_left` [#86423](https://github.com/rust-lang/rust/issues/86423))
Check if the underlying `Read` has any data left to be read. [Read more](trait.bufread#method.has_data_left)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2132-2134)#### fn read\_until(&mut self, byte: u8, buf: &mut Vec<u8>) -> Result<usize>
Read all bytes into `buf` until the delimiter `byte` or EOF is reached. [Read more](trait.bufread#method.read_until)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2196-2201)#### fn read\_line(&mut self, buf: &mut String) -> Result<usize>
Read all bytes until a newline (the `0xA` byte) is reached, and append them to the provided buffer. You do not need to clear the buffer before appending. [Read more](trait.bufread#method.read_line)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2234-2239)#### fn split(self, byte: u8) -> Split<Self>where Self: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Notable traits for [Split](struct.split "struct std::io::Split")<B>
```
impl<B: BufRead> Iterator for Split<B>
type Item = Result<Vec<u8>>;
```
Returns an iterator over the contents of this reader split on the byte `byte`. [Read more](trait.bufread#method.split)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#2271-2276)#### fn lines(self) -> Lines<Self>where Self: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Notable traits for [Lines](struct.lines "struct std::io::Lines")<B>
```
impl<B: BufRead> Iterator for Lines<B>
type Item = Result<String>;
```
Returns an iterator over the lines of this reader. [Read more](trait.bufread#method.lines)
[source](https://doc.rust-lang.org/src/std/io/buffered/bufreader.rs.html#385-398)### impl<R> Debug for BufReader<R>where R: [Debug](../fmt/trait.debug "trait std::fmt::Debug"),
[source](https://doc.rust-lang.org/src/std/io/buffered/bufreader.rs.html#389-397)#### fn fmt(&self, fmt: &mut Formatter<'\_>) -> Result
Formats the value using the given formatter. [Read more](../fmt/trait.debug#tymethod.fmt)
[source](https://doc.rust-lang.org/src/std/io/buffered/bufreader.rs.html#260-371)### impl<R: Read> Read for BufReader<R>
[source](https://doc.rust-lang.org/src/std/io/buffered/bufreader.rs.html#261-275)#### fn read(&mut self, buf: &mut [u8]) -> Result<usize>
Pull some bytes from this source into the specified buffer, returning how many bytes were read. [Read more](trait.read#tymethod.read)
[source](https://doc.rust-lang.org/src/std/io/buffered/bufreader.rs.html#277-294)#### fn read\_buf(&mut self, cursor: BorrowedCursor<'\_>) -> Result<()>
🔬This is a nightly-only experimental API. (`read_buf` [#78485](https://github.com/rust-lang/rust/issues/78485))
Pull some bytes from this source into the specified buffer. [Read more](trait.read#method.read_buf)
[source](https://doc.rust-lang.org/src/std/io/buffered/bufreader.rs.html#300-306)#### fn read\_exact(&mut self, buf: &mut [u8]) -> Result<()>
Read the exact number of bytes required to fill `buf`. [Read more](trait.read#method.read_exact)
[source](https://doc.rust-lang.org/src/std/io/buffered/bufreader.rs.html#308-320)#### fn read\_vectored(&mut self, bufs: &mut [IoSliceMut<'\_>]) -> Result<usize>
Like `read`, except that it reads into a slice of buffers. [Read more](trait.read#method.read_vectored)
[source](https://doc.rust-lang.org/src/std/io/buffered/bufreader.rs.html#322-324)#### fn is\_read\_vectored(&self) -> bool
🔬This is a nightly-only experimental API. (`can_vector` [#69941](https://github.com/rust-lang/rust/issues/69941))
Determines if this `Read`er has an efficient `read_vectored` implementation. [Read more](trait.read#method.is_read_vectored)
[source](https://doc.rust-lang.org/src/std/io/buffered/bufreader.rs.html#328-334)#### fn read\_to\_end(&mut self, buf: &mut Vec<u8>) -> Result<usize>
Read all bytes until EOF in this source, placing them into `buf`. [Read more](trait.read#method.read_to_end)
[source](https://doc.rust-lang.org/src/std/io/buffered/bufreader.rs.html#338-370)#### fn read\_to\_string(&mut self, buf: &mut String) -> Result<usize>
Read all bytes until EOF in this source, appending them to `buf`. [Read more](trait.read#method.read_to_string)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#824-839)#### fn read\_buf\_exact(&mut self, cursor: BorrowedCursor<'\_>) -> Result<()>
🔬This is a nightly-only experimental API. (`read_buf` [#78485](https://github.com/rust-lang/rust/issues/78485))
Read the exact number of bytes required to fill `cursor`. [Read more](trait.read#method.read_buf_exact)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#876-881)#### fn by\_ref(&mut self) -> &mut Selfwhere Self: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Creates a “by reference” adaptor for this instance of `Read`. [Read more](trait.read#method.by_ref)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#919-924)#### fn bytes(self) -> Bytes<Self>where Self: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Notable traits for [Bytes](struct.bytes "struct std::io::Bytes")<R>
```
impl<R: Read> Iterator for Bytes<R>
type Item = Result<u8>;
```
Transforms this `Read` instance to an [`Iterator`](../iter/trait.iterator "Iterator") over its bytes. [Read more](trait.read#method.bytes)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#957-962)#### fn chain<R: Read>(self, next: R) -> Chain<Self, R>where Self: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Notable traits for [Chain](struct.chain "struct std::io::Chain")<T, U>
```
impl<T: Read, U: Read> Read for Chain<T, U>
```
Creates an adapter which will chain this stream with another. [Read more](trait.read#method.chain)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#996-1001)#### fn take(self, limit: u64) -> Take<Self>where Self: [Sized](../marker/trait.sized "trait std::marker::Sized"),
Notable traits for [Take](struct.take "struct std::io::Take")<T>
```
impl<T: Read> Read for Take<T>
```
Creates an adapter which will read at most `limit` bytes from it. [Read more](trait.read#method.take)
[source](https://doc.rust-lang.org/src/std/io/buffered/bufreader.rs.html#401-492)### impl<R: Seek> Seek for BufReader<R>
[source](https://doc.rust-lang.org/src/std/io/buffered/bufreader.rs.html#424-447)#### fn seek(&mut self, pos: SeekFrom) -> Result<u64>
Seek to an offset, in bytes, in the underlying reader.
The position used for seeking with `[SeekFrom::Current](enum.seekfrom#variant.Current "SeekFrom::Current")(_)` is the position the underlying reader would be at if the `BufReader<R>` had no internal buffer.
Seeking always discards the internal buffer, even if the seek position would otherwise fall within it. This guarantees that calling [`BufReader::into_inner()`](struct.bufreader#method.into_inner "BufReader::into_inner()") immediately after a seek yields the underlying reader at the same position.
To seek without discarding the internal buffer, use [`BufReader::seek_relative`](struct.bufreader#method.seek_relative "BufReader::seek_relative").
See [`std::io::Seek`](trait.seek) for more details.
Note: In the edge case where you’re seeking with `[SeekFrom::Current](enum.seekfrom#variant.Current "SeekFrom::Current")(n)` where `n` minus the internal buffer length overflows an `i64`, two seeks will be performed instead of one. If the second seek returns [`Err`](../result/enum.result#variant.Err "Err"), the underlying reader will be left at the same position it would have if you called `seek` with `[SeekFrom::Current](enum.seekfrom#variant.Current "SeekFrom::Current")(0)`.
[source](https://doc.rust-lang.org/src/std/io/buffered/bufreader.rs.html#484-491)#### fn stream\_position(&mut self) -> Result<u64>
Returns the current seek position from the start of the stream.
The value returned is equivalent to `self.seek(SeekFrom::Current(0))` but does not flush the internal buffer. Due to this optimization the function does not guarantee that calling `.into_inner()` immediately afterwards will yield the underlying reader at the same position. Use [`BufReader::seek`](struct.bufreader#method.seek "BufReader::seek") instead if you require that guarantee.
##### Panics
This function will panic if the position of the inner reader is smaller than the amount of buffered data. That can happen if the inner reader has an incorrect implementation of [`Seek::stream_position`](trait.seek#method.stream_position "Seek::stream_position"), or if the position has gone out of sync due to calling [`Seek::seek`](trait.seek#tymethod.seek "Seek::seek") directly on the underlying reader.
##### Example
```
use std::{
io::{self, BufRead, BufReader, Seek},
fs::File,
};
fn main() -> io::Result<()> {
let mut f = BufReader::new(File::open("foo.txt")?);
let before = f.stream_position()?;
f.read_line(&mut String::new())?;
let after = f.stream_position()?;
println!("The first line was {} bytes long", after - before);
Ok(())
}
```
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1796-1799)1.55.0 · #### fn rewind(&mut self) -> Result<()>
Rewind to the beginning of a stream. [Read more](trait.seek#method.rewind)
[source](https://doc.rust-lang.org/src/std/io/mod.rs.html#1836-1847)#### fn stream\_len(&mut self) -> Result<u64>
🔬This is a nightly-only experimental API. (`seek_stream_len` [#59359](https://github.com/rust-lang/rust/issues/59359))
Returns the length of this stream (in bytes). [Read more](trait.seek#method.stream_len)
Auto Trait Implementations
--------------------------
### impl<R> RefUnwindSafe for BufReader<R>where R: [RefUnwindSafe](../panic/trait.refunwindsafe "trait std::panic::RefUnwindSafe"),
### impl<R> Send for BufReader<R>where R: [Send](../marker/trait.send "trait std::marker::Send"),
### impl<R> Sync for BufReader<R>where R: [Sync](../marker/trait.sync "trait std::marker::Sync"),
### impl<R> Unpin for BufReader<R>where R: [Unpin](../marker/trait.unpin "trait std::marker::Unpin"),
### impl<R> UnwindSafe for BufReader<R>where R: [UnwindSafe](../panic/trait.unwindsafe "trait std::panic::UnwindSafe"),
Blanket Implementations
-----------------------
[source](https://doc.rust-lang.org/src/core/any.rs.html#200)### impl<T> Any for Twhere T: 'static + ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/any.rs.html#201)#### fn type\_id(&self) -> TypeId
Gets the `TypeId` of `self`. [Read more](../any/trait.any#tymethod.type_id)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#209)### impl<T> Borrow<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#211)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow(&self) -> &T
Immutably borrows from an owned value. [Read more](../borrow/trait.borrow#tymethod.borrow)
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#218)### impl<T> BorrowMut<T> for Twhere T: ?[Sized](../marker/trait.sized "trait std::marker::Sized"),
[source](https://doc.rust-lang.org/src/core/borrow.rs.html#219)const: [unstable](https://github.com/rust-lang/rust/issues/91522 "Tracking issue for const_borrow") · #### fn borrow\_mut(&mut self) -> &mut T
Mutably borrows from an owned value. [Read more](../borrow/trait.borrowmut#tymethod.borrow_mut)
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#559)### impl<T> From<T> for T
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#562)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn from(t: T) -> T
Returns the argument unchanged.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#543)### impl<T, U> Into<U> for Twhere U: [From](../convert/trait.from "trait std::convert::From")<T>,
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#551)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn into(self) -> U
Calls `U::from(self)`.
That is, this conversion is whatever the implementation of `[From](../convert/trait.from "From")<T> for U` chooses to do.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#601)### impl<T, U> TryFrom<U> for Twhere U: [Into](../convert/trait.into "trait std::convert::Into")<T>,
#### type Error = Infallible
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#607)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#586)### impl<T, U> TryInto<U> for Twhere U: [TryFrom](../convert/trait.tryfrom "trait std::convert::TryFrom")<T>,
#### type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
[source](https://doc.rust-lang.org/src/core/convert/mod.rs.html#592)const: [unstable](https://github.com/rust-lang/rust/issues/88674 "Tracking issue for const_convert") · #### fn try\_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
| programming_docs |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.