diff options
author | 2024-03-16 05:33:47 +0100 | |
---|---|---|
committer | 2024-03-16 05:33:47 +0100 | |
commit | c22269bff3085012d326a0df77bf27ad5bcb41b7 (patch) | |
tree | 1083f21d012ab2bac88fb51537d4dc431bc7f170 /examples/component/src | |
parent | 0524e9b4571d264018656418f02a1f9e27e268d7 (diff) | |
download | iced-c22269bff3085012d326a0df77bf27ad5bcb41b7.tar.gz iced-c22269bff3085012d326a0df77bf27ad5bcb41b7.tar.bz2 iced-c22269bff3085012d326a0df77bf27ad5bcb41b7.zip |
Introduce `Program` API
Diffstat (limited to 'examples/component/src')
-rw-r--r-- | examples/component/src/main.rs | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/examples/component/src/main.rs b/examples/component/src/main.rs index d4f99798..43ba3187 100644 --- a/examples/component/src/main.rs +++ b/examples/component/src/main.rs @@ -1,10 +1,10 @@ use iced::widget::container; -use iced::{Element, Length, Sandbox, Settings}; +use iced::{Element, Length}; use numeric_input::numeric_input; pub fn main() -> iced::Result { - Component::run(Settings::default()) + iced::run("Component - Iced", Component::update, Component::view) } #[derive(Default)] @@ -17,17 +17,7 @@ enum Message { NumericInputChanged(Option<u32>), } -impl Sandbox for Component { - type Message = Message; - - fn new() -> Self { - Self::default() - } - - fn title(&self) -> String { - String::from("Component - Iced") - } - +impl Component { fn update(&mut self, message: Message) { match message { Message::NumericInputChanged(value) => { |