O'Reilly logo

Mastering Rust by Vesa Kaihlavirta

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 7 - Concurrency

Concurrency means having more than one thing to do. Parallelism means those things being done at the same time. Concurrency comes with a plethora of potential problems, which are difficult to detect and fix. Rust protects against data races by the resource system, and helps with other concurrency problems by good concurrency primitives.

Closures are blocks that close over their surrounding environment. That means that variables are declared outside the block but used inside the block are captured inside the closure. Closure syntax allows differentiating between borrow and move semantics in these captures. Borrowing is the default, and its meaning is identical to before: variables are borrowed by the closure and then ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required