1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-17 04:32:46 +01:00
RIOT/examples/rust-hello-world
chrysn 50f8ed3f72 {examples,tests}/rust*: Update Cargo.toml
This pulls in adjustments to the C-nonbreaking but Rust-breaking API
change in https://github.com/RIOT-OS/RIOT/pull/17359

cstr_core is forcibly kept at 0.2.4 because 0.2.5 needs a newer nightly
than riotdocker currently has.
2022-01-07 14:19:36 +01:00
..
src examples: Add Rust example 2021-12-16 13:29:30 +01:00
Cargo.lock {examples,tests}/rust*: Update Cargo.toml 2022-01-07 14:19:36 +01:00
Cargo.toml examples: Add Rust example 2021-12-16 13:29:30 +01:00
Makefile examples: Add Rust example 2021-12-16 13:29:30 +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.