
Rust to WebAssembly and When It Is Worth the Effort
A guide to compiling Rust to WebAssembly: the targets, wasm-bindgen, calling between Rust and JavaScript, size, testing and when WebAssembly is worth it.
The language itself: ownership, lifetimes, error handling, Serde and the idioms that make the borrow checker feel like help.

A guide to compiling Rust to WebAssembly: the targets, wasm-bindgen, calling between Rust and JavaScript, size, testing and when WebAssembly is worth it.

Use thiserror when callers need to match on what went wrong and anyhow when they only need to read it. Here is the rule, the code for each, and how to mix them.

Assert that code panics with should_panic and a message, or with catch_unwind for finer control. Know the traps: unrelated panics passing, Result tests and panic=abort.

A map of Rust debugging tools in the order to reach for them: compiler messages, dbg!, tests, backtraces, tracing, a debugger and sanitizers, with when each one wins.

Safe Rust can leak memory. See how Rc cycles form, how Weak breaks them, how to detect a leak with counts, and why Rust's guarantee excludes leaks.

Result is an enum with Ok and Err. Learn the handful of methods that cover most uses and when to match instead of chaining.

Exit codes are how scripts know your tool failed. Return 0 for success, a nonzero code for failure, send errors to stderr, and let main return ExitCode or Result.

A working guide to error handling in Rust: Result, the question mark, custom error types, anyhow and thiserror, and the line between a panic and an error.

E0308 mismatched types means the compiler expected one type and found another. Learn the five shapes it takes, from a missing semicolon to if branches that differ.

E0597 means a reference outlives the value it points to. See the two common shapes, a block that ends too early and a struct that outlives its data, and how to fix each.

Store and query JSON in PostgreSQL JSONB from Rust: sqlx Json<T> typed columns, containment and path operators, partial updates, GIN indexes and when a column beats JSON.

Turn a PostgreSQL unique violation into a friendly conflict instead of a 500. Check is_unique_violation on the database error, read the constraint name and map foreign key errors too.
We send one email when a new post is published. No spam.