blob: acd4416cb884430064c88e6b50f69f7915585e5e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
|
use std::iter::FromIterator;
pub fn times<A: Copy, B: FromIterator<A>>(elem: A, n: u16) -> B {
(0..n).map(|_| elem).collect()
}
pub fn clone_times<A: Clone, B: FromIterator<A>>(elem: A, n: u16) -> B {
(0..n).map(|_| elem.clone()).collect()
}
|