Feature gate: #![feature(vec_from_fn)]
This is a tracking issue for the Vec::from_fn method.
Public API
impl<T> Vec<T> { pub fn from_fn<F>(length: usize, f: F) -> Self where F: FnMut(usize) -> T, { (0..length).map(f).collect() } }
Steps / History
(Remember to update the S-tracking-* label when checking boxes.)
- ACP: Support
vec![const { ... }; n]syntax for creating aVecof non-Clonevalues libs-team#484 (comment) - Implementation: Implement
Vec::from_fn#149699 - Final comment period (FCP)1
- Stabilization PR
Unresolved Questions
- None yet.