From d079949139b9d4d5280a08143edc1d717d5c5b52 Mon Sep 17 00:00:00 2001 From: Emil Fresk Date: Sat, 14 Nov 2020 16:09:20 +0100 Subject: Add multilock to the book --- book/en/src/by-example/resources.md | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'book/en/src/by-example') diff --git a/book/en/src/by-example/resources.md b/book/en/src/by-example/resources.md index 301961d..3a3e0b7 100644 --- a/book/en/src/by-example/resources.md +++ b/book/en/src/by-example/resources.md @@ -64,6 +64,14 @@ $ cargo run --example lock {{#include ../../../../ci/expected/lock.run}} ``` +## Multi-lock + +As an extension to `lock`, and to reduce rightward drift, locks can be taken as tuples. The following examples shows this in use: + +``` rust +{{#include ../../../../examples/multilock.rs}} +``` + ## Late resources Late resources are resources that are not given an initial value at compile time using the `#[init]` attribute but instead are initialized at runtime using the `init::LateResources` values returned by the `init` function. -- cgit v1.2.3