projects
/
rust-101.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Start writing a part on closures
[rust-101.git]
/
workspace
/
src
/
part04.rs
diff --git
a/workspace/src/part04.rs
b/workspace/src/part04.rs
index 4f2174ad8e5a9cf2c8dd8871189c00fc13e17366..c7969ac34c949ae50175f6887fb6c3802a601b8a 100644
(file)
--- a/
workspace/src/part04.rs
+++ b/
workspace/src/part04.rs
@@
-14,7
+14,7
@@
fn work_on_vector(v: Vec<i32>) { /* do something */ }
fn ownership_demo() {
let v = vec![1,2,3,4];
work_on_vector(v);
fn ownership_demo() {
let v = vec![1,2,3,4];
work_on_vector(v);
- /* println!("The first element is: {}", v[0]); */
+ /* println!("The first element is: {}", v[0]); */
/* BAD! */
}
// ## Shared borrowing
}
// ## Shared borrowing
@@
-55,7
+55,7
@@
fn mutable_borrow_demo() {
/* let first = &v[0]; */
vec_inc(&mut v);
vec_inc(&mut v);
/* let first = &v[0]; */
vec_inc(&mut v);
vec_inc(&mut v);
- /* println!("The first element is: {}", *first); */
+ /* println!("The first element is: {}", *first); */
/* BAD! */
}
// ## Summary
}
// ## Summary