From 76e234599f6da0b7ee21b98da80201a3984ee323 Mon Sep 17 00:00:00 2001 From: Emil Fresk Date: Thu, 7 Nov 2019 14:12:16 +0100 Subject: Added struct de-structure-ing example in tips & tricks --- book/en/src/by-example/tips.md | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'book/en/src/by-example') diff --git a/book/en/src/by-example/tips.md b/book/en/src/by-example/tips.md index a008206..b923ed0 100644 --- a/book/en/src/by-example/tips.md +++ b/book/en/src/by-example/tips.md @@ -165,3 +165,12 @@ crate and print the output to the console. $ # produces the same output as before $ cargo expand --example smallest | tail ``` + +## Resource de-structure-ing + +When having a task taking multiple resources it can help in readability to split +up the resource struct. Here're two examples on how this can be done: + +``` rust +{{#include ../../../../examples/destructure.rs}} +``` -- cgit v1.2.3