summaryrefslogtreecommitdiff
path: root/rust/chap4/vecs.rs
diff options
context:
space:
mode:
authorCarlos Maiolino <[email protected]>2025-09-06 09:30:14 +0200
committerCarlos Maiolino <[email protected]>2025-09-06 09:30:14 +0200
commit93b1c04a218858ecc59b6b8929103695b7b8c2a0 (patch)
tree7ae24ff4b2ef06c8d961f2c908ba8511e1fc995b /rust/chap4/vecs.rs
parent973e27b243ea7f12b6743894465c67a4a6a87eb2 (diff)
Move rust playground here
Signed-off-by: Carlos Maiolino <[email protected]>
Diffstat (limited to 'rust/chap4/vecs.rs')
-rw-r--r--rust/chap4/vecs.rs11
1 files changed, 11 insertions, 0 deletions
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<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);
+}