Rust by Example -- Extended Edition

Rust is a modern systems programming language focusing on safety, speed, and concurrency. It accomplishes these goals by being memory safe without using garbage collection. A big part of Rust's strength and success comes from the large ecosystem of third party libraries, known as crates.

Rust by Example -- Extended Edition (RBEext) is a collection of runnable examples that illustrate how to use popular Rust third party libraries and crates. It is designed to complement the official Rust by Example (RBE) book that focuses on the core language and standard libraries. Additionally for the curious, you can also check out the source code for this site.

Note: Many examples in this book are directly runnable from the web page. See the animation below this note. However, the Rust playground only supports 100 3rd party crates. For crates or features that are not supported by the playground, we show the results next to the examples, and link to cargo project source code.

Run an example from the web page

Now let's begin!

  • Serialization - Serialization and deserialization are key to data exchange between Rust programs and the rest of the world. The serde crate is the de facto standard here.

  • Random numbers - It is surprisingly difficult to get high quality random numbers for your application. The rand crate can help.

  • SSL/TLS toolkit - Rust API wrappers for the OpenSSL library to handle public key infrastructure and secure communications. Encryption, decryption, digital certificates, digital signature, secure digest, secure network protocols, and more!

  • N-dimensional array - Multi-dimensional arrays are crucial for scientific computing, data mining, machine learning (ML), and artificial intelligence (AI) applications.

  • Lazy initialization - Lazy initialization allows you to assign values to static variables at runtime.

  • Regular expression - Processing and manipulating text and string values.

  • WebAssembly - It is very popular to run Rust apps in WebAssembly, learn why and how.