Skip to content

Commit

Permalink
Add example to array::IntoIter::new’s doc-comment
Browse files Browse the repository at this point in the history
Co-authored-by: Ashley Mannix <kodraus@hey.com>
  • Loading branch information
SimonSapin and KodrAus committed Jan 21, 2021
1 parent 61c49d4 commit 83d32b0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions library/core/src/array/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 83d32b0

Please sign in to comment.