394 private links
one [idea] that I’m calling “just call clone (or alias)”. This proposal specializes the clone and alias methods so that, in a new edition, the compiler will (1) remove redundant or unnecessary calls (with a lint); and (2) automatically capture clones or aliases in move closures where needed.
It's full of insights
Embedded systems:
- Embassy for async Rust
- Heapless for statically-allocated data structures or allocate as much as possible on the stack
- Patina implements the UEFI interface
Operating systems:
- Rust for Linux
- Android with firmware, virtualization framework and other os features
Runtime and virtualization
- Firecracker
- Deno as JS runtime and it proved that in just a fraction of the time and developers, Deno already has shipped way more features than Node.js.
Cross platform apps
Dropbox, Element (matric Chat), Ditte and others also uses Rust.
Databases
- Neon uses a single S3-compatible storage as its backend. It complicates Postgres' monolithic architecture but it also solves many of its problems: read-replicas now uses a single source of truth instead of (error-prone) replication; slow and expensive networked storage are not needed anymore to get a highly-available database and upscaling or downscaling is a matter of spawning a new container/microVM
- Datafusion is an extensible query engine that allows data engineers to query data sources from Rust or Python with a high level interface, or build data systems using it as their query layer to build and optimize query plans. See the projects build with it!
- [Turso] is an embedded, SQLite-compatible database written in rust. It's fully open source compared to the private test suits of SQLite. It solves many SQLite pain points: easy database encryption, concurrent writes, async I/O, updating the schema and more.
Servers: the author project Pingoo
As mentioned earlier, one of the many interesting things that Rust enables, is to reuse patterns from the embedded world, such as eliminating heap allocations to be as performant as possible
Pour les utilisateurs de la distribution, cela ne devrait rien changer. Pour les développeurs en revanche, il y aura des travaux plus ou moins importants, car il faudra prévoir une chaine de compilation Rust fonctionnelle en plus des outils traditionnels comme GCC. En clair, la complexité va monter d’un cran, notamment sur les architectures moins courantes où le langage n’est pas bien supporté.
Rust utilise bien en effet LLVM, alors que la plupart des paquets sont compilés avec GCC.
Comme Rust vient livré avec des binaires précompilés, comment ce code peut être certifié
Ce sujet rappelle x/Wayland, initd/systemd, IPv4/v6.
Les commentaires de l'article sont bien pertinents!
A rust fund is created to support maintainers. The article don't explain how though.
How Rust differs compared to other programming languages and why it's efficient.
- Indexing into a vector: prefer better pattern matching or raw array with index safety instead
- Lazy use of
Default: initialize all fields instead - Avoid fragile trait implementations that pass silently on changes
Fromtraits must be infaillible, useTryFromif any error can occur. Make it explicit.- Avoid non-exchaustive matches (with
_ =>) - Use decriptive names for unused variables with the
_placeholder. - Avoid temporary mutability and make it explicit instead:
let mut data = ....; .... ; let data = data - Defensively handle constructors with
#[non_exhaustive], so creating an raw instance of a struct should be prohibited outside constructor functions. - Use
#[must_use]to avoid unused instance of the struct. - Avoid boolean parameters and in case of need, prefer enums.
- Use Clippy lints:
- clippy::indexing_slicing
- clippy::fallible_impl_from
- clippy::wildcard_enum_match_arm
- clippy::unneeded_field_pattern
- clippy::fn_params_execussive_bools
The new minor version make the tools faster.
The Rust-Coreutils v0.3.0 supports 83.91% of the GNU Coreutils 9.8.
It's a decreased compared to the 87.06% of the GNU coreutils 9.7.
Wrapping every string to a newtype ensure the string can be extended as wished and at least differenciated from normal strings without meaning
The project: https://github.com/kustomzone/sierra-db
You benchmark your node/ruby/python software on a fancy Macbook M4 and celebrate 500ms response time.
I benchmark my rust software on a $30 potato computer that may as well have 256MB of RAM and celebrate 800ms response time.
Documentation: https://pingoo.io/
Developed by Silvain Kerkour: https://kerkour.com/
The heap is a performance killer in Rust. One woraround is to swap to a more efficient memory allocator such as jemalloc.
In Cargo.toml:
[dependencies]
mimalloc = "0.1"
In main.rs:
#[global_allocator]
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
The best performance optimisation is to avoid the heap. There is the heapless create for that. "The only thing to know is that the size of heapless types and collections needs to be known at compile-time."
Lifetime annotations are needed to tell the compiler that we are manipulating some kind of long-lived reference and let it assert that we are not going to screw ourselves
The only downside is that smart pointers, in Rust, are a little bit verbose (but still way less ugly than lifetime annotations). [They add some runtime overhead.]
When to use lifetimes annotations?
When performance really matters or when your code will be used in no_std environments.