Skip to content

Commit

Permalink
rust: Make examples / tests use any Rust RIOT modules
Browse files Browse the repository at this point in the history
  • Loading branch information
chrysn committed Jul 10, 2022
1 parent 5e75f4b commit bc8ec6d
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 0 deletions.
6 changes: 6 additions & 0 deletions examples/rust-gcoap/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,9 @@ riot-wrappers = { version = "^0.7.18", features = [ "set_panic_handler", "panic_
coap-message-demos = { git = "https://gitlab.com/chrysn/coap-message-demos/", default-features = false }
coap-handler-implementations = "0.3"
riot-coap-handler-demos = { git = "https://gitlab.com/etonomy/riot-module-examples/", features = [ "vfs" ] }

# While currently this exmple does not use any RIOT modules implemented in
# Rust, that may change; it is best practice for any RIOT application that has
# its own top-level Rust crate to include rust_riotmodules from inside
# RIOTBASE.
rust_riotmodules = { path = "../../sys/rust_riotmodules/" }
2 changes: 2 additions & 0 deletions examples/rust-gcoap/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ use riot_wrappers::{gcoap, thread, ztimer, gnrc};

use coap_handler_implementations::{ReportingHandlerBuilder, HandlerBuilder};

extern crate rust_riotmodules;

riot_main!(main);

fn main() {
Expand Down
6 changes: 6 additions & 0 deletions examples/rust-hello-world/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,9 @@ crate-type = ["staticlib"]
[dependencies]
# `default-features = false` can be removed with 0.8, and enables building on stable during the 0.7 series
riot-wrappers = { version = "0.7", features = [ "set_panic_handler" ], default-features = false }

# While currently this exmple does not use any RIOT modules implemented in
# Rust, that may change; it is best practice for any RIOT application that has
# its own top-level Rust crate to include rust_riotmodules from inside
# RIOTBASE.
rust_riotmodules = { path = "../../sys/rust_riotmodules/" }
2 changes: 2 additions & 0 deletions examples/rust-hello-world/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
use riot_wrappers::riot_main;
use riot_wrappers::println;

extern crate rust_riotmodules;

riot_main!(main);

fn main() {
Expand Down
5 changes: 5 additions & 0 deletions tests/rust_minimal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,8 @@ panic = "abort"
[dependencies]
# `default-features = false` can be removed with 0.8, and enables building on stable during the 0.7 series
riot-wrappers = { version = "0.7", features = [ "set_panic_handler" ], default-features = false }

# While currently this test does not use any RIOT modules implemented in Rust,
# that may change; it is best practice for any RIOT application that has its
# own top-level Rust crate to include rust_riotmodules from inside RIOTBASE.
rust_riotmodules = { path = "../../sys/rust_riotmodules/" }
2 changes: 2 additions & 0 deletions tests/rust_minimal/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
use riot_wrappers::riot_main;
use riot_wrappers::println;

extern crate rust_riotmodules;

riot_main!(main);

fn main() {
Expand Down

0 comments on commit bc8ec6d

Please sign in to comment.