Skip to content

Commit 83d32b0

Browse files
SimonSapinKodrAus
andauthored
Add example to array::IntoIter::new’s doc-comment
Co-authored-by: Ashley Mannix <[email protected]>
1 parent 61c49d4 commit 83d32b0

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

library/core/src/array/iter.rs

+10
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,16 @@ impl<T, const N: usize> IntoIter<T, N> {
4141
/// *Note*: this method might be deprecated in the future,
4242
/// after [`IntoIterator` is implemented for arrays][array-into-iter].
4343
///
44+
/// # Examples
45+
///
46+
/// ```
47+
/// use std::array;
48+
///
49+
/// for value in array::IntoIter::new([1, 2, 3, 4, 5]) {
50+
/// // The type of `value` is a `i32` here, instead of `&i32`
51+
/// let _: i32 = value;
52+
/// }
53+
/// ```
4454
/// [array-into-iter]: https://github.com/rust-lang/rust/pull/65819
4555
#[stable(feature = "array_value_iter", since = "1.51.0")]
4656
pub fn new(array: [T; N]) -> Self {

0 commit comments

Comments
 (0)