summaryrefslogtreecommitdiff
path: root/rust/chap4/vecs.rs
blob: b0a76be98bf3fc9bf2941c1e595c7fa928a1d27b (plain)
1
2
3
4
5
6
7
8
9
10
11
fn main() {
    let mut v: Vec<i32> = vec![1, 2, 3];

    /* Push an item calling method direct from Vec definition */
    Vec::push(&mut v, 4);

    /* Push an item calling the method via its object */
    v.push(5);

    println!("{:?}", v);
}