SixtyFPS becomes Slint
A declarative UI language for embedded and desktop.
Slint started life as SixtyFPS (first crates.io publish October 2020) and was renamed in early 2022; the slint crate first appears in February 2022. For users the migration was mostly a rename. This diff is illustrative and was not compiled.
-sixtyfps = "0.2"
+slint = "1"
-sixtyfps::sixtyfps! { ... }
+slint::slint! { ... }
-sixtyfps_build::compile("ui/app.60")
+slint_build::compile("ui/app.slint") Slint's idea is a separate declarative language, .slint, compiled to Rust at build time. Properties and callbacks are declared in the UI file, and your Rust code supplies behaviour by attaching handlers. This snippet, using the slint! macro, compiles against Slint 1.18.
use book_error::Result;
slint::slint! {
export component App inherits Window {
callback save(string);
in-out property <string> status: "idle";
TextInput { text: "draft"; accepted => { root.save(self.text); } }
Text { y: 40px; text: root.status; }
}
}
fn main() -> Result<()> {
let ui = App::new()?;
let weak = ui.as_weak();
// The .slint side declares callbacks and properties; Rust supplies behaviour.
ui.on_save(move |text| {
// The window may already be gone when this fires; that is not an error.
if let Some(ui) = weak.upgrade() {
ui.set_status(format!("saved {} bytes", text.len()).into());
}
});
ui.run()?;
Ok(())
} The lockfile shows a toolkit that keeps its options open: a winit backend, three renderers (femtovg for OpenGL and a software renderer are the defaults; Skia is also available), AccessKit for screen readers, and in our resolution it already depends on wgpu, Parley and Taffy. It is offered under the GPLv3, a royalty-free license, or a commercial license.