Install Rust#
Refer Setup Rust for installation.
You can also refer official Rust documentation
Create new project with cargo#
Open terminal and run following
1
2
cargo new hello-world
cd hello-world
1
2
3
fn main() {
println!("Hello, world!");
}
Run application#
1
2
3
4
5
6
cargo run
# Output
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.03s
Running `target/debug/hello-world`
Hello, world!
Conclusion#
Above is a simple Hello, World program in rust, which itself will not do anything other than printing a static text. Using cargo we can easily create rust projects with proper code structure without any manual effort.