我试图学习生 rust 和2Iced“板条箱,我目前正试图将我的应用程序设置为黑暗模式,但我不理解文档,不知道该怎么做。
use iced::{Application, Settings, executor, Theme};
struct MyApp;
impl Application for MyApp {
type Message = ();
type Flags = ();
type Executor = executor::Default;
type Theme = **Theme::Dark**; //error[E0573]: expected type, found variant "Theme::Dark"
fn main() {
let settings = Settings::default();
MyApp::run(settings).unwrap();
}
我不知道如何以另一种方式实现它。
我尝试了随机的东西,如:dark::dark::dark::dark
1条答案
按热度按时间cbjzeqam1#
正如错误所说,它需要一个类型,所以你必须执行
type Theme = Theme
,并且要设置黑暗主题,你需要实现theme
trait项:有关如何使用
iced
crate的示例,请查看github repo