Olivier Faure, January 19, 2024
As you might haveactually heard by now, Google Fonts is financing me this year to work on Xilem.
I’m not alone in that: Aaron Muir Hamilton, Daniel McNab and Matt Campbell were moneyed as well to work on numerous parts of the environment. I think this is Matt’s 3rd year getting moneying from Google Fonts.
Now, what I was workedwith to do may be uncertain to you. The scope we concurred on was relatively broad and was specified as “contributing to Xilem’s view tree and designer experience”, however that might suggest a lot of things.
The veryfirst thing I desire to do is interact a clearer photo. I have a a lot of prepares for Xilem, and they include significant modifications from the present architectures, modifications that may be stressing to the neighborhood at big or even to Raph Levien. I definitely wear’t desire to offer the impression that I’m wresting the task away from the Linebender neighborhood for Google’s interest, and that implies being transparent early and frequently about the things I desire to remodel.
What I desire for Xilem
Xilem is a research-and-development task, the newest in a series (Xi-Core, Druid, Crochet, Lasagna, Idiopath), that intends to checkout how UI advancement can be made suitable with Rust.
This may feel a little banal now, since Rust GUI structures are popping up allover and beginning to settle on comparable patterns, however those patterns weren’t apparent in 2019! Xilem is extremely various from Druid, and getting to its existing architecture hasactually been a procedure.
Xilem hasactually been perma-experimental consideringthat May2022 Once it got began, the primary Druid maintainers stopped contributing practically completely with the expectation that Xilem would change Druid assoonas it was allset. Unfortunately, it still hasn’t made sufficient development to be on parity with Druid, yet Druid still lies deserted, which isn’t fantastic when individuals had began relying on it.
It’s arguable how much this might haveactually been prevented. As I’ve pointed out before, the Rust GUI community is topic to huge yak-shaving: lotsof of us came here because we desired to construct a text editor, and now we’re all knowing about text rendering, text modifying, compositing, easeofaccess trees, utilizing monoids to execute things on the GPU, ECS, and some principles that I’m definitely particular Raph made up like Bézier courses and C++.
And to a specific level, yak-shaving is great! “I’m going to do muchbetter than X without knowing how X works” is a kid’s mindset. It’s the mindset we all start with, and it fills us with guts, however that guts is ignorant. True enhancement comes from keeping that guts after costs years knowing how tremendous the issue area is, and keeping faith that it’s possible to do muchbetter. The Rust neighborhood is one that worths not simply doing things from scratch, however likewise discovering from the past to get them .
This is excellent, however the “get them best” part takes a lot of time, and in the meantime, I’d argue that we’ve disregarded end users a bit. We’ve deserted Druid before Xilem was allset as an alternative, and then we worked on fundamental and speculative jobs that would make Xilem morepowerful and sounder in the long term, however left the task in an uncomfortable state in the meantime (except for the web backend, which made a lot of development).
In the ECS-backed GUI structure post I connected, Bevy maintainers have this to state:
Not to be too severe, however a lot of the existing Rust GUI services… simply aren’t really good. There’s a lot of satisfactory choices, however they all have non-trivial disadvantages. No one has truly increased to the leading as a clear winner. […] Deep down, we all understand that we can do muchbetter, and we should.
My aspiration is to makes this paragraph outdated before the end of the year. I desire Xilem to get back to being recommended to newbies in the verysame breath as Iced and SlintUI. In the next coupleof years, I desire the whole community to get to a point where individuals talk about Rust GUI like they talk about ripgrep or rustls.
To provide one particular example: my individual objective is to carryout smooth hot reloading for Xilem before the end of2024 I think it’s possible, and I think doing it will drastically modification the method individuals believe about Rust GUI, along with other enhancements I hope to unlock over time.
In the muchshorter term, my strategy is to focus on standard functions, widgets and styling choices so individuals can experiment with Xilem, structure on Raph’s work on Vello over the past year. John Skottis’s Xilem UX Notes offer a great image of the kinds of things I’ll be working on.
The other huge short-term toppriority is going to be documents. We’ve seen a lot of individuals grumble that the Linebender job were improperly recorded and difficult to get into; it was the most popular response to our 2024 statement, however it echoed beliefs we’d seen inthepast. We’re mindful of the issue, and we mean to work on it.
In the medium term, I likewise strategy to work on the efficiency element of Xilem. People from Google Fonts haveactually revealed interest in seeing how much efficiency we can get from Rust UI. While my objective isn’t limited to efficiency work, it will be an continuous focus, specifically giventhat it’s an location where the Rust language brings special chances. I’ll go into more information on Rust efficiency and power performance in a lateron shortarticle.
Major modifications I desire to carryout quickly
These are the huge modifications I desire to work on quickly. Realistically, “soon” is going to be relative, since some of these modifications are going to be questionable, and part of the work is going to be convincing individuals of their worth.
Switching to Masonry as a backend
Okay, this one makes me blush a bit.
I’m the just maintainer of Masonry, a GUI cage with hardly over 300 stars on Github and little outdoors interest. Can I actually validate taking the cash Google pays me to enhance Xilem and costs my time on Masonry rather?
That option isn’t random, mind you: Masonry was forked from Druid, Xilem’s forefather, and in truth Xilem and Masonry share a lot of code right now.
In reality, I’d argue that Masonry’s codebase is of muchbetter quality than Xilem’s present native backend. This isn’t indicated to be a put-down of the work of Xilem maintainers; rather, it’s the result of a distinction in concerns. Nobody was really interested in Xilem’s native backend (though Raph was conscious of its value, forthisreason me getting paid to compose this), and lots of individuals were extremely interested in the frontend and the web backends, forthatreason the frontend and web backends saw the most work.
From our RFC#0001:
As a result, Xilem’s native backend is in a bad state:
- There is code commented out.
- There are entire modules commented out.
- There is documents referring to products from Druid that no longer exist.
- There are TODOs without an associated concern.
Masonry’s backend codebase is a muchhealthier beginning point. Masonry likewise comes with some integrated advantages, like effective system tests and a structured widget chart.
It’s not clear whether we desire to import the Masonry codebase, the crate, or the whole repository, and it’s not clear what the supreme branding oughtto be. The RFC lays out the various possibilities, and conversation is still continuous, so the neighborhood can reach a agreement before doing more work (including perhaps not utilizing Masonry at all).
If we do move forward with this, then Masonry will require some porting work:
- Using Vello and Parley rather of Piet.
- Using Glazier rather of druid-shell.
- Integrating AccessKit.
- Removing the dependence on GTK.
AccessKit assistance in specific is table stakes, by now. The Rust community is assembling on the concept that easeofaccess (or at least, screen reader assistance) needto be incorporated early on in the style of GUI structures, not added on at the end.
There are other things Xilem included over Druid (notably virtual lists and async assistance), however I think Maso