Closed6

Rustのマルチプラットフォームアプリ開発フレームワーク dioxus に入門する

higumachanhigumachan

いつもはClionでやっているが DioxusはRust analyzerに特化してるみたいな書かれ方をしているので、VS Codeでやってみることにする。

higumachanhigumachan
cargo install dioxus-cli

でコンパイルエラーが出る

error[E0599]: no function or associated item named `new_immediate` found for trait object `dyn notify::Watcher` in the current scope
  --> /Users/yuta/.cargo/registry/src/github.com-1ecc6299db9ec823/dioxus-cli-0.1.0/src/develop.rs:43:52
   |
43 |     let mut watcher: RecommendedWatcher = Watcher::new_immediate(move |res| {
   |                                                    ^^^^^^^^^^^^^ function or associated item not found in `dyn notify::Watcher`

error[E0308]: mismatched types
  --> /Users/yuta/.cargo/registry/src/github.com-1ecc6299db9ec823/dioxus-cli-0.1.0/src/develop.rs:53:16
   |
53 |         .watch(src_dir.join("src"), RecursiveMode::Recursive)
   |                ^^^^^^^^^^^^^^^^^^^
   |                |
   |                expected `&std::path::Path`, found struct `std::path::PathBuf`
   |                help: consider borrowing here: `&src_dir.join("src")`

error[E0308]: mismatched types
  --> /Users/yuta/.cargo/registry/src/github.com-1ecc6299db9ec823/dioxus-cli-0.1.0/src/develop.rs:57:16
   |
57 |         .watch(src_dir.join("examples"), RecursiveMode::Recursive)
   |                ^^^^^^^^^^^^^^^^^^^^^^^^
   |                |
   |                expected `&std::path::Path`, found struct `std::path::PathBuf`
   |                help: consider borrowing here: `&src_dir.join("examples")`

Some errors have detailed explanations: E0308, E0599.
For more information about an error, try `rustc --explain E0308`.
error: could not compile `dioxus-cli` due to 3 previous errors
warning: build failed, waiting for other jobs to finish...
error: failed to compile `dioxus-cli v0.1.0`, intermediate artifacts can be found at `/var/folders/19/5t6n7df17sg12sj81t7d48r00000gn/T/cargo-install2kSPWm`

Caused by:
  build failed
higumachanhigumachan

Hello Worldは動いた。

一点

cargo add dioxus --features desktop

がエラーを起こすので、手動で以下のようにCargo.tomlを編集した。

[package]
name = "hello-dioxus"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
dioxus = { version = "0.1.6", features = ["desktop"] }
このスクラップは2022/01/06にクローズされました