r_rust🦀 – Telegram
r_rust🦀
62 subscribers
565 photos
65 videos
36.1K links
Posts top submissions from the rust subreddit every hour.

Powered by: @reddit2telegram
Chat: @r_channels
Download Telegram
Hey Rustaceans! Got a question? Ask here (53/2025)!

Mystified about strings? Borrow checker has you in a headlock? Seek help here! There are no stupid questions, only docs that haven't been written yet. Please note that if you include code examples to e.g. show a compiler error or surprising result, linking a playground with the code will improve your chances of getting help quickly.

If you have a StackOverflow account, consider asking it there instead! StackOverflow shows up much higher in search results, so ahaving your question there also helps future Rust users (be sure to give it the "Rust" tag for maximum visibility). Note that this site is very interested in question quality. I've been asked to read a RFC I authored once. If you want your code reviewed or review other's code, there's a codereview stackexchange, too. If you need to test your code, maybe the Rust playground is for you.

Here are some other venues where help may be found:

/r/learnrust is a subreddit to share your questions and epiphanies learning Rust programming.

The official Rust user forums: https://users.rust-lang.org/.

The official Rust Programming Language Discord: https://discord.gg/rust-lang

The unofficial Rust community Discord: https://bit.ly/rust-community

Also check out last week's thread with many good questions and answers. And if you believe your question to be either very complex or worthy of larger dissemination, feel free to create a text post.

Also if you want to be mentored by experienced Rustaceans, tell us the area of expertise that you seek. Finally, if you are looking for Rust jobs, the most recent thread is here.

https://redd.it/1pygtfj
@r_rust
What's everyone working on this week (53/2025)?

New week, new Rust! What are you folks up to? Answer here or over at rust-users!

https://redd.it/1pygulr
@r_rust
Simple Housekeeping (Bash) Script for Rust Projects

I have a tendency to create a dedicated directory for a topic that I'm currently learning in Rust. After several years, the number of directories has grown to hundreds and with that, came the storage space choke. Taking advantage of year-end holiday, I developed this simple bash noscript to handle the housekeeping better. I wrote about this experience in my blog: Simple Housekeeping Script for Rust Projects

I hope it could be useful for others. Please have a look and I'm happy to hear your feedback!

https://redd.it/1pyh2uq
@r_rust
Hauchiwa 0.9: A type-safe, graph-based static site generator library

Hauchiwa is a flexible static site generator library designed for those who want to build their own custom SSG pipeline in Rust. Version 0.9 brings a massive evolution, I have completely rewritten the core architecture to use a graph for build tasks.

What's new in 0.9?

* Hauchiwa now builds a dependency graph (DAG) of your build pipeline. This allows for precise parallel execution and smart incremental rebuilds.
* When a task produces data (like parsed Markdown or compiled CSS), it returns a Handle<T>. You pass this handle to dependent tasks. If the types don't match, your build code won't compile.
* A new macro makes wiring up these dependencies ergonomic and clean.
* Support for `importmap`, and improved support for Svelte SSR via Deno & Esbuild.

Why use Hauchiwa?

If you are tired of rigid frameworks (Hugo/Jekyll/Zola) or fighting with complex config files, Hauchiwa lets you define your build logic in Rust. You define the inputs (loaders), transformations (tasks), and dependencies (handles). Hauchiwa handles the caching, parallelism, and watching.

A taste:

let mut config = Blueprint::<()>::new();

// 1. Load Markdown
let posts = config.load_documents::<Post>("content/**/*.md")?;

// 2. Render pages (depends on `posts`)
hauchiwa::task!(config, |ctx, posts| {
let mut pages = Vec::new();
for post in posts.values() {
pages.push(Output::html(&post.path, render(&post)));
}
Ok(pages)
});

config.finish().build(())?;

I'd love to hear your feedback!

* [https://crates.io/crates/hauchiwa](https://crates.io/crates/hauchiwa)
* [https://docs.rs/hauchiwa/latest/hauchiwa/](https://docs.rs/hauchiwa/latest/hauchiwa/)

https://redd.it/1pyjg24
@r_rust
Looking for good quic libraries with http3 support in Rust.

Well I'm building an experimental http3 framework using Rust's h3 crate followed by Quinn rs especially for JS Runtime since they don't have http3 support yet. Therefore there is no well established articles or documents regarding quic, udp servers and http3 protocols. As an experienced engineer I have seen a lot of corporates networks were blocking udp ports just because they cannot introduce the MITM breach thing during quic hand shakes. Because every single packets gets encrypted leaving with no traces even headers are encrypted. Tbh this might sound fantastic that quic servers are safer than tcp. But it comes up with a huge cost. Running this rustls crypto on both sides each request become more cpu intensive ultimately you get best end to end protection with increased max cpu usage. Well I have been using oha to test my http3 server. It gave very low Rps compared to years of optimized tcp stacks like axum and rocket.

Coming back to my project it's already in alpha stage I moved those rust native addons to node Js. It worked really well even on deno and bun. I have implemented stream support by pulling h3-Quinn internals and forged like express ergonomics res.stream(chunks) for streaming large files seamlessly. My framework actually performed well compared to golang's - h3 library. But haven't open sourced it yet because people barely showing interest they just switch to tcp stacks without knowing the underlying vulnerabilities.

Most of the corporates hides this quic related projects just by phrasing udp ports are unsafe vulnerable to attacks. I would like to seek help all regarding benchmarking http3 Rust libraries plz do share me rust h3 / quic libraries.

https://redd.it/1pymhdv
@r_rust
NeatCLI - fast file organizer written in Rust

Hey all,

Been working on this for a while - a CLI tool to organize messy folders. My Downloads was getting out of control so I built this.

Basic usage:

neatcli organize ~/Downloads --by-type --execute

Creates folders like Images/, Documents/, Videos/ and sorts everything automatically.

Other stuff it does:

duplicate detection (content hashing)
similar image finder (perceptual hashing)
watch mode - auto-organize new files as they appear
EXIF sorting for photos (by camera, date taken)
audio metadata for music (by artist, album)
PDF text search

Wrote it in Rust because I got tired of slow Python tools and dealing with pip/virtualenv stuff. Single binary, around 9MB.

Install:

cargo install neatcli
# or
brew install patchybean/tap/neatcli

GitHub: https://github.com/patchybean/neatcli

Open to feedback - especially what's missing or broken.

https://redd.it/1pyqflv
@r_rust
Suggest rust apps with very few or none dependencies (want to test mrustc)

Long story short, I am trying to get rust working on a platform where rustc is broken. I think I have fixed mrustc compiler for it, but I need some realistic cases to test whether it produces usable executables (beyond helloworld and ternimal). Looks like its minicargo does not have a mechanism to resolve multiple dependencies automatically, and given dependency hell in Rust, I would prefer to avoid writing build sequences by hand and fixing gazillion of libs (very likely something will be broken for a platform in question) at this stage. So it will be helpful to know what can be compiled with absolutely minimal dependencies and shown to work or not work correctly.

https://redd.it/1pys7is
@r_rust
sockudo-ws: Ultra-fast WebSocket library that outperforms uWebSockets

I've been working on a high-performance WebSocket library for Rust and wanted to share it with the community.



Benchmarks against uWebSockets:



\- 512 bytes, 100 conn: 232,712 msg/s vs 227,973 msg/s (1.02x faster)

\- 1024 bytes, 100 conn: 232,072 msg/s vs 224,498 msg/s (1.03x faster)

\- 512 bytes, 500 conn: 231,135 msg/s vs 222,493 msg/s (1.03x faster)

\- 1024 bytes, 500 conn: 222,578 msg/s vs 216,833 msg/s (1.02x faster)



Key features:



\- SIMD acceleration (AVX2/AVX-512/NEON) for frame masking and UTF-8 validation

\- Zero-copy parsing

\- permessage-deflate compression

\- Split streams for concurrent read/write

\- Passes all 517 Autobahn test suite cases

\- Simple API with ws.send() style



N-API bindings for Node.js coming soon.



Used in Sockudo (https://github.com/RustNSparks/sockudo), a Pusher-compatible WebSocket server.



GitHub: https://github.com/RustNSparks/sockudo-ws



Feedback welcome!

https://redd.it/1pywd6j
@r_rust
Build a database from scratch in rust

Hi, I have coded some very small applications using rust and am newbie in rust but I have been trying to read this book https://build-your-own.org/database and start implementing it step by step in rust, but I feel I don't understand it well, and I am not sure that it's dumb to suddenly fall myself in such complex topic, my goal is to becoming from being a frontend engineer to software engineer and as I love rust language I started coding in it, so I will be glad if anyone could give me some clue, thanks.

https://redd.it/1pyxitr
@r_rust
corroded: so unsafe it should be illegal

corroded is a library that removes everything Rust tried to protect you from.

It's so unsafe that at this point it should be a federal crime in any court of law.

But it's still blazingly fast 🗣️🦀🔥

Repo is here.

https://redd.it/1pz0edr
@r_rust
SymbAnaFis v0.4 - Symbolic differentiation in Rust

Hey r/rust! Back again with another update on SymbAnaFis, my symbolic math library.

Yes, I should be studying for my 5 exams instead of coding during the holidays. No, I will not be taking questions on my life choices. Happy New Year though! 🎄

# What it does

A symbolic math library for **differentiation, simplification, and fast numerical evaluation**:

* Symbolic derivatives with chain rule, product rule, quotient rule
* 50+ built-in functions (trig, hyperbolic, exponential, gamma, bessel, erf, etc.)
* Algebraic simplification (trig identities, power rules, constant folding)
* Compiled bytecode evaluator with SIMD batch evaluation
* Python bindings via PyO3



use symb_anafis::{diff, symb};
// String API
let result = diff("sin(x)*exp(-x^2)", "x", &[], None)?;
// → "cos(x)*exp(-x^2) - 2*x*sin(x)*exp(-x^2)"
// Type-safe API (Symbol is Copy!)
let x = symb("x");
let expr = x.sin() * (-x.pow(2.0)).exp();

What's new in v0.4.0/v0.4.1

* N-ary AST (Sum/Product instead of binary tree)
* Symbol interning, SIMD batch eval, Rayon parallelism
* log(base, x) arbitrary base logarithms
* Dual numbers for automatic differentiation
* Switched to Apache 2.0 license

# Where it's actually good:

* **Parsing**: 1.2-1.7x faster than Symbolica
* **Raw differentiation**: 1.1-2.4x faster
* **Compilation to bytecode**: 3-290x faster
* **Python bindings** that actually work

# Where it's not so good:

* **Evaluation speed**: Symbolica is 1.3-2.6x faster for small expressions
* **Full pipeline**: Symbolica wins by 1.06-3.2x when including simplification

# Trade-offs:

* **Simplification is slower** but does deep AST restructuring (trig identities, algebraic normalization, power rules). Symbolica only does light term collection. Different goals — I prioritize simplified output over speed, that's why skip\_simplification defaults to false.
* **Evaluator is a stack-based bytecode interpreter**, while Symbolica generates native C++/ASM/SIMD code. Would love help optimizing this if anyone has experience with fast interpreters or JIT compilation.

[Full benchmarks here](https://github.com/CokieMiner/SymbAnaFis/blob/main/benches/BENCHMARK_RESULTS.md)

# Development

I use AI to help with development — I'm a 2nd year physics student learning Rust, not a 10x dev. Everything goes through clippy and a 837-test suite.

# What I'd love help with:

* **Simplification rules**: I'm not an encyclopedia, definitely missing identities
* **Evaluator performance**: Help optimizing the bytecode interpreter (or moving to JIT?)
* **Edge cases**: Physics expressions that break things

# Links

[GitHub](https://github.com/CokieMiner/SymbAnaFis) | [crates.io](https://crates.io/crates/symb_anafis) | [PyPI](https://pypi.org/project/symb-anafis/)

Now if you'll excuse me, I have thermodynamics to avoid studying.

https://redd.it/1pyxxby
@r_rust
Published my first Crate: Sql-Docs

I was recently given a reason to finally publish a crate to crates.io and am proud to announce Sql-Docs, a crate for parsing comments preceding SQL statements in `sql` files. This was a lot of time, mostly polishing what I made and several revisions to try and make sure I was following the expectations of a published crate.


Happy to share it with the community!

https://redd.it/1pz97fm
@r_rust
Announcing err_trail: A generic logging interface

err_trail is a generic logging interface over the tracing, log, defmt crates. It use to be a part of the error_set crate as a feature flag, but I recently broke it into a separate crate. I thought I would post about it here in case anyone else finds it useful.

All methods and macros in the crate work with the generic backends. Which makes it perfect for libraries, since the downstream chooses the backend. If no backend is selected they are compiled away.

### Macros

Familiar error!, warn!, info!, debug!, trace! macros exist to log in a way similar to the built in rust format! macro.

use err_trail::{error, warn, info, debug, trace};

fn main() {
error!("An error occurred: {}", "disk full");
warn!("This is a warning: {}", "high memory usage");
info!("Some info: {}", "service started");
debug!("Debugging value: {:?}", vec![1, 2, 3]);
trace!("Trace log: {}", "function entered");
}


### New Result and Option methods

New methods are added to Result and Option types - error, warn, info, debug, trace. These apply logs are various log levels and can be easily chained with other methods.

use err_trail::ErrContext;

fn main() {
let value: Result<(), String> = result().error("If `Err`, this message is logged as error");
let value: Result<(), String> = result().warn("If `Err`, this message is logged as warn");
// Notice these methods can also accept closures for lazy evaluation
let value: Result<(), String> = result().error(|err: &String| format!("If `Err`, this message is logged as error: {}", err));
// If the error type implements `Display` then `()` can be passed to log the error directly if `Err`
let value: Result<(), String> = result().error(());
}
fn result() -> Result<(), String> { Ok(()) }


The same methods exist for Option too.

https://redd.it/1pzaa5l
@r_rust
Dynamic dispatch vs bytes() question

The intent of my question is improve my ability to use the available rust documentation to explain the compilers behavior in the following relatively simple code snippet. As shown, this code fails to compile because "the \`bytes\` method cannot be invoked on a trait object". However, if I enable the `use std::io::Read` statement. It does compile and run as desired. Why? It appears to me that (the same) bytes is attempting to be invoked on a trait object in both cases. How should I read the documentation to have been able to expect the real resulting behavior?

use std::fs::File;
use std::io::{self, BufRead, BufReader};
//use std::io::Read;

...
fn dump_bytes(reader: Box<dyn BufRead>, n:u64) -> Result<()> {
    let bytes = reader.bytes().take(n as usize).collect::<Result<Vec<_>, _>>();
    print!("{}", String::from_utf8_lossy(&bytes?));
    Ok(())
}

As an aside, this puzzle resulted from my efforts toward rust self-education utilizing "Command-Line Rust" and it's headr exercise.





https://redd.it/1pz5tur
@r_rust
I finally stopped messaging myself to move text between devices

You know that thing where you find a link on your phone and need it on your laptop, so you... message it to yourself? Email it? I had a "Notes to self" Telegram chat dedicated to this for years. It got weird when I started replying to myself.

Apple has Universal Clipboard. Samsung has their thing. But I use a Mac at work, Linux, Windows (until Valve takes the Gaming) at home, and an Android phone - none of that helps.

So I built DecentPaste. Clipboard sync that works across Windows, Mac, Linux, and Android. Written in Rust. No cloud, no account, stays on your local WiFi.

Also doubles as a clipboard history manager - which honestly I use just as much as the sync itself. Copy something, get distracted, come back 10 minutes later and it's still there.

Alpha - I use it daily but there are rough edges.

## How it works

1. Install on your devices
2. Pair with a 4-6-digit PIN
3. Copy on one → paste on all

That's basically it.

## What it does

- P2P only - your clipboard never leaves your network. No server to breach because there's no server.
- E2E encrypted - X25519 key exchange, AES-256-GCM. Keys derived locally via ECDH, never transmitted.
- Share sheet support - share from any app to DecentPaste, or use "Share Now" in the app.

Oh and it's ~15MB, not 200MB. Tauri, not Electron. Your RAM will thank you.

## Tech

Rust backend:
- Tauri v2 for the app
- libp2p - mDNS for discovery, gossipsub for broadcast, request-response for pairing
- IOTA Stronghold - encrypted storage with Argon2id key derivation

First time using libp2p. Learned a lot about gossipsub mesh formation the hard way.

## What doesn't work yet

- Text only for now
- Devices need same WiFi
- No iOS yet (app store testflight only)
- No background sync on mobile - saves battery, keeps it simple

## Links

GitHub: https://github.com/decentpaste/decentpaste

Website: https://decentpaste.com

Play Store / App Store not publicly listed yet. You can grab the Android APK directly from the website, or DM me your email to join the closed testing - helps me get listed faster.

Apache 2.0. If something breaks, open an issue.

https://redd.it/1pzcqts
@r_rust
lazy-image: A drop-in replacement for Sharp using Rust, NAPI-RS, and Copy-on-Write architecture

Hi everyone,



I released **lazy-image**, a next-gen image processing library for Node.js.



While `sharp` (libvips) is fast, I wanted to leverage Rust's memory safety and create a zero-copy architecture for format conversions.



**Tech Stack:**

* **Framework**: `napi-rs`

* **Encoders**: `mozjpeg` (via crate), `ravif`, `libwebp-sys`

* **Resizing**: `fast_image_resize` (SIMD accelerated)



**Results:**

* **Faster**: Outperforms sharp in complex pipelines (resize + rotate + filter) by \~1.4x.

* **Smaller Files**: Mozjpeg integration yields \~10% smaller files by default.

* **Safer**: No Segfaults processing user uploads.



It's currently used in my production SaaS. Check it out!



**GitHub**: https://github.com/albert-einshutoin/lazy-image

**npm**: https://www.npmjs.com/package/@alberteinshutoin/lazy-image

https://redd.it/1pzdw9l
@r_rust
A machine learning library from scratch in Rust (no torch, no candle, no ndarray) - Iron Learn

This is exactly what my machine can do now. Image Courtesy: Google Gemini

I just finished working on my machine learning library in Rust and using it my machine could "draw" the image fed to it.

To understand how Transformers actually work, I ditched all the library. I was curious to know how merely math can talk to me.

Following are few current highlights of the library:

1. 2D Tensor Support with Parallel CPU Execution
2. Optional NVIDIA acceleration support with GPU Memory Pool
3. Linear Regression
4. Logistic Regression
5. Gradient Descent
6. Neural Net
7. Activation Functions
8. Loss Functions

I have tried to provide as much documentation as possible for all the components.

Here is the repo: Palash90/iron\_learn

Please share your thoughts. :)

I am open to PRs if anyone wants to join me.

https://redd.it/1pzemgm
@r_rust