How to get the length of vector in Rust?
In Rust vectors has a built in function that retrieve the length of vectors, the function islen()
.Example of how to get the length of vector
fn main() {
let a = vec![1, 2, 3];
println!("Vector a length is = {} ", a.len());
}
Output
Vector a length is = 3