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

Code Example 1

let mut vec = Vec::new();

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]);

Code Example 3

let mut vec = vec![10];
vec.push(100);
assert_eq!(vec[1], 100);

Learn ReactJs, React Native from akashmittal.com