@@ -2797,6 +2797,13 @@ where
2797
2797
///
2798
2798
/// This `struct` is created by the `into_iter` method on [`Vec`] (provided
2799
2799
/// 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
+ /// ```
2800
2807
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
2801
2808
pub struct IntoIter < T > {
2802
2809
buf : NonNull < T > ,
@@ -3040,6 +3047,13 @@ impl<T> AsIntoIter for IntoIter<T> {
3040
3047
///
3041
3048
/// This `struct` is created by [`Vec::drain`].
3042
3049
/// 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
+ /// ```
3043
3057
#[ stable( feature = "drain" , since = "1.6.0" ) ]
3044
3058
pub struct Drain < ' a , T : ' a > {
3045
3059
/// Index of tail to preserve
@@ -3169,6 +3183,14 @@ impl<T> FusedIterator for Drain<'_, T> {}
3169
3183
///
3170
3184
/// This struct is created by [`Vec::splice()`].
3171
3185
/// 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
+ /// ```
3172
3194
#[ derive( Debug ) ]
3173
3195
#[ stable( feature = "vec_splice" , since = "1.21.0" ) ]
3174
3196
pub struct Splice < ' a , I : Iterator + ' a > {
@@ -3285,6 +3307,15 @@ impl<T> Drain<'_, T> {
3285
3307
///
3286
3308
/// This struct is created by [`Vec::drain_filter`].
3287
3309
/// 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
+ /// ```
3288
3319
#[ unstable( feature = "drain_filter" , reason = "recently added" , issue = "43244" ) ]
3289
3320
#[ derive( Debug ) ]
3290
3321
pub struct DrainFilter < ' a , T , F >
0 commit comments