Tutorial will be written as a diary while developing simple and/or trivial projects. I'll not cover Rust syntax. Rust programming language has really excellent tutorial at Rust book.
Modules vs Libraries
First create basic Rust project. We will use Cargo a build system which comes as part of a Rust install package.
Dedicate some directory to your Rust projects and within this directory create new Rust library project.
> cargo new mylib
> cd mylib/src
Inside created project you'll find src directory with lib.rs file. Cargo uses lib.rs as root module for library project, and main.rs for executable project. We'll create new executable root main.rs and two module files. This way we can experiment with modules and libraries within one project.
> touch main.rs
> touch moda.rs
> touch modb.rs
> cd ..
Insert following content into main.rs.
// file: src/main.rs
fn main() {
println!("Hello World!");
}
Run application by:
> cargo run