Rust


Learning


The language & its features

Rust vs Other Languages

Ownership

Concurrency

Async/Await

Tokio

Unsafe

Macros


Error Handling

Reddit


Testing


Coverage


Development Tools

Editors

VS Code

Xi

Helix

Lapce

Zed

Cargo

Rust Analyzer


Debugging

GDB

LLDB

RR

RD


Observability

Logging

Simple minimal loggers

  • log A logging facade provides a single logging API that abstracts over the actual logging implementation. Libraries can use the logging API provided by this crate, and the consumer of those libraries can choose the logging implementation that is most suitable for its use case. In order to produce log output, executables have to use a logger implementation compatible with the facade. There are many available implementations to choose from. Executables should choose a logger implementation and initialize it early in the runtime of the program. Logger implementations will typically include a function to do this. Any log messages generated before the logger is initialized will be ignored.
  • env_logger A simple logger configured via environment variables which writes to stdout or stderr, for use with the logging facade exposed by the log crate.
  • simple_logger A rust logger that prints all messages with a readable output format. The output format is based on the format used by Supervisord.
  • simplelog simplelog does not aim to provide a rich set of features, nor to provide the best logging solution. It aims to be a maintainable, easy to integrate facility for small to medium sized projects, that find env_logger to be somewhat lacking in features. In those cases simplelog should provide an easy alternative.
  • pretty_env_logger A logger configured via an environment variable which writes to standard error with nice colored output for log levels.
  • stderrlog A simple logger to provide symantics similar to what is expected of most UNIX utilities by logging to stderr and the higher the verbosity the higher the log level. It supports the ability to provide timestamps at different granularities. As well as colorizing the different log levels.
  • flexi_logger A flexible and easy-to-use logger that writes logs to stderr and/or to files or other output streams. An easy-to-configure and flexible logger that writes logs to stderr and/or to files. It allows custom logline formats, and it allows changing the log specification at runtime. It also allows defining additional log streams, e.g. for alert or security messages.

Complex configurable frameworks

slog
  • slog Structured, contextual, extensible, composable logging for Rust. slog is a very complete logging suite for Rust. It is a core followed by many plugins such as term for terminal output, json for JSON output and more. slog is an ecosystem of reusable components for structured, extensible, composable and contextual logging for Rust. The ambition is to be The Logging Library for Rust. slog should accommodate a variety of logging features and requirements. If there is a feature that you need and standard log crate is missing, slog should have it.
  • slog-term: Unix terminal drain and formatter for slog-rs.
  • slog-json: Json formatter for slog-rs.
  • slog-atomic: Atomic run-time controllable drain for slog-rs. Using slog-atomic you can create a slog::Drain that can change behavior in a thread-safe way, in runtime. This is useful eg. for triggering different logging levels from a signal handler.
  • slog-scope: Logging scopes for slog-rs. slog-scope allows logging without manually handling Logger objects. Logging scopes are convenience functionality for slog-rs to free user from manually passing Logger objects around. A set of macros is also provided as an alternative to original slog crate macros, for logging directly to Logger of the current logging scope.
  • slog-async: Asynchronous drain for slog-rs v2.
  • slog-stdlog: Standard Rust log crate adapter to slog-rs.
  • slog-extlog: Add external logs (loggable objects), and for statistics tracking through those logs, for use with the slog ecosystem.
  • slog-syslog: Syslog drain for slog-rs.
  • slog-journald: Journald support for slog-rs. This is a straightforward journald drain for slog-rs. Journald and slog-rs work very well together since both support structured log data. This crate will convert structured data (that is, key-value pairs) into journald fields. Since journald field names are more restrictive than keys in slog-rs, key names are sanitized to be valid journald fields.
  • slog-bunyan: Based on slog-json, it will output json with bunyan defined fields.
  • slog-envlogger: Port of env_logger as a slog-rs drain. env_logger is a de facto standard Rust logger implementation, which allows controlling logging to stderr via the RUST_LOG environment variable. This is a fork of env_logger that makes it work as a slog-rs drain.
  • slog_derive: Custom derives for use with slog logging.
  • slog-example-lib: Example of a library using slog-rs
  • slog-kvfilter: Key values based filter Drain for slog-rs. Drain filtering records using list of keys and values they must have unless they are of a higher level than filtering applied. It can apply a negative filter as well that overrides any matches but will let higher level than filtering applied as well. This Drain filters a log entry on a filtermap that holds the key name in question and acceptable values Key values are gathered up the whole hierarchy of inherited loggers.
  • slog-perf: Performance and time reporting for slog-rs. This crate provides very useful tools for reporting performance metrics through slog.
  • slog-serde: Serde serialization adapter for slog-rs.
tracing.rs

Adaptors for other facilities

  • syslog: This crate provides facilities to send log messages via syslog. It supports Unix sockets for local syslog, UDP and TCP for remote servers. Messages can be passed directly without modification, or in RFC 3164 or RFC 5424 format.
  • android_log:
  • win_dbg_logger: A logger for use with Windows debuggers. Windows allows applications to output a string directly to debuggers. This is very useful in situations where other forms of logging are not available. For example, stderr is not available for GUI apps.

For WebAssembly binaries

  • console_log: A logger that logs to the browser's console. The feature set provided by this crate is intentionally very basic. If you need more flexible formatting of log messages (timestamps, file and line info, etc.) this crate can be used with the fern logger via the console_log::log function. The file and line number information associated with the log messages reports locations from the shims generated by wasm-bindgen, not the location of the logger call.

For embedded systems

  • defmt: defmt ("de format", short for "deferred formatting") is a highly efficient logging framework that targets resource-constrained devices, like microcontrollers.

Metrics

NewRelic

New Relic is a company which develops cloud-based software to help website and application owners track the performances of their services.

DataDog

Datadog is a monitoring service for cloud-scale applications, providing monitoring of servers, databases, tools, and services, through a SaaS-based data analytics platform.

Distributed Tracing

OpenTracing

OpenTelemetry

OpenTelemetry is an open source observability framework created when the Cloud Native Computing Foundation merged the OpenTracing and OpenCensus projects. There are a few crates implementing OpenTelemetry-related functionality. See Tokio tracing's related crate, tracing-opentelemetry, for example.

Jaeger

Zipkin

Honeycomb.io


Performance Engineering

Profiling

Causal Profiling

Performance Optimization


Command Line Applications

CLI Applications written in Rust

Argument Parsing

  • Rust by Example: Argument parsing
  • args An argument parsing and validation library designed to take some of tediousness out of the general 'getopts' crate.
  • arg_input ARGF-style input handling for Rust. Library functions to treat input files/stdin as if they were all a big stream.
  • argparse rust-argparse is command-line parsing module for rust. It's inspired by python's argparse module.
  • argparse-rs A simple argument parser, meant to parse command line input. It is inspired by the Python ArgumentParser.
  • argonaut A simple argument parser.
  • clap A full featured, fast Command Line Argument Parser for Rust.
  • structopt Parse command line argument by defining a struct. It combines clap with custom derive.
  • clap-verbosity-flag Easily add a --verbose flag to CLIs using Structopt
  • please-clap Pattern-match against Clap subcommands and arguments.
  • thunder Zero-boilerplate commandline argument parsing in Rust. Write simple commandline applications in Rust with zero boilerplate. Bind Rust functions to CLI functions and options with macros. This crate uses clap.rs for the actual argument parsing.
  • getopts A Rust library for option parsing for CLI utilities.
  • clioptions A very thin wrapper for command line arguments in Rust.

Input

  • trompt A simple prompting library for rust.
  • promptly Simple, opinionated CLI prompting helper.
  • linenoise-rust A minimal, zero-config, BSD licensed, readline replacement.
  • dialoguer A command line prompting library.

Output

  • cursive A TUI (Text User Interface) library focused on ease-of-use. It uses ncurses by default, but other backends are available.
  • tui-rs A library to build rich terminal user interfaces or dashboards. The library itself supports four different backends to draw to the terminal. You can either choose from: termion, rustbox, crossterm, pancurses.
  • clicolors-control A utility library for Rust that acts as a common place to control the colorization for CLI tools.
  • colorizex
  • pbr Terminal progress bar for Rust, inspired from pb, support and tested on MacOS, Linux and Windows.
  • yapb Lightweight, pure, and unopinionated Unicode progress visualization
  • indicatif A Rust library for indicating progress in command line applications to users. This currently primarily provides progress bars and spinners as well as basic color support, but there are bigger plans for the future of this!
  • progress progress is meant to be a set of useful tools for showing program running progress (as its name) and steps.
  • fui Add CLI & form interface to your program.
  • text-tables A terminal/text table prettifier with no dependencies. This library provides very simple table printing using text characters. It has no dependencies besides std.
  • termtables An ASCII table generator.
  • prettytable-rs A library for printing pretty formatted tables in terminal.
  • treeline A library for visualizing tree structured data.

Error Handling

  • clierr Non-panicking error handling for small CLI scripts.
  • userror User-facing error messages for command-line programs.

Other

  • assert_cli: Test CLI applications. This crate checks the output of a chile process is as expected.
  • carboxyl Library for functional reactive programming
  • cargo_cli Create a command line interface binary with some common dependencies ((clap || docopt) and error_chain)
  • clams Clams help building shells
  • clin Command completion desktop notifications
  • crossterm A crossplatform terminal library for manipulating terminals.
  • foropts An argument-parsing iterator
  • lockfile Create lockfiles that remove themselves when they are dropped
  • quicli Quickly build cool CLI apps in Rust.
  • rust-clock Rust library to create a hh:mm:ss CLI clock from seconds or miliseconds.
  • texture Micro-engine for creating text-based adventures
  • tomlcli Pretty print and query TOML files
  • unixcli Helper library for writing unix command line utilities in Rust
  • yacli Library for creating CLI tools with a look and feel similiar to Cargo

Configuration Management


Interop

Serializing/Deserializing

Serde

Porting from C to Rust

C

Erlang & Elixir

Python


Algorithms

Combinatorics

Sorting

Searching

Hashing

Judy Arrays

Graphs

Evaluation Graphs

  • nannou-org/gantz A crate for creating and evaluating executable directed graphs at runtime. In other words, gantz allows users to compose programs described by interconnected nodes on the fly.

Probabilistic Data Structures

State Machines


Entity Component Systems

SPECS

Legion

hecs

Bevy ECS

Bevy ECS is a fork of hecs which in turn is a trimmed down version of Legion.


Games

Amethyst

GGEZ

Piston

Bevy

Rapier

Roguelikes


Graphics

Nannou


User Interfaces

Druid


Storage & Data Bases

Sled

TiKV

TiDB

Noria

Apache Arrow

Timely & Differential Dataflow


Tantivy

Sonic

Meilisearch


Operating Systems

TockOS

Redox


Cloud

AWS


Embedded


Cross Compiling


Programming Language Technology

Parsing

LARLPop

Nom

Menhir

Pratt Parsers

Chumsky

Tree Sitter


LLVM


Rustc Compiler

Rust Compilation Speed

Cranelift

GCC-Rust

Notes

Q
  is there a way to pass an enum's variant as argument (somehow)?
  I have a recursive enum, like: enum Rec { V1, V2(Box<Rec>, Box<Rec>) }

  If I am in function A, I have a Rec r, but I know for a fact that it matches variant V2, how can I declare a function that only takes V2's?
  It's very annoying to always have to test whether my input Rec matches V2, I would like to do that from the type system pov
  instead of just always assert at the beginning of the function that only takes V2
  I mean, basic polymorphism I guess.
  I've seen solutions saying to have an extra struct with the contents of that variant to make a type out of it, and then the variant just wraps that struct.

A
  usually an extra struct and then fn {as,into}_v2(self) -> Option<V2Data> functions are quite common so you can do

  let r = Rec::V2(..);
  if let Some(v2) = r.as_v2() {
     v2.do_stuff()
  }