Add example to array::IntoIter::new’s doc-comment
Co-authored-by: Ashley Mannix <kodraus@hey.com>
This commit is contained in:
parent
61c49d4042
commit
83d32b0a27
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user