From 93b1c04a218858ecc59b6b8929103695b7b8c2a0 Mon Sep 17 00:00:00 2001 From: Carlos Maiolino Date: Sat, 6 Sep 2025 09:30:14 +0200 Subject: Move rust playground here Signed-off-by: Carlos Maiolino --- rust/chap4/vecs.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 rust/chap4/vecs.rs (limited to 'rust/chap4/vecs.rs') diff --git a/rust/chap4/vecs.rs b/rust/chap4/vecs.rs new file mode 100644 index 0000000..b0a76be --- /dev/null +++ b/rust/chap4/vecs.rs @@ -0,0 +1,11 @@ +fn main() { + let mut v: Vec = 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); +} -- cgit v1.2.3