# Why I am making a declarative ui in pure Rust

**URL:** <https://users.rust-lang.org/t/why-i-am-making-a-declarative-ui-in-pure-rust/141777>\
**Category:** code review\
**Created:** [August 9, 2026, 7:17pm UTC](https://users.rust-lang.org/t/why-i-am-making-a-declarative-ui-in-pure-rust/141777 "2026-08-09T19:17:09Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![cottons29](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/cottons29/32/53466_2.png) [@cottons29](https://users.rust-lang.org/u/cottons29)\
**Post date:** [August 9, 2026, 7:17pm UTC](https://users.rust-lang.org/t/why-i-am-making-a-declarative-ui-in-pure-rust/141777/1 "2026-08-09T19:17:09Z")

</div>

before i decide to making it i went shopping on [crates.io](http://crates.io) first, here is my feeling:

**egui** : easy to write, no architecture to fight, just call and draw. but i have issue with the state management.  
**iced** : i am really not good with Elm's style.  
**gpui** : in the last two years, it has less documents, i need to find the example at the Zed's source code.  
**dioxus** : it's cross platform and declarative ui style but with macro, also i have to "fighting" wtih my IDE when i missing one '}'.  
**slint** : i need to learn another DSL for writting the UI, but their hot-reload is really nice.

My development is started when i found `skia-safe` at [crates.io](http://crates.io), but later on i meet the problem with cross-platform compilation, so i decide to write my own render engine using wgpu.

After almost one year of development, i have get the benefit from the Rust's trait and type system, my ui can be declare with builder pattern like this:

```rust
fn main() {
  AimerApp::start(
     Container::new()
        .child(
           Text::new("Hello World!")
             .text_align(TextAlign::MidCenter)
             .text_style(TextStyle::new().color(Color::BLACK)),
      ),
   )
}

```

I really satisfy with building pattern, i have using it to build my first website into WebAssembly and rendering inside the H5Canvas powered by WebGPU or WebGL.

here is my website [aimers.dev](https://aimers.dev)

> **[GitHub - Cottons29/aimer: A rust-implemented cross-platform app framework](https://github.com/Cottons29/aimer)**
>
> A rust-implemented cross-platform app framework

---

<div class="post-metadata">

**Author:** ![MOCKBA](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/mockba/32/41423_2.png) [@MOCKBA](https://users.rust-lang.org/u/MOCKBA)\
**Post date:** [August 9, 2026, 7:51pm UTC](https://users.rust-lang.org/t/why-i-am-making-a-declarative-ui-in-pure-rust/141777/2 "2026-08-09T19:51:32Z")

</div>

It's awesome. Back to 1998, I tried to do a declarative UI in C++ using something like:

```rust
almer_app << Text << AlignLeft << Color << Back;

```

But soon, I dropped my idea, and I'm glad that after 30 years someone resurrected it with a clear Rust syntax.

---

<div class="post-metadata">

**Author:** ![StefanSalewski](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/stefansalewski/32/36472_2.png) [@StefanSalewski](https://users.rust-lang.org/u/StefanSalewski)\
**Post date:** [August 9, 2026, 8:04pm UTC](https://users.rust-lang.org/t/why-i-am-making-a-declarative-ui-in-pure-rust/141777/3 "2026-08-09T20:04:23Z")

</div>

> [@cottons29](#):
>
> before i decide

What was your problem with Xilem? Well, currently no full-time developers and financial support, but I still think it has strong foundations, e.g. Vello for drawing, Parley for text.

---

<div class="post-metadata">

**Author:** ![cottons29](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/cottons29/32/53466_2.png) [@cottons29](https://users.rust-lang.org/u/cottons29)\
**Post date:** [August 9, 2026, 9:58pm UTC](https://users.rust-lang.org/t/why-i-am-making-a-declarative-ui-in-pure-rust/141777/4 "2026-08-09T21:58:28Z")

</div>

i have not trying Xilem before, it’s look very active in Github.

---

<div class="post-metadata">

**Author:** ![cottons29](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/cottons29/32/53466_2.png) [@cottons29](https://users.rust-lang.org/u/cottons29)\
**Post date:** [August 9, 2026, 10:01pm UTC](https://users.rust-lang.org/t/why-i-am-making-a-declarative-ui-in-pure-rust/141777/5 "2026-08-09T22:01:02Z")

</div>

Feel like building declarative ui with overloaded stream operators. That’s sound interesting.

---

<div class="post-metadata">

**Author:** ![MOCKBA](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/mockba/32/41423_2.png) [@MOCKBA](https://users.rust-lang.org/u/MOCKBA)\
**Post date:** [August 10, 2026, 12:04am UTC](https://users.rust-lang.org/t/why-i-am-making-a-declarative-ui-in-pure-rust/141777/6 "2026-08-10T00:04:08Z")

</div>

Exactly, mostly two operations were overloaded - `<<` and `+`. `+` used to compose attributes of an element, and `<<` used to glue relation between elements.

---

<div class="post-metadata">

**Author:** ![StefanSalewski](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/stefansalewski/32/36472_2.png) [@StefanSalewski](https://users.rust-lang.org/u/StefanSalewski)\
**Post date:** [August 10, 2026, 6:45am UTC](https://users.rust-lang.org/t/why-i-am-making-a-declarative-ui-in-pure-rust/141777/7 "2026-08-10T06:45:53Z")

</div>

> [@cottons29](#):
>
> i have not trying Xilem before, it’s look very active in Github.

Might be a serious omission. Xilem was created by thoughtful design, I think its predecessor was Druid and others. Its main author Raph Levien is very smart and productive. But he recently moved to Australia, working for a new company. And I think a few other workers, which have been paid to work on Xilem in the Past, are not any longer paid. So further development of Xilem might be insecure. Still, whoever is interested in creating one more Rust GUI toolkit might benefit from studying Xilem and its components. I used Xilem as one of my chess GUIs, see [GitHub - StefanSalewski/xilem-chess: First Xilem GUI for the tiny salewski chess engine · GitHub](https://github.com/StefanSalewski/xilem-chess)

---

<div class="post-metadata">

**Author:** ![StefanSalewski](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/stefansalewski/32/36472_2.png) [@StefanSalewski](https://users.rust-lang.org/u/StefanSalewski)\
**Post date:** [August 14, 2026, 12:39pm UTC](https://users.rust-lang.org/t/why-i-am-making-a-declarative-ui-in-pure-rust/141777/8 "2026-08-14T12:39:04Z")

</div>

Yesterday, they discussed the roadmap for 2026.

It seems that all retained GUIs in Rust including Xilem still have their problems, see

> **[Public view of Linebender - Rust UI | Zulip team chat](https://xi.zulipchat.com/#narrow/channel/354396-xilem/topic/Linebender.202026.20roadmap.20-.20Xilem/with/616424662)**
>
> Browse the publicly accessible channels in Linebender - Rust UI without logging in.

---

<div class="post-metadata">

**Author:** ![cottons29](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/cottons29/32/53466_2.png) [@cottons29](https://users.rust-lang.org/u/cottons29)\
**Post date:** [August 14, 2026, 1:36pm UTC](https://users.rust-lang.org/t/why-i-am-making-a-declarative-ui-in-pure-rust/141777/9 "2026-08-14T13:36:46Z")

</div>

I also see the blog that talking about the Xilem too

> **[A critical review of Xilem in 2026 - HackMD](https://hackmd.io/@s_haMSbyTAOWfoXc1aYNUg/Hka74gCwZg)**
>
> Lots of premature optimization

I wish you able to try write a "Hello World" using my framework. currently i am acting as Framework developer and Framework user.

---

<div class="post-metadata">

**Author:** ![fuji-184](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/fuji-184/32/46153_2.png) [@fuji-184](https://users.rust-lang.org/u/fuji-184)\
**Post date:** [August 15, 2026, 10:27am UTC](https://users.rust-lang.org/t/why-i-am-making-a-declarative-ui-in-pure-rust/141777/10 "2026-08-15T10:27:47Z")

</div>

Wow, it supports Android. I'll try it once it's stable because GPUI doesn't support Android yet

Is the incremental compile speed fast? For the convenience of editing the appearance because it requires viewing the results

I have an extreme idea to achieve a pleasant development experience for quickly viewing the edit result without purchasing a high end device. For the development process, transpile the code into HTML, CSS, and JavaScript. This will provide instant JavaScript compilation speed. The flow is as follows

Create a custom CLI to automate this. The CLI will do the following:

1. First, run `cargo check`
2. Then, transpile the user's Rust code into HTML, CSS, and JavaScript. The transpile speed is very fast, even with just one thread (I have created a transpiler project, it runs fast), much faster than creating a binary
3. Then, run the transpiled code (HTML, CSS, JS) so the user can see it on the web. This will also be very fast, even near instant

The difficulty is how to transpile Rust code that doesn't have 1:1 support from the JavaScript side. For example, if the user logic uses a spawn thread, you can change it to a spawn JS worker, but for third party library code, you can't know what kind of functionality the user will use to find similarities. However, it's possible if it's just UI

---

<div class="post-metadata">

**Author:** ![cottons29](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/cottons29/32/53466_2.png) [@cottons29](https://users.rust-lang.org/u/cottons29)\
**Post date:** [August 15, 2026, 10:39am UTC](https://users.rust-lang.org/t/why-i-am-making-a-declarative-ui-in-pure-rust/141777/11 "2026-08-15T10:39:57Z")

</div>

The incremental compile speed is slightly long at first compile and it's around 2-3 seconds after that. I also provide the CLI tools for automated process too. it would look like this:

 ![Screenshot 2026-08-15 at 5.34.31 PM](https://us1.discourse-cdn.com/flex019/uploads/rust_lang/original/3X/5/1/516569b7753d568acef86edfc8642801b9626e95.jpeg)

also the app it's self is lightweight and render using native graphic API, so it no need any browser. for android just need the `adb` and pair with device is ready.

---

<div class="post-metadata">

**Author:** ![fuji-184](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/fuji-184/32/46153_2.png) [@fuji-184](https://users.rust-lang.org/u/fuji-184)\
**Post date:** [August 15, 2026, 10:58am UTC](https://users.rust-lang.org/t/why-i-am-making-a-declarative-ui-in-pure-rust/141777/12 "2026-08-15T10:58:01Z")

</div>

What kind of machine specifications did you use to test it? The CPU, RAM, and OS

My extreme idea is only for `the development process`. For release builds, it's the same as compiling a normal Rust system to native without a browser. Because my bottleneck for creating a GUI in Rust is incremental compile speed, and very fast speed is essential for an enjoyable UI editing process. With that idea, the user can also see the UI result without setup, since all platforms support web out of the box. But there's part that doesn't have a suitable equivalent, as I mentioned earlier

Also, I like the CLI feature. The `doctor` command is obviously very helpful in finding the cause of problems. You can also add the `setup` command, which will install and setup platform dependencies, save them to the passed folder, and then automatically add them to the Path variable. This makes it very easy to get started, for example, the user just run

`cli setup the_folder_name`

For those who already have some OS dependencies but are missing something, you may able to add 'cli fix setup' to complete `cli doctor`

---

<div class="post-metadata">

**Author:** ![cottons29](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/cottons29/32/53466_2.png) [@cottons29](https://users.rust-lang.org/u/cottons29)\
**Post date:** [August 15, 2026, 11:12am UTC](https://users.rust-lang.org/t/why-i-am-making-a-declarative-ui-in-pure-rust/141777/13 "2026-08-15T11:12:20Z")

</div>

I am using Apple M4 (24GB RAM), macOS 27.0

mostly no need any dependencies if you are building app for your platform, unless you are targetting mobile. also the `setup` may corrupt the user's development environment. so i prefer let user setting that manually. also user just press `r` to rebuild and run the app.

---

<div class="post-metadata">

**Author:** ![fuji-184](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/fuji-184/32/46153_2.png) [@fuji-184](https://users.rust-lang.org/u/fuji-184)\
**Post date:** [August 15, 2026, 1:10pm UTC](https://users.rust-lang.org/t/why-i-am-making-a-declarative-ui-in-pure-rust/141777/14 "2026-08-15T13:10:42Z")

</div>

Umm that is a high end device

What I mean dependencies is like, Android SDK, and configuring it to make it work with your framework

The `setup` command is setup from scratch without any existing Android dev setup, like downloading Android SDK, Android platform tool from scratch and then configuring the bridge like path setup, etc. It does not corrupt anything because there is no existing setup to corrupt in the first place

The command `fix` is to auto fix if some deps are missing based on the command `doctor`. It is possible to do this without corrupting the setup, because this is just an indirect runner for the normal Android setup fix

---

<div class="post-metadata">

**Author:** ![cottons29](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/cottons29/32/53466_2.png) [@cottons29](https://users.rust-lang.org/u/cottons29)\
**Post date:** [August 17, 2026, 8:56pm UTC](https://users.rust-lang.org/t/why-i-am-making-a-declarative-ui-in-pure-rust/141777/15 "2026-08-17T20:56:38Z")

</div>

![Screenshot 2026-08-18 at 3.53.46 AM](https://us1.discourse-cdn.com/flex019/uploads/rust_lang/original/3X/e/4/e4c135158bf28dd925a605c824f7e1f61aeb1041.webp)My framework now able to do this, it can handle complex layout now!!!

---

<div class="post-metadata">

**Author:** ![jeremytheking](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/jeremytheking/32/53562_2.png) [@jeremytheking](https://users.rust-lang.org/u/jeremytheking)\
**Post date:** [August 19, 2026, 6:39am UTC](https://users.rust-lang.org/t/why-i-am-making-a-declarative-ui-in-pure-rust/141777/16 "2026-08-19T06:39:36Z")

</div>

> [@cottons29](#):
>
> ![Screenshot 2026-08-18 at 3.53.46 AM](https://us1.discourse-cdn.com/flex019/uploads/rust_lang/original/3X/e/4/e4c135158bf28dd925a605c824f7e1f61aeb1041.webp)
> 
> My framework now able to do this, it can handle complex layout now!!!

hmm that looks like a client (or at least a design structure) for the Rust lang forum? is the source code available for that?

---

<div class="post-metadata">

**Author:** ![cottons29](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/cottons29/32/53466_2.png) [@cottons29](https://users.rust-lang.org/u/cottons29)\
**Post date:** [August 19, 2026, 7:05am UTC](https://users.rust-lang.org/t/why-i-am-making-a-declarative-ui-in-pure-rust/141777/17 "2026-08-19T07:05:25Z")

</div>

The Source code of it you can find at [https://github.com/Cottons29/rust-forum](https://github.com/Cottons29/rust-forum), currently is too early stage for RustForum. i am just testing my framework by building it.

---

<div class="post-metadata">

**Author:** ![vi-is-ramen](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/vi-is-ramen/32/53228_2.png) [@vi-is-ramen](https://users.rust-lang.org/u/vi-is-ramen)\
**Post date:** [August 20, 2026, 5:18pm UTC](https://users.rust-lang.org/t/why-i-am-making-a-declarative-ui-in-pure-rust/141777/18 "2026-08-20T17:18:59Z")

</div>

man it looks amazing, please don't abandon this app

---

<div class="post-metadata">

**Author:** ![cottons29](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/cottons29/32/53466_2.png) [@cottons29](https://users.rust-lang.org/u/cottons29)\
**Post date:** [August 20, 2026, 5:23pm UTC](https://users.rust-lang.org/t/why-i-am-making-a-declarative-ui-in-pure-rust/141777/19 "2026-08-20T17:23:16Z")

</div>

hahaha, not abandon it, i am doing it parallel with my framework.

---

<div class="post-metadata">

**Author:** ![vi-is-ramen](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/vi-is-ramen/32/53228_2.png) [@vi-is-ramen](https://users.rust-lang.org/u/vi-is-ramen)\
**Post date:** [August 20, 2026, 5:34pm UTC](https://users.rust-lang.org/t/why-i-am-making-a-declarative-ui-in-pure-rust/141777/20 "2026-08-20T17:34:57Z")

</div>

btw idk is it important for you, but aimers.dev isn't available from Russia

[Next page](https://users.rust-lang.org/t/why-i-am-making-a-declarative-ui-in-pure-rust/141777.md?page=2)
