X-Git-Url: https://git.ralfj.de/rust-101.git/blobdiff_plain/832768ac8f69b436c1f90ad7a2f01af25091599a..b89eed2cb450e67dd00102d1018adbb9a0cb1cae:/src/part05.rs diff --git a/src/part05.rs b/src/part05.rs index 6780ca3..a0eb1d1 100644 --- a/src/part05.rs +++ b/src/part05.rs @@ -62,8 +62,8 @@ impl BigInt { } // ## Cloning -//@ If you have a close look at the type of `BigInt::from_vec`, you will notice that it -//@ consumes the vector `v`. The caller hence loses access to its vector. There is however something +//@ If you take a close look at the type of `BigInt::from_vec`, you will notice that it +//@ consumes the vector `v`. The caller hence loses access to its vector. However, there is something //@ we can do if we don't want that to happen: We can explicitly `clone` the vector, //@ which means that a full (or *deep*) copy will be performed. Technically, //@ `clone` takes a borrowed vector, and returns a fully owned one. @@ -99,7 +99,7 @@ impl Clone for SomethingOrNothing { match *self { /*@*/ Nothing => Nothing, /*@*/ //@ In the second arm of the match, we need to talk about the value `v` - //@ that's stored in `self`. However, if we would write the pattern as + //@ that's stored in `self`. However, if we were to write the pattern as //@ `Something(v)`, that would indicate that we *own* `v` in the code //@ after the arrow. That can't work though, we have to leave `v` owned by //@ whoever called us - after all, we don't even own `self`, we just borrowed it.