Check out example codes for "rust push to vec". It will help you in understanding the concepts better.

Code Example 1

let a = vec![1, 2, 3];
assert_eq!(a.len(), 3);

Code Example 2

let mut vec = Vec::new();
vec.push(1);
vec.push(2);

assert_eq!(vec.len(), 2);
assert_eq!(vec[0], 1);

assert_eq!(vec.pop(), Some(2));
assert_eq!(vec.len(), 1);

vec[0] = 7;
assert_eq!(vec[0], 7);

vec.extend([1, 2, 3].iter().copied());

for x in &vec {
    println!("{}", x);
}
assert_eq!(vec, [7, 1, 2, 3]);

Learn ReactJs, React Native from akashmittal.com