X-Git-Url: https://git.ralfj.de/rust-101.git/blobdiff_plain/6b347ac8c0f8710bd0ca42d20d32511fcb53f188..c2e9145b487a8bd3d31c5a6f318c86aaf3f9d17d:/src/part13.rs diff --git a/src/part13.rs b/src/part13.rs index 861ec2d..4fbc908 100644 --- a/src/part13.rs +++ b/src/part13.rs @@ -159,8 +159,8 @@ pub fn main() { //@ programs memory safe, and that prevents us from invalidating iterators, also helps secure our multi-threaded code against //@ data races. For example, notice how `read_files` sends a `String` to `filter_lines`. At run-time, only the pointer to //@ the character data will actually be moved around (just like when a `String` is passed to a function with full ownership). However, -//@ `read_files` has to *give up* ownership of the string to perform `send`, to it is impossible for an outstanding borrow to -//@ still be around. After it sent the string to the other side, `read_files` has no pointer into the string content +//@ `read_files` has to *give up* ownership of the string to perform `send`, to it is impossible for the string to still be borrowed. +//@ After it sent the string to the other side, `read_files` has no pointer into the string content //@ anymore, and hence no way to race on the data with someone else. //@ //@ There is a little more to this. Remember the `'static` bound we had to add to `register` in the previous parts, to make @@ -189,4 +189,4 @@ pub fn main() { //@ So if the environment of your closure contains an `Rc`, it won't be `Send`, preventing it from causing trouble. If however every //@ captured variable *is* `Send`, then so is the entire environment, and you are good. -//@ [index](main.html) | [previous](part12.html) | [next](part14.html) +//@ [index](main.html) | [previous](part12.html) | [raw source](https://www.ralfj.de/git/rust-101.git/blob_plain/HEAD:/workspace/src/part13.rs) | [next](part14.html)