'from' and 'to' are problematic with references, try to avoid :-/

I would actually say "reference to s1" here, but I think this is trying
to say "create a reference out of s1" but that sounds like you don't
have s1 anymore since you turned it into something else and urgh am I
overthinking this?
This commit is contained in:
Carol (Nichols || Goulding) 2016-07-14 18:23:39 -04:00
parent 23d4435073
commit c2c744b4a5

View File

@ -62,8 +62,8 @@ let s1 = String::from("hello");
let len = calculate_length(&s1);
```
The `&s1` syntax lets us create a reference from `s1`. This reference _refers_
to the value of `s1`, but does not own it. Because it does not own it, the
The `&s1` syntax lets us create a reference with `s1`. This reference _refers_
to the value of `s1` but does not own it. Because it does not own it, the
value it points to will not be dropped when the reference goes out of scope.
Likewise, the signature of the function uses `&` to indicate that it takes