Crate of the Week

https://github.com/aftix/bacon

A nice crate implementing some numeric algorithms.

StructOpt if you ever want easy commandline parser

Yes, StructOpt is cool as is CLAP. Looks like both will merge in a future version of CLAP.
StructOpt was already crate of the week in issue 186.

broccoli: A 2D collision detection crate.

This looks nice, I wonder how it compares to ncollide.

https://github.com/mersinvald/aquamarine

Allows you to have some nice diagrams in your docs.

A Rust macro for writing regex pattern matching.

Usage

fn main() {
    let text1 = "2020-01-01";
    regexm::regexm!(match text1 {
        r"^\d{4}$" => println!("y"),
        r"^\d{4}-\d{2}$" => println!("y-m"),
        r"^\d{4}-\d{2}-\d{2}$" => {
            let y_m_d = "y-m-d";
            println!("{}", y_m_d);
        }
        _ => println!("default"),
    });
}

Pals, Processes' Arguments LiSt

The pals command dumps all running processes' pid,ppid,command name,arguments and prints JSON to reflect the process trees.

Example of output

[{cmd: "alpha", pid:105, args:[ "alpha" ], subs:[
  {cmd: "beta", pid:107, args:[ "beta", "--help" ]},
  {cmd: "gamma", pid:106 }]},
 {cmd: "lorum", pid:102, subs:[
  {cmd: "ipsumipsum", pid:104, args:[ "ipsumipsumipsum", "--name-too-long" ]}]}]

The pals library provides pals() which returns a list of process trees.

Example of API usage

use pals::{Proc, pals};

pals().map( |proc_list| {
    fn assert_ppid_is_parent_pid( proc: Proc ) {
        proc.parent()
            .map( |parent| assert_eq!( parent.pid, proc.ppid ));
        proc.children()
            .for_each( |subproc| assert_ppid_is_parent_pid( subproc ));
    }

    proc_list
        .children()
        .for_each( |proc| assert_ppid_is_parent_pid( proc ))
}).unwrap();

fancy-regex is really cool. It implements backtracking and look-around for regular expressions while delegating as much as possible to the regex crate.

In essence, it is a backtracking VM (as well explained in Regular Expression Matching: the Virtual Machine Approach) in which one of the "instructions" in the VM delegates to an inner NFA implementation (in Rust, the regex crate, though a similar approach would certainly be possible using RE2 or the Go regexp package). Then there's an analysis which decides for each subexpression whether it is "hard", or can be delegated to the NFA matcher. At the moment, it is eager, and delegates as much as possible to the NFA engine.

iai looks really nice. From the README:

Iai is an experimental benchmarking harness that uses Cachegrind to perform extremely precise single-shot measurements of Rust code.

Rocket is a great crate!
Really old thread, surprised to see it still going!

These crate nominations are looked through to find a "crate of the week" to highlight in the "this week in rust" community newsletter.

This thread and "quote of the week" are special in the same way :slight_smile:

Small but useful: I recently discovered the thread-io crate, which makes it easy to put a reader into a background thread so that processing can happen concurrently. The win for this for me was to have one thread decoding a zstd-compressed file while the main thread parsed its contents using the csv crate. It sped things up by about 1.6x parsing a large csv file (8.7GB compressed, 79GB uncompressed) with very modest code changes.

Lever: library for writing transactional systems.

There are some situations, when you have an existing api and someone asks for a swagger.
So opg is simple library for generating OpenAPI 3.0 docs from structs. It parses serde attributes, so you only need to specify OpenAPI related stuff.

salak is a layered configuration loader with zero-boilerplate configuration management. Aim to simplify configuration parsing codes.

cns (Crate Name Search) is a handy terminal based interface to search for Rust crates. I like using it to quickly:

  • Copy the crate dependency line for Cargo.toml to the clipboard
  • Open the crate docs or repo in a browser

Camino is an API mirroring std::path, but UTF-8 encoded instead of using OsString.

Sorceress is a Rust environment for sound synthesis and algorithmic composition, powered by SuperCollider. It provides:

  • A real-time audio synthesis engine
  • A massive library of unit generators
  • Audio I/O with your operation system and sound card

bset: "Fast and compact sets of bytes or ASCII characters"

ibig: "A big integer library in Rust with good performance."