rust ui slint 尝试

191 阅读1分钟

slint 使用总结

example code:


fn main() {
    MainWindow::new().unwrap().run().unwrap();
}

slint::slint! {
    export component MainWindow inherits Window {
  
        width: 500px;
        height: 300px;
        // background: #3960D5;

        Text {
            text: "hello world";
            color: green;
        }
    }
}


运行结果

image.png

使用总结

Slint 运行速度快,体积小的跨平台的UI工具库,适合嵌入式开发,也能做桌面开发。

缺点: 
    1. 不适合做复杂UI
    2. 开发速度慢,每次修改UI都需要重新build。