diff options
| author | Simon Sapin <simon.sapin@exyr.org> | 2021-01-21 15:52:53 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-21 15:52:53 +0100 |
| commit | 83d32b0a27350fd640cb29d0514598e4630874bb (patch) | |
| tree | d78f70681a0b88aa9b4f2cdb405868ad028090ae | |
| parent | 61c49d4042af6d392784925cc53afdc830740cd4 (diff) | |
| download | rust-83d32b0a27350fd640cb29d0514598e4630874bb.tar.gz rust-83d32b0a27350fd640cb29d0514598e4630874bb.zip | |
Add example to array::IntoIter::new’s doc-comment
Co-authored-by: Ashley Mannix <kodraus@hey.com>
| -rw-r--r-- | library/core/src/array/iter.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/library/core/src/array/iter.rs b/library/core/src/array/iter.rs index 0fd8815570b..535291471b1 100644 --- a/library/core/src/array/iter.rs +++ b/library/core/src/array/iter.rs @@ -41,6 +41,16 @@ impl<T, const N: usize> IntoIter<T, N> { /// *Note*: this method might be deprecated in the future, /// after [`IntoIterator` is implemented for arrays][array-into-iter]. /// + /// # Examples + /// + /// ``` + /// use std::array; + /// + /// for value in array::IntoIter::new([1, 2, 3, 4, 5]) { + /// // The type of `value` is a `i32` here, instead of `&i32` + /// let _: i32 = value; + /// } + /// ``` /// [array-into-iter]: https://github.com/rust-lang/rust/pull/65819 #[stable(feature = "array_value_iter", since = "1.51.0")] pub fn new(array: [T; N]) -> Self { |
