projects
/
rust-101.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
small spelling/grammar errors
[rust-101.git]
/
workspace
/
src
/
part06.rs
diff --git
a/workspace/src/part06.rs
b/workspace/src/part06.rs
index 8b69022bfa3792ffefebbe1ff9bb37d5bf5edbf9..04a08478f87d428dc75fadc6c1111b9fabce8356 100644
(file)
--- a/
workspace/src/part06.rs
+++ b/
workspace/src/part06.rs
@@
-1,5
+1,3
@@
-// ***Remember to enable/add this part in `main.rs`!***
-
// Rust-101, Part 06: Copy, Lifetimes
// ==================================
// Rust-101, Part 06: Copy, Lifetimes
// ==================================
@@
-24,11
+22,12
@@
impl BigInt {
}
}
}
}
-// Now we can write `vec_min`. However, in order to make it type-check, we have to make a full (deep) copy of e
-// by calling `clone()`.
+// Now we can write `vec_min`.
fn vec_min(v: &Vec<BigInt>) -> Option<BigInt> {
let mut min: Option<BigInt> = None;
fn vec_min(v: &Vec<BigInt>) -> Option<BigInt> {
let mut min: Option<BigInt> = None;
+ // If `v` is a shared borrowed vector, then the default for iterating over it is to call `iter`, the iterator that borrows the elements.
for e in v {
for e in v {
+ let e = e.clone();
unimplemented!()
}
min
unimplemented!()
}
min