Range::to_vec
pub fn to_vec() -> Vec<T>
Source: compiler/src/builtin_docs/prelude.hy Collects the range into a new Vec<T>.
Only numeric ranges (int, byte, float) can be collected; other
element types are a compile-time error.
Called on a Range value as value.to_vec(…).
Returns#
Vec<T>
Examples#
use tests::assert;
let v = (2..5).to_vec();
assert!(v.len() == 3);
assert!(v[0] == 2);
assert!((5..2).to_vec().len() == 0);