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
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
This media is not supported in your browser
VIEW IN TELEGRAM
[Media] Nexus: Terminal HTTP client with gRPC support and Postman imports!
https://redd.it/1pzizr0
@r_rust
ts-bridge – Rust tsserver shim for Neovim

Hey folks, I’ve been working on ts-bridge, a Rust-native shim that sits between Neovim’s LSP client and Microsoft’s tsserver. Neovim already works with typenoscript-language-server, but that project lives entirely in Node/TypeScript, so every buffer sync gets funneled through a JS runtime that pre-spawns tsserver and marshals JSON before the real compiler sees it.



On large TS workspaces that extra layer becomes sluggish—completions lag, diagnostics stutter, and memory usage climbs just to keep the glue alive. ts-bridge replaces that stack with a single Rust binary and the process lazily launches the tsserver you already have while streaming lsp features without Lua/Node overhead.


Written 100% in Rust and if you’re a Neovim user, give it a shot.

Repo: https://github.com/chojs23/ts-bridge

https://redd.it/1pzik32
@r_rust
that microsoft rust rewrite post got me thinking about my own c to rust attempt

saw that microsoft post about rewriting c/c++ to rust with ai. reminded me i tried this last year

had a personal c project, around 12k lines. packet analyzer i wrote years ago. wanted to learn rust so figured id port it

tried using ai tools to speed it up. normally use verdent cause i can switch between claude and gpt for different tasks, used claude for the tricky ownership stuff and gpt for basic conversions

basic syntax stuff worked fine. loops and match expressions converted ok

pointers were a disaster tho. ai kept suggesting clone() everywhere or just slapping references on things. had to rethink the whole ownership model

i had this memory pool pattern in c that worked great. ai tried converting it literally. complete nonsense in rust. ended up just using vec and letting rust handle it

took way longer than expected. got maybe half done before i gave up and started over with a cleaner design

the "it compiles" thing bit me hard. borrow checker was happy but runtime behavior was wrong. spent days debugging that

microsofts 1 million lines per month claim seems crazy. maybe for trivial code but real systems have so much implicit knowledge baked in

ai is useful for boilerplate but the hard parts you gotta understand yourself

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