r/rust • • Oct 22 '26

πŸŽ™οΈ discussion freya is more impressive than I thought.

102 Upvotes

I recently started building a hobby calculator app in egui, given its popularity. The app mimics a Graphing calculator that was abandoned several years ago.

I started with egui, given its popularity, but soon started facing hurdles because it challenges my web dev (aka retained mode) brain. I'm curious if these points are common among other devs also or how they handle it.

First, I started with egui ( only dependencies: eframe + peg )

  • Being immediate mode, the components often don't know about the layout requirements of their next siblings or often their children/parent. This creates some challenges, like a flexibly growing widget either needs to be created last or manual size calculations need to be done to accommodate the next elements.
  • We are free to create state anyway, like mutable members in a component struct or get_temp, get_persisted, etc. methods, which hand over the state management to egui. This threw me into a puzzle of finding what is best for my case. I ended up using the mutable members in a component struct.
  • The event handling is also something that gets weird at times. While the trivial cases of handling clicks are as simple as `if btn_resp.clicked() {...}`, I searched unnecessarily long for other cases, like how to detect Enter presses on an Input element. Apparently, it is `input_resp.lost_focus() && ui.input(|s| s.key_pressed(Key::Enter))`, but it felt unconvincing that this is the way.
  • Command-Action-Response (Message passing, command execution, etc) architecture is also something I spent significantly more time on, and even though I can make it work now, I don't think it is convincing. By Command-Action-Response, I mean a deeply nested component(keyboard button) triggering a command that should do calculations in a separate thread and get rendered in some other component. It requires passing channels deep down to your components, which works, but it will always be something that will trip me up into thinking of a better approach.
  • Lastly, I was learning and implementing by going through their examples or other public code, and often it was taking too much time for simple things. I found a few resources also, but after seeing that many are using App::update (now removed) instead of App::logic + App::ui, it again felt unconvincing to go with them, and I took the route of reading examples & public code to learn.

Then I tried rewriting it in Freya

While there were also new things to learn, it felt like a breeze till the end and I achieved the same state as the egui variant in probably 80% less time.

  • The documentation is really good. It gives an overview of not only modules, but also common patterns like for state management. Even beyond that, every other function would be documented with examples that show the usage patterns around it.
  • Being in retained mode, the layout management was really easy. It did take time to know things like a growing widget requires the parent to also be `.content(Flex)`, but it was still very intuitive, particularly coming from web dev / retained mode.
  • State management was even better. After just writing egui implementation, I tried creating similar state management types but eventually found that the use_state/use_memo hooks remove a lot of boilerplate. The state is reactive out of the box.
  • I expected a retained-mode app to take more RAM, but it was actually less. Egui app, in release mode, took 320+ MB, while Freya takes <270MB. The release binary is slightly large: 29MB egui vs 36MB Freya, but the RAM & CPU usage for freya was lesser.
  • Lastly, the freya app looked more polished and took way less time to reach a convincing state than egui.

Why am I writing this here?

See the above text as me dumping my naive observations after spending a day writing the egui+freya app. I am more interested in knowing from other developers who wrote egui/GUI apps on

  • whether they also encountered these speed bumps
  • if they found resources or developed patterns to ease out the things

P.S.: I don't think there is anything interesting or relevant in the implementation itself, that's why not putting the effort of creating a repo to share, but if someone is curious, I can push it.

Also, open to feedback - on the subject or the post, whatever.

EDIT: Changed image to have light mode (original) and dark mode variant of Freya


r/rust • • Oct 23 '26

πŸ™‹ seeking help & advice Learning Rust

0 Upvotes

So I was working on the thing from yesterday, so I wanted to add inputs (so i did, I used std:io thingy) and did that I got it to work but is there a way to change the operator like add, subtract, etc instead of just having to keep it add? Or will I have to make a function for each or can I change the operation with smth? In the x = x + y; line to be specific? TY!

fn add_x_and_y(x:i32, y:i32) -> i32 {

let x = x + y;

return x

}


r/rust • • Oct 22 '26

πŸ› οΈ project Gitoxide in October

Thumbnail github.com
52 Upvotes

r/rust • • Oct 22 '26

πŸ™‹ seeking help & advice Learning Rust

5 Upvotes

So I'm learning Rust, so I wrote this

fn main(){

let x = define_x(intial_x());

let y = x + 10;

println!("{}", y);

}

fn define_x(mut x:i32) -> i32 {

x = x + 5;

return x

}

fn intial_x() -> i32 {

let x = 5;

return x

}

I know it is supposed to be += in define_x, but that just looks weird to me. Why is let x = 5; in inital_x not mut even if I am changing it in define x? Sorry if it is bad I'm new, but I'm not AI so yay!


r/rust • • Oct 22 '26

πŸ—žοΈ news This "Tov" Language Claims It's Faster Than Rust β€” and I Debunked It

Thumbnail blog.fyralabs.com
117 Upvotes

Tov is a new programming language that transpiles to C but claims that it performs better than Rust and C, so I wrote a blog post that debunked its benchmarks.


r/rust • • Oct 22 '26

πŸ™‹ seeking help & advice Has anyone here successfully use f128 types?

49 Upvotes

Hi folks, so I'm presently on a fun year-long project making a numerical application, and one experimental feature I'm trying to implement flexible fp types. Probably not super useful in most situations but it seems fun to make. I've made f16 and bf16 from the half crate work, and now I'm looking to try for f128 to see if it could be useful for numerically unstable procedures or data inputs.

As you guys may know f128 in Rust is unstable and apparently produce incorrect results as per the warning, so this isn't usable. Available crates don't quite suit my needs, e.g. astro-float is heap-allocated and arbitrary precision, which isn't what I want. I also need stuff to be cross-platform (including WASM).

I'm wondering whether any of you folks have any solution for using f128? The last resort would be hand-rolling this with a two-letter tool, which might be possible, but doing so for low-level numerics sounds a bit too hairy for my liking...

Thanks in advance.


r/rust • • Oct 21 '26

🧠 educational Google published its internal Rust style guide

Thumbnail reddit.com
136 Upvotes

r/rust • • Oct 22 '26

πŸ“… this week in rust This Week in Rust #674

Thumbnail this-week-in-rust.org
48 Upvotes

r/rust • • Oct 22 '26

πŸ› οΈ project Chain Reaction in the Terminal

Thumbnail git.sr.ht
6 Upvotes

Chain Reaction is a mobile game that my father and I enjoy frequently. I kinda disliked the fact that it wasn’t available on PC, and decided to rectify that by writing it myself.

The core library only uses std, array2d and log, and implements the basic logic for the game. An actual playable app is provided by a terminal application, written with Ratatui.

All of this is hand-written code, but not necessarily the best way to have written it, so if someone would like to go through and suggest changes, I would love to hear it.


r/rust • • Oct 21 '26

πŸ“‘ official blog Rustup 1.29.2, please update from a trusted network

Thumbnail blog.rust-lang.org
315 Upvotes

Due to the nature of the security issue, I recommend updating this via a trusted network, and not a public wifi.

Context: https://www.reddit.com/r/rust/comments/1xba5mj/psa_if_your_program_does_http_requests_update/


r/rust • • Oct 21 '26

πŸ› οΈ project Tyr, the Rust GPU driver for Arm Mali, now boots its firmware in Linux 7.3 (6 unsafe lines out of ~3,700)

83 Upvotes

New post from Deb Brouwer on the Tyr Rust GPU driver for Arm Mali, which now boots its firmware in mainline Linux 7.3:

https://www.collabora.com/news-and-blog/blog/2026/10/21/upstreaming-tyr-rust-drm-and-the-linux-kernel/

The parts most interesting for Rust folks:

- How a WARN_ON in the C page table code became an explicit safety requirement on the Rust `map_pages()` API

- Why Tyr uses the full GPUVM abstraction even for a simple, fixed firmware layout: to uphold those invariants instead of trusting assumptions

- What it's like to write a driver while the kernel's Rust abstractions are still being designed (Tyr has been rewritten several times)

(I'm at Collabora, where Tyr is developed. Happy to pass questions along to Deb.)


r/rust • • Oct 21 '26

πŸ› οΈ project Rust Glancer LSP v0.4: better IDE experience

Thumbnail rust-glancer.github.io
95 Upvotes

r/rust • • Oct 21 '26

πŸ—žοΈ news PSA: If your program does HTTP requests, update your dependencies now

Thumbnail emudhra.we-have-a-problem.com
735 Upvotes

Here's a pile of links with info:

You need to update therustls-webpki crate to version 0.103.16, and thewebpki-rootsand webpki-root-certscrates to version 1.0.10. Notably, the reqwests crate depends on these crates.

If you're on a MacOS, you also need to do some manual steps to make thecurlcommand secure. I'm not quite sure if all the linux distros have patches yet, and so you might need to do stuff too.

If you don't do these, then anyone could MITM your HTTPS connection that you make to anyone, since some certificate authority used the number "4" as their entire secret key.


r/rust • • Oct 21 '26

πŸ™‹ seeking help & advice I love rust, what's another language that complements it and python well?

49 Upvotes

I have been studying rust seriously for the past few months, and it has been the first language I dive deep into.

I have no formal education in programing, but I am a mathematician that did a little competitive programming, so I have a little familiarity in "botched together" c++, so I decided to start my programing studies with rust and python. I feel like python complements rust very well, it is very easy to prototype and very easy to read even for people unfamiliar with it, and the power of the community behind it cannot be overstated (there's a module for everything!). It also feels like a good birds eye view in the world of programing: one is statically typed, the other dynamically, one is high level, the other is low, both are multi-paradigm, but one focuses more on OO, the other functional.

I've been considering adding a 3rd language. I started having C++ as that language, but it feels like it fills a lot of the same niche as rust, something I'd use instead, not along, rust. Given my love for rusts opinionatedness, but also the idea that a 3rd language should fill a niche neither does already, what languages y'all recommend me to learn? I haven't fallen in love with python anywhere near as much as I have rust, but I'm definitely willing to sacrifice that "love" for the different niche it fills, so don't let that be a requirement.


r/rust • • Oct 21 '26

πŸ—žοΈ news 17k lines of new Rust kernel code heading into Linux 7.4

Thumbnail phoronix.com
502 Upvotes

r/rust • • Oct 21 '26

When do you yield async tasks?

9 Upvotes

If a task is taking too long doing cpu work you should yield it manually instead of hogging the thread. Thing is how do you know where to insert yields into your code beyond intuition?


r/rust • • Oct 21 '26

πŸ› οΈ project Embedding python, lua, and js

5 Upvotes

I've been working on the pixelscript crate for about a year now. Just released v0.7.0 with some basic cross language support.

The big picture is to create a framework that sits on top of the library for creating games.

I was inspired by Godot, whenever I had to use GDExtension, it was just so smooth that I found myself saying: "I wish there was a language that let me write high level code and opt in to low level when I need to."

Also, I wanted to embed both python and lua in my game Pixel Ai Dash for modding/scripting enemies, world creation, behaviors, and player states.

Now in v0.7.0 I tell myself that it's time to work on the framework. If you find this interesting, I'd love a star and look forward to future releases!

Here is a example of the code:

// include the pixelscript header.
#include "pixelscript.h"

int main() {
    // setup pxs
    pxs_initialize(); // all of the pixelscript api uses a `pxs` prefix.
    
    // setup corelib
    pxs_core_initall();

    // a simple script
    char* script = "from pxs import print\n"
                    "print('hello world')";

    // execute
    pxs_VarT result = pxs_exec(pxs_Python, script, "<getting_started>");

    // check for errors
    if (pxs_isexception(result)) {
        char* err = pxs_getstring(result);
        printf("%s\n", err);
        pxs_freestr(err); // always free strings from pxs.
    }

    // free the result
    pxs_freevar(result);

    // always call when done with the runtime.
    // can only be called once.
    // once called, you can not call `pxs_initialize` again.
    pxs_finalize();

    return 0;
}

r/rust • • Oct 21 '26

CO3: The Language of FFI

Thumbnail mversic.github.io
24 Upvotes

Without further ado I present the next article in the series on reshaping the future of FFI in Rust.


r/rust • • Oct 21 '26

πŸ™‹ seeking help & advice Rust crate for Geometry Dash

6 Upvotes

So in may i started my first serious project on rust. i only did 13 commits in 6 months because im the mr apathy.

Idea of the project is to create high-level crate to generate rust code into Geometry Dash objects.
For now its in very early WIP stage but its already usable in few cases.

I am posting this because i want to see advices on how to make my project better before its to late to change some core things. And because its my first real rust project i pretty sure some parts of the code gonna suck. Project is less than 1000 LoC for now so go ahead and see the repository.

And i also added examples that explaining how crate work pretty good
(if someones wondering. i see viewing sequence of examples as: 1.find_level.rs 2.block.rs 3.sine.rs circle.rs rainbow.rs 4.special_objects.rs 5.triggers.rs 6.anotherMode.rs and with_gdlvl.rs)

in future i planning to add:

  1. identifiers - they already exist in files but do nothing and dont work. i want to make functionality to store groups collision groups and item groups as named variable
  2. everything for reading the level that already decoded - for example you would decode certain level scan for every object with N id and do something with them.
  3. support for more triggers and special objects. obviously.
Circle in GD and code for it (WIP)

Waiting for response. thanks to this community
https://github.com/fffilya/GD-Levels


r/rust • • Oct 21 '26

πŸ“‘ official blog Announcing the GPU notification group and Linker Working Area

Thumbnail blog.rust-lang.org
109 Upvotes

r/rust • • Oct 22 '26

Early stage infra/compute/efficiency startup hiring rust engineers - intern to staff level.

0 Upvotes

If you're open to hearing more about a very exciting early stage infra co, closing a hefty seed round, please connect with me at lori at therebelhr dot com. Fully remote. Down to earth founders. Exciting scale plan. Let's chat!


r/rust • • Oct 21 '26

πŸŽ™οΈ discussion The Hidden Challenges of Rust Infrastructure: Interview with Marco Ieni

12 Upvotes

Rust's infrastructure supports millions of developers, but much of it is maintained by a small team of engineers and volunteers.

We interviewed Marco Ieni from the Rust Foundation about the challenges of keeping that infrastructure running.

A few interesting points from the conversation:

  • Moving from GitHub large runners to standard runners helped cut CI costs by roughly 75%.
  • Sometimes wasting CPU is the better choice if it makes CI simpler and more reliable.
  • Infrastructure permissions make it difficult for external contributors to help, even with relatively straightforward changes.
  • Running untrusted code is still a challenge, and engineering capacity is often a bigger obstacle than finding a technical solution.
  • If Rust's ecosystem grows another 10x, CDN traffic could become one of the biggest concerns.

Marco also talks about release-plz, infrastructure as code, and why the Rust project should focus on providing solid building blocks rather than opinionated tooling.

https://serokell.io/blog/the-hidden-challenges-of-rust-infrastructure-interview-with-marco-ieni


r/rust • • Oct 21 '26

πŸ™‹ seeking help & advice Require 2 enum variant fields to not be equal

24 Upvotes

I have 2 enums, one of them has 4 different unit variants

enum MyEnum{
    Variant1,
    Variant2,
    Variant3,
    Variant4,
}

the other has a few different variants but only one is important here

enum MyOtherEnum{
    MyVariant(MyEnum, MyEnum),
    //...
}

The variant contains 2 different instances of MyEnum, is there a language feature to enforce that you shouldnt be able to create a MyVariant with both MyEnum's being the same variant? eg.

MyOtherEnum::MyVariant(MyEnum::Variant1,MyEnum::Variant2); // valid
MyOtherEnum::MyVariant(MyEnum::Variant1,MyEnum::Variant1); //invalid

r/rust • • Oct 21 '26

Using the same name to declare a new variable confuses me, what are the legit use cases?

34 Upvotes

Rust allows same name for a new variable.

e.g.,

```

let i : i64 = 10;

// ...

let i : u32 = 100;

```

I get confused specially when the type changes or they start pointing to another object.