Getting Started with KubOS and Rust¶
This document will cover getting started using Rust for local KubOS development. You will need to have the build dependencies listed in local build dependencies installed prior to using Rust. After these dependencies have been installed, you are ready to begin creating and running your own Rust projects.
New Project¶
A new Rust project can be created by running the following command:
$ cargo new project_name
Cargo will create the project folder and a basic folder structure. It is suggested that you create custom mission applications or services outside of the Kubos source repo, preferably in your own project’s repo folder.
Compiling and Running¶
To compile the project use the normal Cargo build command:
$ cargo build
This command should be run from within the project’s directory, which was
generated by the cargo new
command.
The resulting binary will be located in {project directory}/target/debug/{project name}.
The binary can be run locally using the cargo run
command.
Any desired arguments can be passed to the underlying executable by placing them behind --
like
so:
$ cargo run -- -c config.toml
Next Steps¶
Ready to create a mission application in Rust? Take a look at the Python mission application tutorial for guidance in the construction of a mission application. The example rust mission application is a good model for a Rust-based mission application.
Interested in cross-compiling your project for use on hardware? Take a look at the local cross-compiling guide.
Interested in working on the KubOS Rust source or contributing back? Take a look at the Contributing to KubOS docs.