@@ -505,13 +505,14 @@ pub trait Itertools: Iterator {
505505 intersperse:: intersperse_with ( self , element)
506506 }
507507
508- /// Returns an element at a specific location, or returns an iterator
509- /// over a subsection of the iterator.
508+ /// Returns an iterator over a subsection of the iterator.
510509 ///
511510 /// Works similarly to [`slice::get`](https://doc.rust-lang.org/std/primitive.slice.html#method.get).
512511 ///
513- /// It's a generalisation of [`take`], [`skip`] and [`nth`], and uses these
514- /// under the hood.
512+ /// It's a generalisation of [`Iterator::take`] and [`Iterator::skip`],
513+ /// and uses these under the hood.
514+ /// Therefore, the resulting iterator is [`DoubleEndedIterator`]
515+ /// and/or [`ExactSizeIterator`] if the adapted iterator is.
515516 ///
516517 /// # Unspecified Behavior
517518 /// The result of indexing with an exhausted [`core::ops::RangeInclusive`] is unspecified.
@@ -524,7 +525,7 @@ pub trait Itertools: Iterator {
524525 /// let vec = vec![3, 1, 4, 1, 5];
525526 ///
526527 /// let mut range: Vec<_> =
527- /// vec.iter().get(1..=3).copied().collect();
528+ /// vec.iter().get(1..=3).copied().collect();
528529 /// assert_eq!(&range, &[1, 4, 1]);
529530 ///
530531 /// // It works with other types of ranges, too
@@ -537,13 +538,12 @@ pub trait Itertools: Iterator {
537538 /// range = vec.iter().get(2..).copied().collect();
538539 /// assert_eq!(&range, &[4, 1, 5]);
539540 ///
541+ /// range = vec.iter().get(..=2).copied().collect();
542+ /// assert_eq!(&range, &[3, 1, 4]);
543+ ///
540544 /// range = vec.iter().get(..).copied().collect();
541545 /// assert_eq!(range, vec);
542546 /// ```
543- ///
544- /// [`take`]: https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.take
545- /// [`skip`]: https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.skip
546- /// [`nth`]: https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.nth
547547 fn get < R > ( self , index : R ) -> R :: Output
548548 where
549549 Self : Sized ,
0 commit comments