diff options
| author | kadmin <julianknodt@gmail.com> | 2020-08-07 06:00:52 +0000 |
|---|---|---|
| committer | kadmin <julianknodt@gmail.com> | 2020-08-13 03:51:01 +0000 |
| commit | 54b821ebc0a2f3fa0587ab42df16c99ee4bf6787 (patch) | |
| tree | 753a4750e0bed82adee3030b9d54aadaecd1eb0f /library/core/src/array | |
| parent | 56a651ca15ac2d3f74259b8df8ac07bd80dbeaf8 (diff) | |
| download | rust-54b821ebc0a2f3fa0587ab42df16c99ee4bf6787.tar.gz rust-54b821ebc0a2f3fa0587ab42df16c99ee4bf6787.zip | |
Add tracking issue #75243
Add note & example about iter order Add doc changes Update doc comments
Diffstat (limited to 'library/core/src/array')
| -rw-r--r-- | library/core/src/array/mod.rs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/library/core/src/array/mod.rs b/library/core/src/array/mod.rs index 16baef137cb..01bf9d5ef1e 100644 --- a/library/core/src/array/mod.rs +++ b/library/core/src/array/mod.rs @@ -368,16 +368,23 @@ array_impl_default! {32, T T T T T T T T T T T T T T T T T T T T T T T T T T T T #[cfg(not(bootstrap))] #[lang = "array"] impl<T, const N: usize> [T; N] { - /// Returns an array of the same size as self, with `f` applied to each element. + /// Returns an array of the same size as `self`, with function `f` applied to each element. + /// The closure will be called on elements 0 up to but excluding N. /// /// # Examples + /// /// ``` /// # #![feature(array_map)] /// let x = [1, 2, 3]; /// let y = x.map(|v| v + 1); /// assert_eq!(y, [2, 3, 4]); + /// + /// let x = [1, 2, 3]; + /// let mut temp = 0; + /// let y = x.map(|v| { temp += 1; v * temp }); + /// assert_eq!(y, [1, 4, 9]); /// ``` - #[unstable(feature = "array_map", issue = "77777")] + #[unstable(feature = "array_map", issue = "75243")] pub fn map<F, U>(self, mut f: F) -> [U; N] where F: FnMut(T) -> U, |
