r_rust🦀
59 subscribers
593 photos
65 videos
36.4K links
Posts top submissions from the rust subreddit every hour.

Powered by: @reddit2telegram
Chat: @r_channels
Download Telegram
Rust + HTML templates + vanilla JS for SPA-like apps — anyone doing this in production?

I’ve been pretty obsessed with performance for a while, especially when it comes to web apps.
On the frontend, I’ve been using Qwik for the past 3 years instead of React and similar frameworks. I’ve even used it in production for a client project, and the performance has been great.
Lately, I started questioning the efficiency of server-side rendering with JavaScript runtimes. From some experiments I ran, rendering HTML using templates in Rust (e.g. with Askama + Axum) can be dramatically faster (I’ve seen ~30–40x improvements) compared to SSR with modern JS frameworks.
So recently I picked up Rust and started building with Axum, and now I want to push this idea further.
I’m planning a side project (a Reddit-like social media app) with this approach:
- Backend in Rust (Axum)
- Server-rendered HTML using templates (Askama or similar)
- SPA-like UX on the frontend
- Minimal JavaScript — ideally vanilla JS with no libraries unless absolutely necessary
- Very small JS bundles for faster load times
My main questions are actually about the frontend side:
- Are any of you building apps like this (Rust backend + mostly vanilla JS frontend)?
- How do you structure the frontend as it grows without a framework?
- Do you end up building your own abstractions or lightweight framework?
- How do you handle things like state, navigation, and partial updates?
Also, from the Rust side:
- Any recommendations for this kind of architecture?
- Libraries/tools that fit well with a “HTML-over-the-wire + minimal JS” approach?
I’m trying to push performance as far as reasonably possible without making the project unmaintainable, so I’m interested in real-world tradeoffs, not just theory.

https://redd.it/1rz3u23
@r_rust
einstellung - A configuration parsing and composing library

Introducing einstellung a proc-macro based, flexible, strongly-typed configuration parser for Rust.

I built einstellung because I wanted a more ergonomic way to handle configuration in Rust applications, especially when dealing with multiple layers (defaults, files, user overrides) without losing type safety or control over how things are merged.

The goal is to keep configuration definitions simple while still allowing customized advanced behavior when needed.

einstellung works by generating an associated `Partial` configuration
for your config in which every field is optional. These partial configs can then be arbitrarily loaded and merged until they are `.build()` at which point your fully initialized config struct is produced.

\- https://github.com/soruh/einstellung

\- https://crates.io/crates/einstellung

\- https://docs.rs/einstellung/latest/einstellung/

I’d be interested to hear how this compares to other config approaches people are using, or if there are gaps I should address.

https://redd.it/1rz7lur
@r_rust
Idiomatic Use of the Default Trait?

I've started working at a company where use of the Default trait is ubiquitous, as I understand to perhaps be standard in Rust. However, I somehow always wince at this when forced to read the code. If I see something as simple as
let x = false;

I've immediately learned a lot about x: I know both its type, bool, and its value, false. In contrast, when I see
let x = Default::default();

I learn none of that. I know that it must be of some type which can be inferred by its later use, and its value must be whatever that type's default is. Within some complicated logic, this can make code harder for me to read and understand sequentially.

I went looking for something I could cite to coworkers to say "this is well-established bad practice" and came up empty, which surprised me. I think of Rustaceans as having strong opinions on what code is proper. So for lack of a better source I've written my own maximalist diatribe version of this here, but I'm curious about whether if I'm truly so isolated in this belief, perhaps I could just be misguided.

Does the community in general think of Default as something to be encouraged or discouraged? In what scenarios is it seen as idiomatic, and how do you avoid this sort of confusion?

https://redd.it/1rz8pc6
@r_rust
Have tests running on file save

Hi rustaceans,

I am working in a little pet project, and I am running my tests manually, every time...

When I am working with Javascript, per example, I have at things like `jest - - watch` that runs the tests when the files are saved, and I can input some patterns (regex) to run only specific tests.

Is there an equivalent in our environment?

(I don't mind if is a cli, a vs code plug-in, or a set bash commands)

I appreciate any advice,

thank you

https://redd.it/1rz9u34
@r_rust
Announcing serde_cursor: Extract nested fields from JSON without making intermediate structs or loading the entire JSON into memory, with 5X less boilerplate than serde_query !
https://github.com/nik-rev/serde-cursor

https://redd.it/1rzajfp
@r_rust
Mods Need Input: Dealing with AI Spam in This Sub

Hey everyone, your mod team here wanting to get some feedback on something that's been bugging us for a while now


We've all noticed the uptick in AI-generated posts flooding the sub and yeah, it's getting pretty annoying. Our team is split on how to handle this mess - some of us think AI might have its place while others want to nuke it from orbit


We've been going back and forth on this for like 6 months now and can't seem to land on a solid approach that works for everyone


Look, we want to keep this place focused on actual Rust discussion and learning, but we also don't want to accidentally ban someone's legitimate question just because it might look AI-generated. Plus we're all doing this in our spare time and don't have bandwidth to review every single post manually


Right now we're just winging it case by case. You probably don't see most of our work since we've been quietly nuking the obvious spam posts, but trust me we're dealing with way more of this stuff than you realize


Here's the thing though - we're not sitting here refreshing /new all day long. We browse this sub just like you do, we all have day jobs and other stuff going on. Nobody's paying us to babysit Reddit 24/7


So what do you think? How should we tackle this without making life harder for genuine newcomers or burning ourselves out in the process


Drop your thoughts below or hit us up in modmail if you want to chat about it privately

https://redd.it/1rzkonk
@r_rust
I have a confusion about slicing with String

Hello! I am learning Rust from a Packt course and from what I learned, &str is a variable stored in the byte code of the program after compiling while String is a variable which is stored in the heap when the program runs. I was doing an exercise where I had to run following command:

let cookie_crisp: &String = &cereals[0];

let cookie: &str = &cookie_crisp[..6];

Now cereals is an array of variables of String type and cookie_crisp is a reference to the String type value stored at index 0. So, when I slice it into cookie, why is it &str instead of String. And how is this possible since &str is stored in byte code after compiling. If this data is entered by user at runtime, how is Rust handling this? I am confused. Can someone please help me understand this concept?

https://redd.it/1rzktn9
@r_rust
Strong Portfolio Project

Hii, I am a self-taught developer,and I want to break into the industry. I need project suggestions. I want to make good projects, and it's okay if the difficulty level is hard.

I use Rust for systems programming and Golang for backend. I have created CHIP-8 emulator and a NES emulator (half done, on going), and for backend, I’ve built an e-commerce app, chat app, redis clone and some small tools.

Please suggest some very good projects. Its time for me to get a job. my communication is very poor, and I am very introverted, so I want my projects to speak more for me.



thank u

https://redd.it/1rzlzmk
@r_rust
This media is not supported in your browser
VIEW IN TELEGRAM
I built fv – a zero-config terminal file browser in Rust (2.3ms startup, 8MB memory)
https://redd.it/1rzo4zl
@r_rust
Courier-http: Rust based POSTMAN alternate. Fully Local. Need suggestions and review.

Hi.
While learning and practicing Rust, I created a POSTMAN alternate as a desktop App in Rust and Tauri.
at https://github.com/Suhird/courier-http
Let me know what you guys think about it.
Would also appreciate any kind of suggestions and reviews.

https://redd.it/1rzmepa
@r_rust
Is every project AI Slop?

I’ve noticed for every project that is shared in this subreddit lately, people always comment “AI Slop”.

Maybe they are AI slop (often the OP is a dead giveaway). But now I fear there’s no avenue to share genuinely useful projects or expand the community, since every post I’ve seen sharing something is typically met with negative reaction.

How do you judge / evaluate what people are sharing? Do you immediately assume it’s AI slop? Do you read the repo or readme? What can we do as a community to promote genuine projects and discourage the slop?

I honestly want to know, because I used to enjoy finding gems in this sub but now it feels pretty negative and hostile, but for reasons with which I somewhat sympathize.

https://redd.it/1rzv09q
@r_rust
Storing data in my Logitech MX Vertical DPI register because why not

tldr; You can store 2 bytes in the DPI register of Logitech MX Vertical

The plan was to use the mouse's built-in flash memory as a small, constant storage device. The mouse moves between computers all the time, so it could technically carry data with it. Well, technically lol

I spent a while trying to find what looked like a nonvolatile storage feature (0x1c00) that had six slots and read/write flags. It seemed like it could be useful, but it's not very practical because macOS's IOHIDManager blocks the long HID++ reports you need to actually talk to it. I guess there are other ways to avoid the IOHIDManager, but yea...

What actually worked was the DPI register. The mouse saves your DPI setting in flash, and it's happy to take any u16 values without any quantisation. I can write any 2-byte value I want, and it'll still be there when I unplug, power cycle, move it to a different computer, and so on

I know 2 bytes are nothing but was still a funny thing to do

Code: https://github.com/timwehrle/mouse-fs

https://redd.it/1rzvvhk
@r_rust
My First Rust project: A Verilog to Factorio Compiler and Simulator (Working RISC-V CPU)
https://redd.it/1s03w2o
@r_rust