This month newsletter | learning resources

  • Source: Rust Daily
  • The author:RustDaily newspaper group
  • Post Editing: Su Yinrong (DaviRain)

Create an emulator using Rust

Learning to Fly: Let’s create a simulation in Rust! .

In this series of articles, the author will walk you through implementing a basic feed-forward neural network using Rust.

link

Create an explosive Markdown editor with Rust and WebAssembly

Excerpt: Let’s quickly prepare the WebAssembly development environment

Rust usually cargo builds using commands, but WebAssembly has a tool called WASM-pack that can do a lot of things very easily, so let’s install it.

link

Improving texture atlas allocation in WebRender

The author spends a lot of time explaining how to improve the Texture Atlas allocation in WebRender.

link

New book: Black Hat Rust

Black Hat Rust is an in-depth study of aggression and security based on the Rust programming language. Final publication is expected in July 2021, with an estimated 320 pages. If you are a safe practitioner, this book will be of great interest to you.

link

Emacs configures the Rust development environment

Emacs enthusiasts who want to develop Rust can refer to this article for detailed setup.

link

Rust knowledge refining

This article is the author of his Rust knowledge sorted out here. For those of you who are interested, take a look.

link

Exercism [.] IO: an online programming exercise

Exercism [.] IO is an online programming training platform that supports the Rust language.

link

【 video 】1Password developer fireside chat: Introduce Rust macro

Video link

Compare Rust Async with Linux thread context switching times

The authors write some code that attempts to compare the time required for Linux thread context switching with the time required for Rust Async task scheduling switching and the total amount of memory used in each case, and summarize.

Github

Build Actors directly using Tokio

This article uses Tokio to build Actors directly, rather than using any existing actor library.

Those of you who are interested can read it.

link

Rust from Zero to Production: The skeleton and principles of a maintainable test suite

This is part 1 of Chapter 7 in Rust from Zero to Production.

This chapter focuses on testing. The whole book is basically a test-driven approach to writing new features. As the code gets bigger, a good testing framework can better support more complex features and increasing number of test cases.

link

For the Love of Macros

Macros are more power than that. They give us the ability to abstract beyond source code, but at the same time, you give up surface syntax. For example, in a language with powerful macros, renaming is unlikely to work 100% of the time.

This article tries to explore the use of macros in Rust in order to find a solution that does not abandon source code inference.

link

Rewrite an SQLite from zero using Rust

The author plans to replicate an SQLite database using Rust and is currently in the works.

SQLite is well documented, the code quality is very high, and the unit test cases are very rich. Finally, someone is trying to rewrite SQLite using Rust.

Github

link

Microsoft employees post Rust videos of Windows users

This article describes how to use Windows-RS crate to build Rust on a Windows platform.

link

How to build a Telnet chat server using WebAssembly

There are plenty of people who like Terminals’ aesthetic, and the author is one of them.

The author constructs a Telnet chat server using WebAssembly + Rust. You can use the following command to try it out.

# US
> telnet lunatic.chat
# EU
> telnet eu.lunatic.chat
Copy the code

link

EasyRust now has videos

EasyRust is a great introduction to Rust, and now it has documentation and videos.

Here’s the first of at least 70 more videos. If you want to learn, you can follow the video.

EasyRust address

Tubing video

Six classic Rust interview questions

Here are six interview questions from @Wayslog, which Teacher Wayslog calls the “classic six” :

  1. What are the constraints on T for RwLock to be used correctly in multithreading?

  2. The following code:

    trait A{ fn foo(&self) -> Self; }
    Box<Vec<dyn A>>;
    Copy the code

    Does it compile? Why is that?

  3. What is the difference between Clone and Copy?

  4. Deref’s called procedure?

  5. How does Rust automatically print a line of logs at the entry and exit of functions?

  6. Box<dyn (Fn() + Send +’static)>

Answers provided by @Wayslog:

  1. The type parameter T represents the data that this lock protects. It is required that T satisfies Send to be shared across threads and Sync to allow concurrent access through readers.
  2. No, refer to the three Object Safe rules.
  3. Copy is a marker trait that tells the compiler to Copy when it needs to move. Clone stands for copy semantics, with function body. Incorrect implementation of Clone can cause Copy bugs.
  4. Deref is a trait because Rust automatically adds the right number of * to indicate dereference when called. You can call Deref even if you don’t add *.
  5. Macro was called in the invocation, macro declaration was wrapped in the declaration, proc_macro was wrapped in the function, and compiler Plugin and LLVM were used for the evil point. (Go: I can use snippet.)
  6. A callable object with no arguments and no return value that can be sent to another thread is called a Closure, which is also an Ownershiped and has a static lifecycle, meaning that there is no reference to the context.

Readers will learn more

Discuss the link

Rust for web development

This blog is the author of Black Hat Rust, a new book on Rust due out in July. The author has been experimenting with Using Rust for Web development for two years. This blog post talks about his feelings and experiences with Rust, and also mentions which Crate he uses for his development.

link

A stupid way to learn the Rust ownership mechanism

To really understand Rust, we need to understand the key feature that sets it apart from other languages: ownership. This blog takes a clumsy approach to Rust’s ownership.

link

Rust and LoRa

Drogue IoT is a team trying to bring reusable and efficient components to embedded Rust, and this article describes “how to get started with LoRa in Rust.”

Ps: LoRa is a low power remote wireless protocol

Blog. Drogue. IO /rust-and-lo…

Repo: github.com/drogue-iot/…

Rust cycle optimization

Introduction to Cranelift code generation

Cranelift is a code generator written in the Rust programming language and designed to be a fast code generator that outputs machine code running at a reasonable speed. Today, it is used in several different WebAssembly runtimes, including Wasmtime and Wasmer, and can serve as an alternative back end to Rust debug compilation.

Blog.benj.me /2021/02/17/…

Cranelift Warehouse address: github.com/bytecodeall…

Rtic book

The RTIC framework is an interrupt driven asynchronous real-time system that uses Rust’s macro syntax to generate applications with high efficiency.

RTIC Book: RTIC. Rs / 0.5 / Book/en…

Ferrous System embedded course materials from Rust Consulting company

Link: embedded-trainings.ferrous-systems.com/preparation…