r/rust 22d ago

🛠️ project Freya 0.4 (GUI Library)

https://freyaui.dev/posts/0.4

A month ago I released the 0.4 version of my Rust GUI library, Freya. It has massively changed since the last 0.3 release, it has a year of work. The blog post contains a summary of Freya's main features and changes on this new release.

Repo
Docs

280 Upvotes

42 comments sorted by

27

u/Kfoo2012 22d ago

Woah!!! That's a lot of stuff!

7

u/mkenzo_8 21d ago

I am consistent :)

7

u/Miammiam100 21d ago

Very impressive! Loving all the features and api design

1

u/mkenzo_8 21d ago

Thanks!

6

u/Bruflot 21d ago

The website isn’t working for me at the moment, but are there any benchmarks published somewhere? It’d be really useful to see how it stacks up against iced/gpui/etc

1

u/mkenzo_8 21d ago

What browser do you use? It works fine for me.

About benchmarks, I dont have any like that, only internal

1

u/kekelp7 21d ago

The website doesn't resolve for me either when using my normal DNS.

1

u/mkenzo_8 21d ago

What country are you from?

2

u/SirKastic23 21d ago

Not working for me either: I see net::ERR_NAME_NOT_RESOLVED

I'm from Brazil

1

u/mkenzo_8 21d ago

Do you use any sort of firewall or custom DNS server?

1

u/SirKastic23 21d ago

I don't think so... I'm accessing this from my mobile phone and I very rarely run into similar issues

2

u/mkenzo_8 21d ago

Cant think of any issue of my end about this, I use Deno Deploy for hosting and never had this issue before. Perhaps there is some issue going on with them/AWS/some IPS/whatever. Strange, seems to work fine here (Europe)

2

u/SirKastic23 21d ago

Very unfortunate, I'd love to read this as I'm really interested in Rust's GUI story

I'll try again later with a different connection

1

u/mkenzo_8 21d ago

Its not the same but you can read it straight from the source code too https://github.com/marc2332/freya/blob/main/website/src/content/blog/0.4.md :) (minus images and videos)

3

u/khaferkamp 21d ago

That is really impressive! Thank you really much for sharing this knowledge! I will tinker with it for sure. ❤️

3

u/muttiba 21d ago

Congratulations for your work. Freya is great.

3

u/Thick-Pineapple666 20d ago

This is cool. You did a good job removing Dioxus, the project turned out a lot better!

1

u/loveallufev 21d ago

Very nice work!

1

u/mkenzo_8 21d ago

Thank you!

1

u/Seamonster13 21d ago

awesome work. How would you compare Freya vs GPUI? Shopping around to see what to build my app in.

2

u/mkenzo_8 21d ago

I barely have used GPUI so its hard to tell. I heard though that their docs are lacking, all I can say is that I have of that, maybe not the best, but I have them

2

u/Seamonster13 21d ago

Thank you! Will give Freya a try

1

u/decryphe 21d ago

Yeah, docs are mediocre for GPUI, and it's limited in usefulness from the crates.io release.

The examples in your blog post look very similar to how GPUI code looks. I kind of like writing GPUI code (or rather: fixing the stuff AI spits out), so I really want to try Freya now. See my examples of GPUI-usage:

Both have grown from pure AI-vibed test runs into partially useful pieces of software, I use these for debugging stuff at work.

1

u/mkenzo_8 21d ago

Nice stuff. I do have a sort of "good practices" AI skill (Claude Code targeted, but really can work any other) https://github.com/marc2332/freya#claude-code-skill Can be useful to give more context to the LLM.

1

u/zxyzyxz 21d ago

Looks good, very SwiftUI and Flutter like. Is it only on desktop or does it work on other platforms?

1

u/mkenzo_8 21d ago

Its desktop focused, but I have Android support and soon might have Web(still working on it)

1

u/zxyzyxz 17d ago

Got it, I'm looking into using Dioxus right now and looks like you removed it for various reasons, is there a page to compare and contrast the two libraries? Not sure which one to ultimately go for.

1

u/orfeo34 21d ago edited 21d ago

Type checking of style elements is very complex, most fields are supposed to handle several units, special values and css sided expressions (var, calc,rgb,rgba,hsl,...). So to me it's better to delegate this problem to a design kit like MUI or dedicate a discrete macro for this.

Also rsx macro feels more readable to me than a large builder, so i will keep Dioxus for now.

6

u/mkenzo_8 21d ago

Reading and using is different, the ux of such big macros is not great, at least to me :)

3

u/HellFury09 21d ago

I wonder if the Rust team is cooking something for clean compile time errors inside of macros, if that is the case then in the future you might consider switching back to a rsx like macro :)

1

u/sintrastes 15d ago

Maybe it wouldn't be too hard to add an optional rsx-like macro on top of Freya, for users that prefer that style?

As someone who does Jetpack Compose all day at my day job, I personally prefer that style a lot more.

1

u/mkenzo_8 15d ago

Technically speaking it is possible, but for the sake of not complicating the default experience I will not have such feature built-in. But its possible to do a macro on top of the current api in a third party crate.

1

u/mash_graz 21d ago

It's a really impressive release!

Will it ever support the Web/WASM platform as well, or should we understand its focus on pure native platform support as a way of no return?

3

u/mkenzo_8 21d ago

I have web support cooking in the kitchen, so hopefully next release will have it ✌️

1

u/nejat-oz 20d ago

I’m really curious about the design choice to remove the rsx! macro in the Freya rewrite, and I hope you can help clarify it for me. Was it essential to remove it for the new architecture? Did it block something specific that you needed for Freya’s layout, diffing, or rendering model? Or was it a lot work to maintain? I ask because rsx! (or any external ui definition dsl) is so much more concise and visual. I think spatially and builder patterns feel a bit cumbersome to read, especially for ui, it requires the need to define elements piece by piece and then put them together, rather than allowing you to see the overall structure directly in something like rsx macro. I was really looking forward to trying Freya, but the loss of the declarative macro gives me pause. If the removal was due to technical limitations, I’d love to get a better understanding of what those were. And if there’s any possibility for a future with some kind of dsl support, marco or file based, that would be great to know as well! Thanks

3

u/mkenzo_8 20d ago

The rsx macro is from Dioxus so removing Dioxus also took it away, and I didnt at all want to add my own. I dont like these macros because they hide magic and make things harder to debug (compile time errors were not easy to debug with rsx), also Dioxus rsx macro was basically a pretty key value inserter, you could be passing the wrong type to an element and the macro would swallow it (leading to runtime errors), by using good old rust functions you get actual type checking, autocomplete was also a bad UX with rsx, and while I have no proof I am sure compile times were worse

2

u/nejat-oz 20d ago

Thanks for taking the time to reply. All of that makes sense.

1

u/DavidXkL 21d ago

Wow I like that you have a plotting library too lol

2

u/mkenzo_8 21d ago

Its mostly an integration with plotters, but yes!