r/rust
![impl Rust: WAV noise generator [video]](https://external-preview.redd.it/Dm8Yvjszz5WDlSenb7jiXbMSHGnHlreZTW1TMCMQnew.jpeg?width=320&crop=smart&auto=webp&s=8704be08edfc1ea093cd8d33aaa2d7e12e0179dc)

Conway's Game of Life is often my first real project when learning a new language. It was fun writing it in Rust.
I rebuilt search using physics instead of statistics. +18.5% NDCG@10. No ML. Yes its Open Source
BM25 is from 1994. Vector search is just nearest neighbor lookup. Every AI search product is one of those two things with a weighted sum on top.
I wanted to try something different so I built Resonance Search.
The idea: everything you can embed has gravity. So products, documents, code, images, database rows, whatever. Instead of a one-shot nearest neighbor lookup, your query actually moves through the space from gradient descent and settles into the deepest cluster of relevant results.
Scoring uses interference terms instead of linear addition so a result has to be strong across multiple signals at once to rank, it can't fake it by crushing just one.
The numbers on 50 real legal contracts, 980 chunks, 200 queries:
| Method | NDCG@10 |
|---|---|
| Resonance | 0.2751 |
| Linear Fusion | 0.2321 |
| BM25 | 0.1685 |
| Vector Only | 0.1103 |
+18.5% over linear fusion, you can run it yourself.
Pure Rust, zero ML at query time, sub-millisecond latency. AGPL open source.
(No this isn't AI Slop) and Yes I use Opus for assisting the Code/Comments:)
github dot com /Razshy/resonance-search
I built Drift: A cross-platform "AirDrop" for any OS using Rust and iroh
https://i.redd.it/dzk5l5ia72tg1.gif
Sharing files can be a frustrating problem. I often dislike Apple software, but AirDrop is often convenient for a quick transfer.
Tools like croc and LocalSend help, but they have their own problems like relying on relays for the actual data transfer or only working if both devices are on the exact same Wi-Fi network.
Thanks to iroh (https://github.com/n0-computer/iroh), I built an app in Rust & Flutter that can share files directly between two devices anywhere in the world. Just exchange a simple 6-digit code, and it establishes a direct, end-to-end encrypted connection between the devices to send files. iroh takes care of all the complex hole-punching magic needed to get it to work correctly across NATs.
It's still in the very early stages, but I am happy that the Rust ecosystem is so mature. I was able to build the core in Rust without having to worry about the low-level (and very complicated) details of connecting devices together (thanks again to the iroh developers!), and then link it effortlessly into a Flutter UI.
I have attempted to build this a few times over the years but always gave up due to the sheer number of things I needed to focus on to get it right! I am happy I could do it now. It still needs a lot of work but I had to share it here.
Do try it out and share your thoughts!
Are people using embedded-io and embedded-io-async?
Hi all,
Ive worked with embedded rust for the last year and a bit and I love it. The Embeded-Hal is so good and the portability of drivers is amazing.
Usually when I make an I2C driver I use the embedded-Hal traits and build it to them. This allows me to reuse the same driver across multiple microcontrollers, single board computers and my Mac.
However when I try to do this with a serial based device such as UART. There is no trait in the embedded-Hal for that. There is some in embedded-io but then popular crates such as serialport doesn’t support that trait and thus my driver doesn’t bind to that interface.
Am I missing something here? Any help would be great!

Lightweight OpenTelemetry Agent in Rust
Hey r/rust! I built a Rust-based OpenTelemetry agent with a configurable metrics pipeline and would love your feedback! Supports Windows and Linux, (builds for Solaris, but not tested)
https://github.com/observantio/ojo
Happy to discuss the internals, design decisions, or anything you think could be done better!

I built a Rust CLI that detects N+1 SQL/HTTP anti-patterns across services and scores their carbon impact
After a few years building Java/Spring microservices in enterprise settings (insurance, agriculture) I kept hitting the same N+1 queries that slip through code review because they span multiple services, redundant HTTP calls nobody notices until production latency spikes. Every project, same patterns, different stack.
I also have a background in environmental science (I founded and ran a scientific association for 3 years, organizing conferences with climate researchers from the IPCC and IPBES). So when I started thinking about an N+1 detector, I naturally wanted to quantify the environmental cost of wasteful I/O too, not just the latency impact.
Existing tools are either runtime-specific (Hypersistence Optimizer only works with JPA), heavy and proprietary (Datadog, New Relic), or don't correlate across services. So I built perf-sentinel: a lightweight Rust CLI that analyzes runtime traces and flags these patterns automatically regardless of language or ORM.
How it works:
It takes OpenTelemetry traces (or Jaeger/Zipkin exports) and runs them through a pipeline: ingest -> normalize -> correlate -> detect -> score -> report. Detection is protocol-level, it sees the SQL queries and HTTP calls your code produces, not the code itself. So it works the same whether you're using JPA, EF Core, SeaORM or raw SQL.
Quick demo (30 seconds):
cargo install perf-sentinel
perf-sentinel demo
Output:
=== perf-sentinel demo ===
Analyzed 17 events across 2 traces in 0ms
Found 3 issue(s):
[WARNING] #1 N+1 SQL
Service: order-svc
Endpoint: POST /api/orders/42/submit
Template: SELECT * FROM order_item WHERE order_id = ?
Hits: 6 occurrences, 6 distinct params, 250ms window
Suggestion: Use WHERE ... IN (?) to batch 6 queries into one
[WARNING] #2 N+1 HTTP
Template: GET /api/users/{id}
Hits: 6 occurrences
Suggestion: Use batch endpoint with ?ids=...
[CRITICAL] #3 Slow SQL
Template: SELECT * FROM order_status WHERE order_id = ?
Suggestion: Consider adding an index or optimizing query
--- GreenOps Summary ---
Total I/O ops: 17
Avoidable I/O ops: 10
I/O waste ratio: 58.8%
Est. CO₂: 0.000108 g
Quality gate: FAILED
What it detects:
- N+1 SQL queries (same template, different params, tight time window)
- N+1 HTTP calls across services
- Redundant queries (exact duplicates)
- Slow recurring queries (with p50/p95/p99 across traces)
- Excessive fanout (parent span spawning too many children)
What makes it different:
- Protocol-level, not runtime-level. Works with any language/ORM that emits OTLP traces. Unlike Hypersistence Optimizer (JPA only) or Datadog (shows queries in trace view but doesn't auto-detect N+1 patterns).
- Built-in GreenOps scoring: every finding includes an I/O Intensity Score and optional gCO2eq estimate, aligned with the SCI model (ISO/IEC 21031:2024).
- CI-native:
perf-sentinel analyze --ciwith configurable quality gate and exit codes. If someone introduces an N+1 the pipeline breaks. - SARIF export for GitHub/GitLab code scanning integration.
- Imports Jaeger and Zipkin trace exports directly, no infra changes needed.
perf-sentinel explain --trace-id abc123shows a tree view of a trace with findings annotated inline.perf-sentinel inspectopens a TUI to browse findings interactively.- Can cross-reference with
pg_stat_statementsdata for DB-side validation.
Numbers:
- Single binary: ~4 MB (macOS arm64), ~5 MB (Windows), < 10 MB (Linux static)
- < 5 MB RSS idle, < 20 MB under load (10k traces)
- > 100k events/sec throughput
I've been dogfooding it on a personal polyglot microservices project (Java Spring WebFlux + Virtual Threads, Quarkus/GraalVM Native, C# .NET NativeAOT, Rust Actix, all talking to each other) and it caught real N+1s across all stacks without any language-specific configuration.
Still early (v0.2.0) and I would really appreciate feedbacks on:
- Detection heuristics: are the defaults sane? False positive rate?
- CLI UX and output format
- Anti-patterns you'd want detected that aren't covered
cargo install perf-sentinel or grab a binary from the releases page (Linux amd64/arm64, macOS arm64, Windows amd64).

Learn Rust Basics By Building a Brainfuck Interpreter
blog.sheerluck.dev
foxguard: rust + tree-sitter + security scanner = 150x faster than Semgrep
Ladies and gentlemen,
I'm officially open-sourcing foxguard, a security scanner (SAST) that uses tree-sitter for AST parsing and rayon for parallelism.
Most security scanners take 10-30s because they're written in Python/Java. foxguard finishes the same scan in 0.03s because there's no runtime overhead > just a native binary.
> tree-sitter for multi-language AST parsing (JS/TS, Python, Go, Ruby, Java, PHP, Rust, C#, Swift)
> rayon for parallel file scanning
> Each rule is a struct implementing a Rule trait, walks the AST with a callback
> the Semgrep-compatible YAML loader is basically a mini pattern matcher on top of tree-sitter
- Binary is ~20MB, no dynamic linking headaches
It also scans itself in CI (dogfood job) and catches its own Rust code for unsafe blocks, unwrap usage, and hardcoded secrets.
npx foxguard .
Just finished the Rust Book what projects should I build next to actually solidify my knowledge?
Hey everyone! 👋
I recently finished the Rust book and I mean really finished it. Since there were no online resources available in my native language, I not only read through the entire book but also digitized all the written content alongside the code examples as inline comments. It was a big undertaking, but I'm glad I did it.
I should mention I'm someone with ADHD and a bit of a perfectionist streak, which means that when I'm focused on learning something, I really can't split my attention across multiple things at once. So throughout my reading journey, I kept my projects very minimal and intentional, rather than diving into serious builds. But now that the book is done, I'm excited to change that!
For context on my background: I do have some prior programming experience, though it's been fairly limited mostly basic backend work, and desktop/CLI tools built with Python, usually automation-oriented stuff. I work at a digital marketing company, and I approach programming and CS purely as a hobby. That said, it's genuinely paid off at work the company's tech infrastructure was quite lacking when I joined, and I've slowly been modernizing and automating their systems, which has also helped me stand out there.
Now, to my actual question:
What beginner-friendly Rust projects would you recommend to solidify my knowledge and deepen my practical understanding?
I've thought about building small CLI tools with clap, but I worry those might just end up being automation scripts or mini utilities —fun, but not necessarily pushing my Rust knowledge further. Before I even properly started learning Rust, I did build a rough CLI tool that analyzed code and added inline comments in appropriate places, but it was pretty basic and I wouldn't call it a great showcase.
I'd really love to hear your suggestions especially projects that would help me grow specifically as a Rust developer, not just as a programmer in general. Any ideas are warmly welcome!

simd-bp128 integer compression library
I have tried implementing simd-bp128 integer compression algorithm (took help of AI wherever I needed)
Please go through the repo and share your opinion.
so far only Scalar and SSE4.1 backend have been implemented. (Avx2 and Avx512 maybe in future need to study this hard)
Crates : https://crates.io/crates/packsimd
im looking for guidance to properly benchmark this (since most of benchmark result is not stable)
Thank you
Rust programming language 3rd edition physical book issues
Hello,
I wanted to learn Rust and to support the language, so I took advantage of the Pi day discount to order the Rust programming language book (3rd Edition) from the No Starch Press website.
My order has been pending for almost 3 weeks now.
I've also contacted them because I put the wrong delivery address (I hadn't noticed my previous address was presaved) but I've received no answer.
I've seen other people in this sub have successfully received this book, so I was wondering if that's normal (?) or how you've done it / contacted them, please ?
I live in the EU, in case this matters.
Thanks for reading, happy Easter

testx — auto-detecting test runner that replaces "cargo test", "pytest", "go test", "npx jest", etc. with one command
Instead of remembering the test command for each project, just run testx. It scans project files to detect the language and framework, then runs the appropriate test command with structured output.
Works with 11 languages out of the box. Also does CI sharding, watch mode, retries, and can output JSON/JUnit/TAP.
cargo install testx-cli

testx a universal test runner for 11 languages, built in Rust
hey all, been working on this for a while and finally put it out there.
testx is a test runner where you just run testx in any project and it figures out the language, framework, package manager, all of it. no config needed.
currently works with rust, go, python, js/ts, java, c++, ruby, elixir, php, dotnet, and zig. it picks up on things like config files, test dirs, lock files etc to decide what framework you're using — not just checking if a single file exists.
some stuff it does:
- json, junit xml, tap output besides the default pretty output
- ci sharding (
--partition slice:1/4) - stress test mode for finding flaky tests
- watch mode, retries, parallel runs
- custom adapters through toml config
still early (v0.1) so definitely rough around the edges. would really appreciate any feedback, especially around the detection logic and the rust adapter specifically.
> cargo install testx-cli

How We Built Postgres Compatibility in Rust: pgwire and DataFusion
greptime.comSSHack - a ctf platform that is accessed over ssh. (built with rust)
I've been getting into cybersecurity, and that means that I have done some ctf challenges. So when I got inspired by "terminal.shop" (the ssh coffee shop made by teej_dv and ThePrimeagen) and i wanted to build a "ssh application" I decided to build a ctf platform (like ctfd but in the terminal, over ssh). So this is what I have been building for the last 2~3 weeks and I finally feel like it is in a stage where I can share it and actually get useful feedback in order to continue improving it.
The github link is: https://github.com/d-z0n/SSHack and there are some basic instructions for setting the server up in the readme. I have a lot of plans to improve this further, so see this as a first draft (it should still be enough to host a simple ctf for fun with friends or at school in its current state)
I have also setup a really simple demo ctf, to access it run ssh "ctf.dz0n.com" -p 10450 (port 10450 is used by random for my ngrok tunnel, actual port is 1337 by default but this is configurable).
Anyways, if you are hosting a ctf, feel free to use this as your platform and please create an issue on github if you experience any problems / have any questions. In the meantime I will continue development. Happy Easter!
Adding a constraint to a base trait breaks a derived trait?!
I've been using Rust for years and I've encountered a new problem that sure feels like an unnecessary language limitation, where adding a constraint to a trait breaks another trait that's derived from it, for example:
trait AddToI32
where
Self: Sized,
Self: Add<i32, Output = Self>,
i32: Add<Self, Output = Self>, // this line causes an error
{}
trait Subtrait
where
Self: AddToI32,
i32: Add<Self, Output = Self>, // this line makes the error go away
{}
My thinking is that the offending trait bound in AddToI32 should result in the bound i32: Add<Self, Output=Self> being propagated to Subtrait, but that's not what happens. I can kind of see the logic that adding a constraint with Self on the left can't magically add a constraint with i32 on the left, but it would be so convenient!
Can anyone offer insight into what I'm trying to do should or should not work?
Playground link here.