diff --git a/justfile b/justfile new file mode 100644 index 0000000..c51735a --- /dev/null +++ b/justfile @@ -0,0 +1,10 @@ +_default: + @just --list + + +run *args: + cargo run -- {{args}} + + +floem: + cargo run --bin floem diff --git a/src/bin/floem.rs b/src/bin/floem.rs new file mode 100644 index 0000000..86183c5 --- /dev/null +++ b/src/bin/floem.rs @@ -0,0 +1,20 @@ +use anyhow::Result; +use floem::{reactive::create_signal, views::{button, label}, IntoView}; + +pub fn main() -> Result<()> { + floem::launch(app_view); + Ok(()) +} + +fn app_view() -> impl IntoView { + + let (counter, mut set_counter) = create_signal(0); + + ( + label(move || format!("Value: {counter}")), + ( + button("Increment").action(move || set_counter +=1), + button("Decrement").action(move || set_counter -=1), + ) + ) +} diff --git a/src/floem.rs b/src/floem.rs deleted file mode 100644 index 77ab7c0..0000000 --- a/src/floem.rs +++ /dev/null @@ -1,7 +0,0 @@ -use anyhow::Result; - - -pub(crate) fn main() -> Result<()> { - - Ok(()) -} diff --git a/src/gpui.rs b/src/gpui.rs index 3996052..42497d8 100644 --- a/src/gpui.rs +++ b/src/gpui.rs @@ -1,7 +1,5 @@ - use anyhow::Result; -pub(crate) fn main() -> Result<()> { - +pub fn main() -> Result<()> { Ok(()) } diff --git a/src/main.rs b/src/main.rs index 69e882c..0adc66a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,3 @@ -mod floem; mod gpui; mod iced; @@ -18,7 +17,6 @@ enum Command { Egui, Druid, Gpui, - Floem } fn main() -> Result<()> { @@ -30,7 +28,6 @@ fn main() -> Result<()> { Command::Egui => egui_main(), Command::Druid => druid_main(), Command::Gpui => gpui::main(), - Command::Floem => floem::main(), } }