Rust 🦀

Rust 🦀

The language of expert developers

·

3 min read

Introduction

rust-social-wide.jpg Rust is a multi-paradigm and general-purpose programming language. Rust emphasizes performance, type safety, and concurrency. It was designed by Graydon Hoare while working at Mozilla Research in 2006. It is licensed under MIT and Apache 2.0 (dual-licensed).

🤔 Why Rust?

Rust is blazingly fast and memory-efficient: with no runtime or garbage collector, it can power performance-critical services, run on embedded devices, and easily integrate with other languages. Rust’s rich type system and ownership model guarantee memory-safety and thread-safety — enabling you to eliminate many classes of bugs at compile-time. Rust has great documentation, a friendly compiler with useful error messages, and top-notch tooling — an integrated package manager and build tool, smart multi-editor support with auto-completion and type inspections, an auto-formatter, and more.

Rust in production

Hundreds of companies around the world are using Rust in production today for fast, low-resource, cross-platform solutions. Software you know and love, like Firefox, Dropbox, and Cloudflare, uses Rust. From startups to large corporations, from embedded devices to scalable web services, Rust is a great fit.

Capture.PNG

Tools

Cargo-Logo-Small.png Rust comes with its toolchain installer called rustup which installs cargo, rustfmt, rustdocs (documentation builder) and clippy as its default tools for managing projects and making the development environment fast.

Rust's industry-grade tools make collaboration fearless, allowing teams to focus on the tasks that matter.

CLI Tools

Cargo

Cargo is Rust's build system and package manager. Cargo downloads, compiles, distributes, and uploads packages, called crates, maintained in the official registry.

Rustfmt

Rustfmt automatically formats Rust code, making it easier to read, write, and maintain. And most importantly: never debate spacing or brace position ever again.

Clippy

Clippy is Rust's built-in linting tool to improve the correctness, performance, and readability of Rust code. Clippy has more than 450 rules, which can be browsed online and filtered by category.

Online Tools

Rust Playground

A browser interface to the Rust compiler to experiment with the language. Capture.PNG

crates.io

cargo is the package manager and crate host for rust. crates.io

Performance

Rust provides two "modes": safe and unsafe. The safe mode is the "normal" one, in which most Rust is written. In unsafe mode, the developer is responsible for the correctness of the code, making it possible to create applications which require low-level features. It has been demonstrated empirically that unsafe Rust is not always more performant than safe Rust, and can even be slower in some cases. Capture.PNG Since Rust utilizes LLVM, any performance improvements in LLVM also carry over to Rust. Unlike C and C++, Rust allows re-organizing struct and enum element ordering. This can be done to reduce the size of structures in memory, for better memory alignment, and to improve cache access efficiency.

Rust Foundation

Capture.PNG The Rust Foundation is a non-profit membership organization incorporated in United States, with the primary purposes of backing the technical project as a legal entity and helping to manage the trademark and infrastructure assets. It was established on February 8, 2021, with five founding corporate members (Amazon Web Services, Huawei, Google, Microsoft, and Mozilla).

Â