How it works...
Since this recipe actually failed to build and pointed to an error message in the last step, what happened? We learned about Send and Sync. These marker traits and the types of errors will cross your path in the most surprising and critical situations. Since they work seamlessly when they are present, we had to create a failing example to show you what magic they do and how.
In Rust, marker traits (https://doc.rust-lang.org/std/marker/index.html) signal something to the compiler. In the case of concurrency, it's the ability to be shared across threads. The Sync (shared access from multiple threads) and Send (ownership can transfer safely from one thread to another) traits are implemented for almost all default data structures, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access