Rust is a multi-paradigm system programming language[14] focused on safety and performance, especially safe concurrency.[15][16]

It is Open Source https://github.com/rust-lang/ Apache License Version 2.0, January 2004

Rust is syntactically similar to C++,[17] but is designed to provide better memory safety while maintaining high performance.

Rust was originally designed by Graydon Hoare at Mozilla Research, with contributions from Dave Herman, Brendan Eich, and others.[18][19] The designers refined the language while writing the Servo layout or browser engine[20] and the Rust compiler. The compiler is free and open-source software dual-licensed under the MIT License and Apache License 2.0.

Rust was the „most loved programming language“ in the Stack Overflow Developer Survey for 2016, 2017, 2018, and 2019.[21][22][23][24]

Introduction to Rust at https://LINUX.conf.au 2017

  • speed
  • safety
  • don’t be a jerk

PyCon 2019 AU:

History

The language grew out of a personal project begun in 2006 by Mozilla employee Graydon Hoare,[16] who stated that the project was possibly named after the rust family of fungi.[38]

Mozilla began sponsoring the project in 2009[16] and announced it in 2010.[39][40]

Named rustc, it successfully compiled itself in 2011.[42]

stable point releases are delivered every six weeks

while features are developed in nightly Rust and then tested with alpha and beta releases that last six weeks.[46]

Along with conventional static typing, before version 0.4, Rust also supported typestates.

The typestate system modeled assertions before and after program statements, through use of a special

check

statement.

Discrepancies could be discovered at compile time, rather than when a program was running, as might be the case with assertions in C or C++ code.

In January 2014, the editor-in-chief of Dr Dobb’s, Andrew Binstock, commented on Rust’s chances to become a competitor to C++, and to the other upcoming languages D, Go and Nim (then Nimrod).

According to Binstock, while Rust was „widely viewed as a remarkably elegant language“, adoption slowed because it changed repeatedly between versions.[49]

Rust was the third-most-loved programming language in the 2015 Stack Overflow annual survey,[50] and took first place in 2016, 2017, 2018, and 2019.[51][52][53][54]

The language is referenced in The Book of Mozilla as „oxidised metal“.[55]

getting started: Examples

one can run the examples in the online editor: https://play.integer32.com/

and:

https://play.rust-lang.org/

setup rust compiler:

highly recommend setting this up in a virtual machine, that once it is set up, can be moved to various machines where one intends to work. (laptop, desktop, ultratop, megatop, hypertop, gigatop)

as non-root user, download and run the setup script, warning! this will download ~100 MBytes of Data! (one might want to do this with connections of fast and inexpensive bandwidth)

# as non-root user
# go into one's home directory
cd
# download rust setup script
curl -o setup.sh https://sh.rustup.rs
chmod +x setup.sh
# start it
./setup.sh

# this will download and install under /home/user
# 85 Mbytes rustc
# 61 MBytes rust-std
# 4.6 MBytes cargo
# 11 MBytes rust-docs
# if one wants to reinstall
# (fix error: "no default toolchain configured")
# rustup install stable
# rustup default stable

# download more stuff
# fix error in eclipse during project creation:
# "Install missing rls component in Rustup"
rustup component add rls
# as root user
su
# add rust path to all user's path (root and non-root)
# for some reason .profile get's ignored
echo 'export PATH="$HOME/.cargo/bin:$PATH"' >> /etc/bash.bashrc

# verify one can run the rust compiler by
rustc --version
rustc 1.37.0 (eae3437df 2019-08-13)

# sing 3x hallelujah :)

get organized

one recommends to create a projects folder (eclipse calls it „workspace“ where all projects reside in)

this should probably also be in one’s home folder, but out of shier crazyness will create this under /

# become root and create workspace folder
su
mkdir /projects
chown -R user:user /projects

# create folder for project
mkdir /projects/helloworld

Hello World

Here is a simple „Hello, World!“ program written in Rust. The

println!

macro prints the message to standard output.

so simply do vim /projects/helloworld/helloworld.rs and insert this content:

fn main() {
    println!("Hello World");
}

when done, one can compile it to binary.

cd /projects/helloworld
rustc helloworld.rs
# will generate a 2.4MByte binary
# run it
./helloworld
Hello World
# dance! dance! dance! hurray we did it

Factorial function

Recursive

fn factorial(i: u64) -> u64 {
    match i {
        0 => 1,
        n => n * factorial(n-1)
    }
}

Iterative

fn factorial(i: u64) -> u64 {
    let mut acc = 1;
    for num in 2..=i {
        acc *= num;
    }
    acc
}

Using iterators

fn factorial(i: u64) -> u64 {
    (1..=i).product()
}

https://en.wikipedia.org/wiki/Rust_(programming_language)

What IDE would one use?

and: is there step debugging?

http://eclipse.mirror.garr.it/mirrors/eclipse//technology/epp/downloads/release/2019-06/R/eclipse-rust-2019-06-R-incubation-linux-gtk-x86_64.tar.gz

https://projects.eclipse.org/projects/tools.corrosion

https://www.eclipse.org/downloads/packages/release/2019-06/r/eclipse-ide-rust-developers-includes-incubating-components

Build it in Rust

In 2018, the Rust community decided to improve programming experience for a few distinct domains (see the 2018 roadmap). For these, you can find many high-quality crates and some awesome guides on how to get started.

Command Line

Whip up a CLI tool quickly with Rust’s robust ecosystem. Rust helps you maintain your app with confidence and distribute it with ease.

Learn More

WebAssembly

Use Rust to supercharge your JavaScript, one module at a time. Publish to npm, bundle with webpack, and you’re off to the races.

Learn More

Networking

Predictable performance. Tiny resource footprint. Rock-solid reliability. Rust is great for network services.

Learn More

Embedded

Targeting low-resource devices? Need low-level control without giving up high-level conveniences? Rust has you covered.

Learn More

Read Rust

We love documentation! Take a look at the books available online, as well as key blog posts and user guides.

Read the book

Watch Rust

The Rust community has a dedicated YouTube channel collecting a huge range of presentations and tutorials.

Watch the Videos

Contribute code

Rust is truly a community effort, and we welcome contribution from hobbyists and production users, from newcomers and seasoned professionals. Come help us make the Rust experience even better!

Read Contribution Guide

Links:

https://www.jonathanturner.org/

https://flames-of-code.netlify.com/blog/rust-and-cmake/

https://www.infoworld.com/article/3247799/what-is-llvm-the-power-behind-swift-rust-clang-and-more.html

admin