903 B
903 B
New app
To get started, let's create a new Rust project for our app.
$ cargo new --bin weatherapp
$ cd weatherapp
Make sure our project builds by default
$ cargo run
Compiling weatherapp v0.1.0
Finished dev [unoptimized + debuginfo] target(s) in 0.41s
Running `target/debug/weatherapp`
Hello, world!
Adding Dioxus Desktop as a dependency
We can either edit our Cargo.toml directly:
[dependencies]
dioxus = { version = "*", features = ["desktop"]}
or use cargo-edit to add it via the CLI:
$ cargo add dioxus --features desktop
Setting up a hello world
Let's edit the project's main.rs and add the skeleton of
use dioxus::prelude::*;
fn main() {
dioxus::desktop::launch(app);
}
fn app(cx: Scope) -> Element {
cx.render(rsx!(
div { "hello world!" }
))
}