diff options
| author | Ivan Tham <pickfire@riseup.net> | 2020-10-02 00:45:19 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-10-02 00:45:19 +0800 |
| commit | 676e4f193ce3842d55fd0406cfc957c1a617f317 (patch) | |
| tree | 86e96d25b4c4abb3ec2cf0b22b3be3f8fb94de04 | |
| parent | 782013564efc06ef02614ba35a4e67dee4fcb8e7 (diff) | |
| download | rust-676e4f193ce3842d55fd0406cfc957c1a617f317.tar.gz rust-676e4f193ce3842d55fd0406cfc957c1a617f317.zip | |
Add example for iter chain struct
| -rw-r--r-- | library/core/src/iter/adapters/chain.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/library/core/src/iter/adapters/chain.rs b/library/core/src/iter/adapters/chain.rs index 13c6a75d58b..658dae3825a 100644 --- a/library/core/src/iter/adapters/chain.rs +++ b/library/core/src/iter/adapters/chain.rs @@ -6,6 +6,17 @@ use crate::usize; /// /// This `struct` is created by [`Iterator::chain`]. See its documentation /// for more. +/// +/// # Examples +/// +/// ``` +/// use std::iter::Chain; +/// use std::slice::Iter; +/// +/// let a1 = [1, 2, 3]; +/// let a2 = [4, 5, 6]; +/// let iter: Chain<Iter<_>, Iter<_>> = a1.iter().chain(a2.iter()); +/// ``` #[derive(Clone, Debug)] #[must_use = "iterators are lazy and do nothing unless consumed"] #[stable(feature = "rust1", since = "1.0.0")] |
