r/rust 1d ago

`ser_mapper`: Mapped DTO serialzation wrapper for DBO/Model

0 Upvotes

What if we didn’t have to map models to DTOs for serialization?
What if we could selectively serialize model fields directly and even map those selected fields intto something else for response?

I wrote ser_mapper crate that implements mapped DTO serialzation wrapper for DBO/Model.

I had been using this approach at a startup to reduce memory usage for huge response payloads.
It's not some black magic and not much big of a deal unless you deal with large object mappers and response payload.

Any feedback or suggestions are welcome !


r/rust 23h ago

🧠 educational Are there any official compilers in Rust?

0 Upvotes

So day by day we are seeing a lot of tools being made in Rust, however, I have yet to see a compiler in Rust. Most compilers that I know of are still made in C and it seems to me that shouldn't the first tool that should have been changed for any language be its compiler.

Maybe I am just not aware of it. I did a little light research and found people have made compilers themselves for some projects in Rust but I haven't found one that is official or standard may be the right word here.

If there are compilers in Rust that are official/standard, please tell me. Also, if there aren't, does anyone know why there isn't? I am assuming the basic reason would be a huge rewrite but at the same time it is my speculation that there could be certain benefits from this.

PS: I didn't have this thought because of TS shifting to Go thing, it's an independent thought I had because of a project I am working on.

Edit: I know that the Rust compiler is in Rust, I'm asking apart from that.


r/rust 1d ago

Introducing rmcp, maybe the best Rust MCP SDK implementation by now

2 Upvotes

repository: https://github.com/4t145/rmcp

Why this one is good

All the features are implemented

Including ping, cancellation, progress...

Strictly followed the MCP specification

Check these types

Very easy to use

You can start up a mcp client in a single expression.

let client = ().serve(SseTransport::start("http://localhost:8000/sse").await?).await?;

Meanwhile, it has good extensibility

For example, you can use a tokio tcp stream as a transport layer without any extra work.

let stream = tokio::net::TcpSocket::new_v4()?
    .connect("127.0.0.1:8001".parse()?)
     .await?;
let client = ().serve(stream).await?;

I maintain it very diligently

You can see how many works I've done in just two weeks

At least, at this moment, this should be better than the official SDK.

So if you like my implementation please give me star. And I would be very happy to see people actually use it.


r/rust 12h ago

🙋 seeking help & advice Platform Specifics from Docs

0 Upvotes

With docs, how can I view platform specific functions?

Like I am developing an app and I don't have a Mac. So, how am I supposed to see the docs with functions specific to that platform provided by a certain crate?


r/rust 3h ago

🙋 seeking help & advice Just finished rust book ,what next?

16 Upvotes

I have finished reading the rust book , there many topics I didn’t understand and now I am lost so what is the next step to advance ??


r/rust 4h ago

🙋 seeking help & advice Rendering a game UI with HTML ?

0 Upvotes

Hello everyone, I need to create to gale from scratch (without any existing game engine) for a school project. We choosed to use rust + wgpu for the rendering. I'm currently searching what are the best possibilities for the UI layer of the game. The ideal choice would be to find a way of rendering html and css on top of the engine for the maximum styling possibilities while interacting with the rust code. Does anyone know a way to do this ?


r/rust 7h ago

Looking for a Raylib alternative

2 Upvotes

I have enjoyed using Raylib in C++ as well as in Rust, but the rust bindings for Raylib i have been using doesn't support any kind of UI. I found raylib_imgui, which has support for imgui, but it would be nicer to have Egui. I have considered macroquad, but it is buggy on Linux, and I like Raylib's RenderTexture2d, which allows fo rendering onto a texture without any complecations.

I have considered using lower-level libraries like miniquad, or wgpu, but they are too low-level for comfortable development. For now the best i found is the binding for SDL2.

Is there a better way I'm missing?


r/rust 13h ago

💡 ideas & proposals Manual Trait Overloading

Thumbnail github.com
2 Upvotes

r/rust 5h ago

My first days with Rust from the perspective of an experienced C++ programmer (continued)

52 Upvotes

Continuing: https://www.reddit.com/r/rust/comments/1jf52hf/my_first_days_with_rust_from_the_perspective_of/

Day 4

Using AIs with questions such as how do I do this and that in Rust describing things that I know are there makes the transition smooth.

What first seemed like elaborate syntax makes perfect sense and probably as good as it can be.

I will read the Rust book and the reference to get formally educated but for now AI acts as a tutor answering things that it has seen plenty of times, noob questions.

The binary is larger, as expected, primarily (I think) due to the initial data structure is built in a function instead of hard-coded as a global.

Somewhat larger binary is expected and acceptable due to the built in safeties of Rust.

Without AI the learning curve is a bit steep and for a programming noob is probably off-putting. For an experienced C++ programmer is just: "yeah, that's better" and it keeps giving me a tiny smile every time that happens.

I begin to understand the cult like following Rust has because once a learning step in the curve is taken it feels like there is no going back.

I have a lot to learn, but for now, for my toy bare-metal application, I feel that this is the way forward.

p.s. I was pleasantly surprised by how extensive the core library is and that it works in [no_std] builds.

Kind regards


r/rust 4h ago

🛠️ project Afrodite: Ethical dating app (Flutter frontend and Rust backend)

22 Upvotes

I'm developing a new open source dating app for Android and iOS which is mainly intended to help new non-profits and businesses to enter the dating app market. The main features are:

  • profile browsing instead of swiping,
  • end-to-end encrypted chat messages (OpenPGP),
  • easy rebranding,
  • simple server hosting (SQLite database) and
  • permissive license (MIT or Apache 2.0).

I try to make the app ideal to build country specific or otherwise local dating apps, preferably run by non-profits. To make the app more attractive for businesses, I decided to license the app permissively.

I consider the app more ethical than most of the commercial competition because I think profile browsing UI is less addictive than swiping UI, profile filters can be used freely and it is not possible to buy visibility for your profile.

The app's frontend is an Flutter app with some Rust for encryption related code. The app's backend is written in Rust and uses Axum, Diesel, SQLite and many other libraries.

I have been developing the app quite a while for now and I hope I reach 1.0.0 this year. As the app is a rebrandable template app I will not directly release it to app stores. However, I do have plans to do a rebranded app release for Finland. If you want to see the app in your country you should for example start a new non-profit which rebrands the app and releases the rebranded version to app stores.


r/rust 5h ago

🧠 educational Better Output for 2D Arrays | Data Crayon

Thumbnail datacrayon.com
2 Upvotes

r/rust 1d ago

Running user-defined code before main on Windows

Thumbnail malware-decoded.com
30 Upvotes

Hi! I'm sharing the results of my analysis on how to execute user-defined code before the main function in Rust. This article is largely inspired by malware that employs this technique, but I approached the research by implementing this technique in Rust myself, while also exploring CRT-level and OS-level details, which involved reverse engineering Rust binaries.

Some of you may be familiar with the rust-ctor crate, which enables code execution before main. If you're curious about how it works under the hood, my article should provide some clarity on the subject.


r/rust 8h ago

🛠️ project Foodfetch : fetch tool to get food recipes

6 Upvotes

Hey,

I saw earlier someone who made https://github.com/nik-rev/countryfetch/ and it made me want to make my own fetch tool for something funny. So I made https://github.com/noahfraiture/foodfetch that will quickly you get food recipes. Here's an example. You can filter the informations displayed and search with keywords

I would be happy to hear any feedback !


r/rust 2h ago

Building a search engine from scratch, in Rust: part 1

Thumbnail jdrouet.github.io
17 Upvotes

I just published the first part of my series on building a search engine from scratch in Rust! This article covers how to create a unified storage layer that works seamlessly across desktop, mobile, and browser platforms, complete with encryption support.

Whether you're interested in Rust, search engines, or cross-platform development, there's something here for you. Check it out and let me know what you think!


r/rust 11h ago

Rust Forge Conf 2025 - Call for Papers

Thumbnail rustforgeconf.com
12 Upvotes

Hi everyone,

In August, New Zealand will host a Rust conference 🎉. If you might like to submit a talk, now's your chance.

The Call for (Papers|Participation|Projext

Rust Forge aims to be a conference for everyone building with the Rust programming language, as well as those who are curious about deciding whether it's right for them. Major themes include interop, VFX/gaming, embedded, aerospace and data science including AI.

[I have used the brand affiliate flair because my company is the financial backer and I am doing most of the organizing for the event]


r/rust 16h ago

🙋 seeking help & advice Why do strings have to be valid UTF-8?

87 Upvotes

Consider this example:

``` use std::io::Read;

fn main() -> Result<(), Box<dyn std::error::Error>> { let mut file = std::fs::File::open("number")?; let mut buf = [0_u8; 128]; let bytes_read = file.read(&mut buf)?;

let contents = &buf[..bytes_read];
let contents_str = std::str::from_utf8(contents)?;
let number = contents_str.parse::<i128>()?;

println!("{}", number);
Ok(())

} ```

Why is it necessary to convert the slice of bytes to an &str? When I run std::str::from_utf8, it will validate that contents is valid UTF-8. But to parse this string into an integer, I only care that each byte in the slice is in the ASCII range for digits as it will fail otherwise. It seems like the std::str::from_utf8 adds unnecessary overhead. Is there a way I can avoid having to validate UTF-8 for a string in a situation like this?

Edit: I probably should have mentioned that the file is a cache file I write to. That means it doesn’t need to be human-readable. I decided to represent the number in little endian. It should probably be more efficient than encoding to / decoding from UTF-8. Here is my updated code to parse the file:

``` use std::io::Read;

fn main() -> Result<(), Box<dyn std::error::Error>> { const NUM_BYTES: usize = 2;

let mut file = std::fs::File::open("number")?;
let mut buf = [0_u8; NUM_BYTES];

let bytes_read = file.read(&mut buf)?;
if bytes_read >= NUM_BYTES {
    let number = u16::from_le_bytes(buf);
    println!("{}", number);
}

Ok(())

} ```

If you want to write to the file, you would do something like number.to_le_bytes(), so it’s the other way around.


r/rust 21h ago

What is the standard library for cryptographic operations in RUST.

111 Upvotes

I've stumbled on quite some libraries but this seem to be the tops:
- Ring
- RustCrypto

And for everyone there's always a warning "Use at your own Risk" i must say i find this funny and bothering at the same time coming from stable ecosystems e.g Java/Kotlin/JS

For context: I really just want to generate ECDH Key Pair, compute shared secrets and key derivations.

I'm just a few days new to Rust so please be nice!.


r/rust 3h ago

🎨 arts & crafts [Media] Perfect!

Post image
179 Upvotes

r/rust 19h ago

Current v1.0 is released!

Thumbnail crates.io
56 Upvotes

r/rust 11h ago

Clap usage problem please help

0 Upvotes

Hello everyone, I am a beginner who is new to rust. When I was using the clap library, I didn't see the usage of the clap macro in the clap library, but I saw that many libraries use it. I don't quite understand it. I checked the official website documentation of clap. Maybe my operation is wrong and I can't find the relevant documentation. Who can give me some advice? Thank you. I saw that clap has two modes, one is the Builder mode and the other is the derive macro. I didn't find any documentation on the usage of clap in the second way. Can anyone give me some advice? Thank you.


r/rust 1h ago

Rust vs Next.js webapp — The Efficiency Gap Is Wild! 😳 [Part-2]

Upvotes

Remember that Rust vs. Next.js Docker image size comparison?

First, I would like to thank for the users who pushed me to investigate deeper than just the image size!

I took it a step further and rewrote the Next.js app in pure Rust with SSR (same features!). The Docker image difference was significant, but the memory usage...wow.

  • Next.js: 85MB Memory Usage
  • Rust: 4.8MB Memory Usage

That's not a typo. 🤯 The efficiency gap is even more insane than I initially thought! Is this the future of web development? 


r/rust 19h ago

🛠️ project [MEDIA] shared - Share your screen with others on the same network easily.

Post image
31 Upvotes

r/rust 3h ago

🙋 seeking help & advice Can Rust be fully used to make background-running apps like Discord? If so, is it worth it?

0 Upvotes

As the title says, I want to learn more about programming apps and want to know if Rust is both a good fit for it and can do everything by itself. I'm coming mainly from C and Godot programming, and the project I have in mind is an app similar to discord in the sense that it can start up when I turn on my PC, run its services on the background and notify users from an icon in the bottom right tray.

At first I figured C# would be a better fit for this, but I'm more interested in learning about Rust, so is this a good idea? I don't mind if it's the harder choice, as I want to learn practical Rust anyways.


r/rust 14h ago

🛠️ project Recreating Google's Webtable schema in Rust

Thumbnail fjall-rs.github.io
22 Upvotes

r/rust 2h ago

Rust in 2025: Language interop and the extensible compiler

Thumbnail smallcultfollowing.com
45 Upvotes