Crate of the Week

Self nominating double-ended-peekable.

double-ended-peekable is a tiny no-std crate that combines the concepts of Peekable and DoubleEndedIterator, in order to easily peek from both the front and the back of an iterator.

1 Like

Self-nominating

sosecrets-rs, secrets management with compile time guarantees that each secret is not exposed more than a certain integer number of times. Each secret when exposed is branded with a unique type that ensures has an invariant lifetime.

Secret<T, MEC: typenum::Unsigned, EC, typenum::Unsigned> uses the typenum crate to enable compile time counting of the number of exposure of the secret and if EC is greater than MEC, the program would not compile.

Here is an example of how one can use it:

use sosecrets_rs::{
  prelude::*,
  traits::ExposeSecret,
};
use typenum::U2;

// Define a secret with a maximum exposure count of 2
let secret = Secret::<_, U2>::new("my_secret_value".to_string());

// Expose the secret and perform some operations with the exposed value; secret has been exposed once: `EC` = 1, `MEC` = 2;
let (next_secret, exposed_value) = secret.expose_secret(|exposed_secret| {
    // `exposed_secret` is only 'available' from the next line -------
    assert_eq!(&*exposed_secret.as_str(), "my_secret_value"); //     ^
    // Perform operations with the exposed value                     |
    // ...                                                           v
    // to this line... -----------------------------------------------
});

Hi!

I would like to self-nominate embedded-cli. It's a library that makes it easy to create CLIs on embedded devices. It has clap-like derive macro to build commands with enums and supports autocompletion, help, history, options and subcommands.
Example running on Arduino Nano:
Arduino Demo

3 Likes

Hello,
I'd like to self-nominate rphonetic, a Rust port of Apache commons-codec phonetic algorithms.

Disclosure: bkmr has been crate of the week already (Crate of the Week - #1159 by sysid).

Why look at it again?

Fast CLI bookmark manager now got semantic search:

  • it understands the semantics of your search intention, not only keywords
  • find matches via OpenAI embeddings
  • and still being (relatively) fast...

Hi!

Self-nominating microflow-rs, a robust and efficient TinyML inference engine for embedded systems.

With MicroFlow, it’s possible to locally run AI models on embedded systems. MicroFlow uses a compiler-based approach, making it possible to efficiently use the memory by pre-processing the model and statically allocating on the stack only.

MicroFlow has been tested with multiple MCUs and model architectures, including a speech command recognizer (TinyConv) on an 8-bit ATmega328 (Arduino Uno), a person detector (MobileNet v1) on an ESP32, and more.

Self-submitting Kind, a crate which makes it easier to wrap UUID in safe and visibly typed identifiers from Rust to the database and to the REST APIs.

I wrote a blog post explaining the motivation and usage: A Kind Introduction

Submitting Knope, a CLI tool that we're using to replace the semantic-release npm package everywhere we can. The maintainer is helpful and responsive, and the tool can handle fairly complex workspace configurations.

Self submitting GitHub - orottier/web-audio-api-rs: A Rust implementation of the Web Audio API, for use in non-browser contexts

It's a complete implementation of the Web Audio API specification, which you can now run in Rust or with our related NodeJS-bindings project. This means you can utilize your web audio expertise to build complex audio graphs in Rust, or make your game engine cross platform (web vs native) without rewriting your audio stack. It has been benchmarked against the browser implementations and we are also running the Web Platform Testsuite on it to verify correctness.

1 Like

Submitting priority-queue, it's not mine but I like the crate :slight_smile:

2 Likes

I'm self-submitting srgn, which is most easily thought of as a mix of tr, sed, rip-grep and tree-sitter:

  • like tr and sed, it manipulates text,
  • supporting modern regex,
  • while providing low-barrier access to semantic programming language constructs, thanks to its grammar awareness through tree-sitter. It supports a number of languages with a number of possible queries each. The functionality essentially translates command-line options to pre-made tree-sitter queries.

For example, one can turn the following Python (more languages and other semantic queries [literal strings, comments, import names, ...] are supported):

"""GNU module."""

def GNU_says_moo():
    """The GNU -> say moo -> βœ…"""

    GNU = """
      GNU
    """  # the GNU...

    print(GNU + " says moo")  # ...says moo

into

"""GNU πŸ‚ module."""

def GNU_says_moo():
    """The GNU πŸ‚ -> say moo -> βœ…"""

    GNU = """
      GNU
    """  # the GNU...

    print(GNU + " says moo")  # ...says moo

through an invocation of

cat gnu.py | srgn --python doc-strings 'GNU' 'GNU πŸ‚'

where the edits are limited to documentation strings only. The diff highlights the effect:

- """GNU module."""
+ """GNU πŸ‚ module."""

  def GNU_says_moo():
-     """The GNU -> say moo -> βœ…"""
+     """The GNU πŸ‚ -> say moo -> βœ…"""

      GNU = """
        GNU
      """  # the GNU...

      print(GNU + " says moo")  # ...says moo

The crate provides both a native library and a CLI (cargo install srgn, a thin wrapper around the library).

5 Likes

I'm nominating heck, a no_std crate to perform case conversions.

The new 0.5 version just came out, exactly when I needed :heart:. Thank you @jplatte.

3 Likes

I'm self-nominating ratatui-splash-screen, a Ratatui widget for turning any image into a splash screen in your terminal.

GitHub - Kobzol/cargo-wizard: Cargo subcommand for configuring Cargo projects for best performance. Cargo subcommand for configuring Cargo profiles for fast compilation, fast runtime or minimal binary size. (self-nomination)

5 Likes

Nominating GitHub - drifting-in-space/plane: A distributed system for running WebSocket services at scale., a distributed system for running WebSocket services at scale. Not a self-nomination, just a crate I find super interesting.

Nominating

which made me chuckle.

7 Likes

Nominating GitHub - snowfoxsh/nestify, a Rust library offering a powerful macro to streamline the definition of nested structs and enums. Designed to improve code readability and maintainability. (I'm not the author, just have seen it on Reddit).

4 Likes

Self-nominating cargo-unfmt, which takes inconsistent code like this:

fn main() {
    let mut a = 0;
    let mut b = 1;
    for _ in 0..5 {
        let tmp = a;
        a = b;
        b = tmp + b
    }
    println!("{a}");
}

and produces pristine blocks like this:

fn main(){();let
mut a=0;;let mut
b=1;3;for _ in 0
..5{;let tmp=a;a
=b;();b=tmp+b}3;
println! ("{a}")
;if let _=(){};}
14 Likes

Nominating:

A library to track system architecture aspects :crab:

2 Likes

I would like to self-suggest a new crate of mine, called venndb. It is an append-only memory DB that you can make from any named-field script with a simple derive macro. Its primary use case is for high-intensive workloads where you typically have static data (read: write all at once at start of process) from which you query data all the time, using binary (read boolean) filters for the most part.

Crate can be found at: crates.io: Rust Package Registry

Docs can be found at: venndb - Rust

Usage example:

use venndb::VennDB

#[derive(Debug, VennDB)]
pub struct Employee {
    #[venndb(key)]
    id: u32,
    name: String,
    is_manager: bool,
    is_admin: bool,
    #[venndb(skip)]
    foo: bool,
    #[venndb(filter)]
    department: Department,
}

fn main() {
    let db = EmployeeDB::from_iter(/* .. */);

    let mut query = db.query();
    let employee = query
        .is_admin(true)
        .is_manager(false)
        .department(Department::Engineering)
        .execute()
        .expect("to have found at least one")
        .any();

    println!("non-manager admin engineer: {:?}", employee);
}

We use it in production ourselves already, but now that the first release is out on crates.io, I would love to have feedback from other users, as they might come up with use cases or problems we didn't consider yet ourselves.

Thanks in advance and take care.

2 Likes