Our great sponsors
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
Error handling is unfortunately a little more idiomatic and less language-specified than it should be, but it's getting better. In a library, you should use thiserror to provide errors that wrap around existing errors / provide errors of your own. In an application, you should use anyhow which lets you use any error type implicitly, thus giving you the semantics you'd want. Yeah, this could be better, but it's getting there.
There's Rustig which does it for panics, though it seems unmaintained and uses inspection of the final binary rather than source code/AST inspection.
Here's an example from some of my own (old) code of using a macro to generate a bunch of boilerplate methods. It's a very simple example, but it demonstrates how readable the macro language is.
Option and Result make a lot of sense if you come from a language or toolkit that already does this for you. Java's Optional, Scala's Option, C# LanguageExt, JS Monet, and others are good places to start. Searching Youtube or Google for "maybe monad" might also turn up something useful.
Related posts
- FreeBSD evaluating Rust's adoption into base system
- Rust-GCC: GCC Front-End for Rust
- rlci: Overly-documented Rust-powered Lambda Calculus Interpreter. A real programming language in just a bit of code and way too many comments.
- Let's thank who have helped us in the Rust Community together!
- How hard is it to write a front end for a more complex language like Rust or Kotlin?