@@ -2849,6 +2849,13 @@ where
2849
2849
///
2850
2850
/// This `struct` is created by the `into_iter` method on [`Vec`] (provided
2851
2851
/// by the [`IntoIterator`] trait).
2852
+ ///
2853
+ /// # Example
2854
+ ///
2855
+ /// ```
2856
+ /// let v = vec![0, 1, 2];
2857
+ /// let iter: std::vec::IntoIter<_> = v.into_iter();
2858
+ /// ```
2852
2859
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
2853
2860
pub struct IntoIter < T > {
2854
2861
buf : NonNull < T > ,
@@ -3092,6 +3099,13 @@ impl<T> AsIntoIter for IntoIter<T> {
3092
3099
///
3093
3100
/// This `struct` is created by [`Vec::drain`].
3094
3101
/// See its documentation for more.
3102
+ ///
3103
+ /// # Example
3104
+ ///
3105
+ /// ```
3106
+ /// let mut v = vec![0, 1, 2];
3107
+ /// let iter: std::vec::Drain<_> = v.drain(..);
3108
+ /// ```
3095
3109
#[ stable( feature = "drain" , since = "1.6.0" ) ]
3096
3110
pub struct Drain < ' a , T : ' a > {
3097
3111
/// Index of tail to preserve
@@ -3221,6 +3235,14 @@ impl<T> FusedIterator for Drain<'_, T> {}
3221
3235
///
3222
3236
/// This struct is created by [`Vec::splice()`].
3223
3237
/// See its documentation for more.
3238
+ ///
3239
+ /// # Example
3240
+ ///
3241
+ /// ```
3242
+ /// let mut v = vec![0, 1, 2];
3243
+ /// let new = [7, 8];
3244
+ /// let iter: std::vec::Splice<_> = v.splice(1.., new.iter().cloned());
3245
+ /// ```
3224
3246
#[ derive( Debug ) ]
3225
3247
#[ stable( feature = "vec_splice" , since = "1.21.0" ) ]
3226
3248
pub struct Splice < ' a , I : Iterator + ' a > {
@@ -3337,6 +3359,15 @@ impl<T> Drain<'_, T> {
3337
3359
///
3338
3360
/// This struct is created by [`Vec::drain_filter`].
3339
3361
/// See its documentation for more.
3362
+ ///
3363
+ /// # Example
3364
+ ///
3365
+ /// ```
3366
+ /// #![feature(drain_filter)]
3367
+ ///
3368
+ /// let mut v = vec![0, 1, 2];
3369
+ /// let iter: std::vec::DrainFilter<_, _> = v.drain_filter(|x| *x % 2 == 0);
3370
+ /// ```
3340
3371
#[ unstable( feature = "drain_filter" , reason = "recently added" , issue = "43244" ) ]
3341
3372
#[ derive( Debug ) ]
3342
3373
pub struct DrainFilter < ' a , T , F >
0 commit comments