September 9, 2022

Speeding up incremental Rust compilation with dylibs

TL;DR Creating a dynamic version of a Rust library can improve incremental compilation speed during development quite substantially. cargo add-dynamic automates the setup process. One of Rust’s biggest downsides is that it tends to be rather slow when compiling programs. A lot of work has been put into improving the situation over the years with noticable impact. In addition, there are a number of good guides out there that explain the impact of various optimization options and tooling choices: Read more

August 4, 2022

Hot Reloading Rust — for Fun and Faster Feedback Cycles

TL;DR hot-lib-reloader allows to change Rust code on the fly without restarts. It works on Linux, macOS, and Windows. For why, how it works and, how to use it (as well as the limitations of this approach) read the post below. Hot-reloading a Bevy app Development with Rust can be a lot of fun and the rich type system in combination with good tooling such as rust-analyzer can provide helpful hints and guidance continuously while writing code. Read more

May 16, 2022

Prototyping with Rust, or: how to write Rust fast ::Draft

What is prototyping Software prototyping is typically understood as the process of creating a first version of a program. Its purpose usually is to evaluate ideas and to better understand concepts and problem domains. This post discusses how Rust can be used for implementing prototypes. and gives some tips for improving implementation speed. The right tool for the job Prototypes are not per se throw-away code, they might be the first step towards a MVP but since developing them should only take a fraction of the time and resources (in comparison with the “real” thing), they might get abandoned or only serve as learnings for other attempts. Read more

May 5, 2022

A little guide to the Tracing crate ::Draft

https://tokio-rs.github.io/tracing/tracing/ https://github.com/tokio-rs/tracing structured, context-aware, event driven diagnostics Diagnostics with Tracing Rust compiler uses tracing for building custom subscriber: https://burgers.io/custom-logging-in-rust-using-tracing https://burgers.io/custom-logging-in-rust-using-tracing-part-2 “demo”: https://fasterthanli.me/articles/request-coalescing-in-async-rust#:~:text=A%20bit%20of%20tracing

April 3, 2022

A Rust web server / frontend setup like it's 2022 (with axum and yew)

WebAssembly tooling for Rust has made big improvements and has matured tremendously over the previous two years. The build and packaging steps are now simpler thanks to tools like Trunk, as well as being able to write frontend code with various frameworks such as yew or dioxus. Also support for wasm is now supported in quite a few crates, basic ones such as chrono or higher level libraries such as plotters. Read more

September 18, 2021

Rust Types & Bevy queries: How it works ::Draft

Bevy is an emerging open source game engine for Rust build around an implementation of ECS (Entity Component System), an architectural software pattern gaining popularity in game development. This post explores how one aspect of Bevy’s ECS, entity-component queries, are implemented. They are an important building block of the game engine and make somewhat surprising (to me at least) use of Rust’s type system; their design is central to the good ergonomics of Bevy. Read more

February 7, 2021

Configuring Emacs for Rust development

Rust support in Emacs improved a lot during the past two years. This post will walk you through setting up Emacs to allow for: Navigating the source code (go to to implementation, list references, outline module structure) Code completion Code snippets Highlighting errors and warnings inline Apply code fixes and refactorings Automatically import definitions if necessary (such as for Traits) Code formatting with rustfmt Building & running other cargo commands This setup will be based on rust-analyzer, a LSP server that is under very active development and powers the Rust support in VS Code as well. Read more

February 3, 2021

Is Rust a Functional Programming Language?

Update: There was a delightful discussion about functional programming and the nature of Rust at lobste.rs. Some quotes... Functional languages take away mutability from the “mutability + aliasing = bugs” equation; Rust takes away the aliasing — or at least, the uncontrolled aliasing. To me, it then makes sense to feel comfortable using mutability (and the advantages it offers), safe in the knowledge that the compiler is helping you avoid bugs. Read more

February 1, 2021

Building and deploying Rust utilities

Over the past year I build a number of tools and utilities in Rust. Previously, I would mostly do this in node.js or shell scripts but Rust has some advantages: More reliable for long running and mostly unobserved applications (“once it runs is runs”), in particular no memory (leak) issues Needs less resources, upping the utility value of my various Raspberry Pis Setup and deployment are simple mostly due to the cargo package management and build tool The last point I’ll describe in more detail. Read more

© Robert Krahn 2009-2023