summaryrefslogtreecommitdiffstats
path: root/examples/tour
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/tour
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/tour')
-rw-r--r--examples/tour/src/main.rs20
1 files changed, 13 insertions, 7 deletions
diff --git a/examples/tour/src/main.rs b/examples/tour/src/main.rs
index f5791ad7..23c4040d 100644
--- a/examples/tour/src/main.rs
+++ b/examples/tour/src/main.rs
@@ -4,7 +4,7 @@ use iced::widget::{
scrollable, slider, text, text_input, toggler, vertical_space,
};
use iced::widget::{Button, Column, Container, Slider};
-use iced::{Color, Element, Font, Length, Pixels, Sandbox, Settings};
+use iced::{Color, Element, Font, Length, Pixels};
pub fn main() -> iced::Result {
#[cfg(target_arch = "wasm32")]
@@ -16,7 +16,9 @@ pub fn main() -> iced::Result {
#[cfg(not(target_arch = "wasm32"))]
tracing_subscriber::fmt::init();
- Tour::run(Settings::default())
+ iced::sandbox(Tour::title, Tour::update, Tour::view)
+ .centered()
+ .run()
}
pub struct Tour {
@@ -24,11 +26,9 @@ pub struct Tour {
debug: bool,
}
-impl Sandbox for Tour {
- type Message = Message;
-
- fn new() -> Tour {
- Tour {
+impl Tour {
+ fn new() -> Self {
+ Self {
steps: Steps::new(),
debug: false,
}
@@ -90,6 +90,12 @@ impl Sandbox for Tour {
}
}
+impl Default for Tour {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
#[derive(Debug, Clone)]
pub enum Message {
BackPressed,