summaryrefslogtreecommitdiffstats
path: root/examples/component/src
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector@hecrj.dev>2024-03-16 17:09:00 +0100
committerLibravatar GitHub <noreply@github.com>2024-03-16 17:09:00 +0100
commit503a48e89977437bf8b7bf485f416a15a2e83ed0 (patch)
tree30306bbaee7a31090ace9d7725d46c2c0027fe6b /examples/component/src
parent0524e9b4571d264018656418f02a1f9e27e268d7 (diff)
parentcfc0383bbfff083786840e3f1fd499e5991fa629 (diff)
downloadiced-503a48e89977437bf8b7bf485f416a15a2e83ed0.tar.gz
iced-503a48e89977437bf8b7bf485f416a15a2e83ed0.tar.bz2
iced-503a48e89977437bf8b7bf485f416a15a2e83ed0.zip
Merge pull request #2331 from iced-rs/program-api
`Program` API
Diffstat (limited to 'examples/component/src')
-rw-r--r--examples/component/src/main.rs16
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) => {