aboutsummaryrefslogtreecommitdiff
path: root/examples/destructure.rs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/destructure.rs')
-rw-r--r--examples/destructure.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/examples/destructure.rs b/examples/destructure.rs
index 6019c225..89336bfd 100644
--- a/examples/destructure.rs
+++ b/examples/destructure.rs
@@ -4,6 +4,7 @@
#![deny(warnings)]
#![no_main]
#![no_std]
+#![feature(type_alias_impl_trait)]
use panic_semihosting as _;
@@ -22,11 +23,11 @@ mod app {
struct Local {}
#[init]
- fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
+ fn init(_: init::Context) -> (Shared, Local) {
foo::spawn().unwrap();
bar::spawn().unwrap();
- (Shared { a: 0, b: 0, c: 0 }, Local {}, init::Monotonics())
+ (Shared { a: 0, b: 1, c: 2 }, Local {})
}
#[idle]
@@ -37,7 +38,7 @@ mod app {
// Direct destructure
#[task(shared = [&a, &b, &c])]
- fn foo(cx: foo::Context) {
+ async fn foo(cx: foo::Context) {
let a = cx.shared.a;
let b = cx.shared.b;
let c = cx.shared.c;
@@ -47,8 +48,8 @@ mod app {
// De-structure-ing syntax
#[task(shared = [&a, &b, &c])]
- fn bar(cx: bar::Context) {
- let bar::SharedResources { a, b, c } = cx.shared;
+ async fn bar(cx: bar::Context) {
+ let bar::SharedResources { a, b, c, .. } = cx.shared;
hprintln!("bar: a = {}, b = {}, c = {}", a, b, c).unwrap();
}