1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/examples/rust-hello-world
chrysn a0ee4def10 rust: Selectively update riot-wrappers
Changes pulled by this are:
* optimizations around panicking <https://github.com/RIOT-OS/rust-riot-wrappers/pull/82>
* administrative changes (CI fixes)
2024-03-20 16:00:08 +10:00
..
src rust: Make examples / tests use any Rust RIOT modules 2022-07-10 21:27:13 +02:00
Cargo.lock rust: Selectively update riot-wrappers 2024-03-20 16:00:08 +10:00
Cargo.toml exmple > example in Cargo.toml comment 2024-02-17 13:08:16 +01:00
Makefile makefiles/rust: Remove CARGO_CHANNEL special casing 2024-01-31 12:25:09 +01:00
README.md examples: Add Rust example 2021-12-16 13:29:30 +01:00

Hello World!

This is a basic example how to use Rust to write your RIOT application. It prints out the famous text Hello World!.

This example should foremost give you an overview how an application built completely in Rust is structured:

  • The Makefile resembles the regular application Makefile, see ../hello-world/ for more introduction to that.

  • The Cargo.toml file describes the Rust code, and declares its dependencies.

    Prominently, it contains a [lib] / crate-type = ["staticlib"] section, which is necessary for how RIOT later links together the C and Rust portions.

  • The file src/lib.rs (and any modules referenced by it) contain Rust code to be run.

    It uses the riot_main! macro provided by the riot-wrappers crate to declare the entry point of the program.

The code itself looks like the usual Rust hello-world example.