X-Git-Url: https://git.ralfj.de/rust-101.git/blobdiff_plain/3a94cd0261c4cd5c348eb1c1359106b76f01e518..ab7f9b241429bd675b437d2437799de75d2f409b:/src/part05.rs?ds=sidebyside diff --git a/src/part05.rs b/src/part05.rs index 784440c..eaad980 100644 --- a/src/part05.rs +++ b/src/part05.rs @@ -124,7 +124,7 @@ enum Variant { Text(String), } //@ Now consider the following piece of code. Like above, `n` will be a reference to a part of `var`, -//@ and since we wrote `ref mut`, the reference will be uniqie and mutable. In other words, right after the match, `ptr` +//@ and since we wrote `ref mut`, the reference will be unique and mutable. In other words, right after the match, `ptr` //@ points to the number that's stored in `var`, where `var` is a `Number`. Remember that `_` means //@ "we don't care". fn work_on_variant(mut var: Variant, text: String) { @@ -147,4 +147,4 @@ fn work_on_variant(mut var: Variant, text: String) { //@ I hope this example clarifies why Rust has to rule out mutation in the presence of aliasing *in general*, //@ not just for the specific case of a buffer being reallocated, and old pointers becoming hence invalid. -//@ [index](main.html) | [previous](part04.html) | [raw source](https://www.ralfj.de/git/rust-101.git/blob_plain/HEAD:/workspace/src/part05.rs) | [next](part06.html) +//@ [index](main.html) | [previous](part04.html) | [raw source](workspace/src/part05.rs) | [next](part06.html)