@@ -2797,6 +2797,13 @@ where
27972797///
27982798/// This `struct` is created by the `into_iter` method on [`Vec`] (provided
27992799/// by the [`IntoIterator`] trait).
2800+ ///
2801+ /// # Example
2802+ ///
2803+ /// ```
2804+ /// let v = vec![0, 1, 2];
2805+ /// let iter: std::vec::IntoIter<_> = v.into_iter();
2806+ /// ```
28002807#[ stable( feature = "rust1" , since = "1.0.0" ) ]
28012808pub struct IntoIter < T > {
28022809 buf : NonNull < T > ,
@@ -3040,6 +3047,13 @@ impl<T> AsIntoIter for IntoIter<T> {
30403047///
30413048/// This `struct` is created by [`Vec::drain`].
30423049/// See its documentation for more.
3050+ ///
3051+ /// # Example
3052+ ///
3053+ /// ```
3054+ /// let mut v = vec![0, 1, 2];
3055+ /// let iter: std::vec::Drain<_> = v.drain(..);
3056+ /// ```
30433057#[ stable( feature = "drain" , since = "1.6.0" ) ]
30443058pub struct Drain < ' a , T : ' a > {
30453059 /// Index of tail to preserve
@@ -3169,6 +3183,14 @@ impl<T> FusedIterator for Drain<'_, T> {}
31693183///
31703184/// This struct is created by [`Vec::splice()`].
31713185/// See its documentation for more.
3186+ ///
3187+ /// # Example
3188+ ///
3189+ /// ```
3190+ /// let mut v = vec![0, 1, 2];
3191+ /// let new = [7, 8];
3192+ /// let iter: std::vec::Splice<_> = v.splice(1.., new.iter().cloned());
3193+ /// ```
31723194#[ derive( Debug ) ]
31733195#[ stable( feature = "vec_splice" , since = "1.21.0" ) ]
31743196pub struct Splice < ' a , I : Iterator + ' a > {
@@ -3285,6 +3307,15 @@ impl<T> Drain<'_, T> {
32853307///
32863308/// This struct is created by [`Vec::drain_filter`].
32873309/// See its documentation for more.
3310+ ///
3311+ /// # Example
3312+ ///
3313+ /// ```
3314+ /// #![feature(drain_filter)]
3315+ ///
3316+ /// let mut v = vec![0, 1, 2];
3317+ /// let iter: std::vec::DrainFilter<_, _> = v.drain_filter(|x| *x % 2 == 0);
3318+ /// ```
32883319#[ unstable( feature = "drain_filter" , reason = "recently added" , issue = "43244" ) ]
32893320#[ derive( Debug ) ]
32903321pub struct DrainFilter < ' a , T , F >
0 commit comments