prop ownership

This commit is contained in:
2023-07-02 17:04:33 +02:00
parent 4507728150
commit e442e0e89f
3 changed files with 18 additions and 0 deletions

View File

@@ -31,3 +31,4 @@
- https://tinchicus.com/2022/07/15/rust-tuple-struct/ (nuevotipo)
- https://tinchicus.com/2022/07/18/rust-enum/ (enums)
- https://tinchicus.com/2022/07/19/rust-patrones-y-coincidencias/ (iflet)
- https://tinchicus.com/2022/07/20/rust-ownership/ (prop)

8
prop/Cargo.toml Normal file
View File

@@ -0,0 +1,8 @@
[package]
name = "prop"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

9
prop/src/main.rs Normal file
View File

@@ -0,0 +1,9 @@
fn vec_transfer(v: Vec<i32>) {
println!("v[0] en la función = {}", v[0]);
}
fn main() {
let mivec = vec![1i32,2i32,3i32];
vec vec_transfer(mivec);
println!("mivec[0] es = {}", mivec[0]);
}