summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/arc/Cargo.toml3
-rw-r--r--examples/bezier_tool/Cargo.toml3
-rw-r--r--examples/checkbox/Cargo.toml2
-rw-r--r--examples/clock/Cargo.toml6
-rw-r--r--examples/color_palette/Cargo.toml6
-rw-r--r--examples/combo_box/Cargo.toml3
-rw-r--r--examples/component/Cargo.toml3
-rw-r--r--examples/counter/Cargo.toml2
-rw-r--r--examples/custom_quad/Cargo.toml3
-rw-r--r--examples/custom_widget/Cargo.toml3
-rw-r--r--examples/download_progress/Cargo.toml3
-rw-r--r--examples/events/Cargo.toml3
-rw-r--r--examples/events/src/main.rs5
-rw-r--r--examples/exit/Cargo.toml2
-rw-r--r--examples/game_of_life/Cargo.toml12
-rw-r--r--examples/game_of_life/src/main.rs2
-rw-r--r--examples/geometry/Cargo.toml3
-rw-r--r--examples/integration/Cargo.toml20
-rw-r--r--examples/integration/src/main.rs2
-rw-r--r--examples/lazy/Cargo.toml3
-rw-r--r--examples/loading_spinners/Cargo.toml8
-rw-r--r--examples/modal/Cargo.toml3
-rw-r--r--examples/modal/src/main.rs8
-rw-r--r--examples/multitouch/Cargo.toml7
-rw-r--r--examples/multitouch/src/main.rs2
-rw-r--r--examples/pane_grid/Cargo.toml3
-rw-r--r--examples/pane_grid/src/main.rs14
-rw-r--r--examples/pick_list/Cargo.toml3
-rw-r--r--examples/pokedex/Cargo.toml11
-rw-r--r--examples/pokedex/src/main.rs2
-rw-r--r--examples/progress_bar/Cargo.toml2
-rw-r--r--examples/qr_code/Cargo.toml3
-rw-r--r--examples/screenshot/Cargo.toml8
-rw-r--r--examples/screenshot/src/main.rs9
-rw-r--r--examples/scrollable/Cargo.toml6
-rw-r--r--examples/sierpinski_triangle/Cargo.toml6
-rw-r--r--examples/slider/Cargo.toml2
-rw-r--r--examples/solar_system/Cargo.toml6
-rw-r--r--examples/solar_system/src/main.rs2
-rw-r--r--examples/stopwatch/Cargo.toml3
-rw-r--r--examples/stopwatch/src/main.rs16
-rw-r--r--examples/styling/Cargo.toml2
-rw-r--r--examples/svg/Cargo.toml3
-rw-r--r--examples/system_information/Cargo.toml6
-rw-r--r--examples/toast/Cargo.toml3
-rw-r--r--examples/toast/src/main.rs8
-rw-r--r--examples/todos/Cargo.toml12
-rw-r--r--examples/todos/src/main.rs40
-rw-r--r--examples/tooltip/Cargo.toml3
-rw-r--r--examples/tour/Cargo.toml6
-rw-r--r--examples/tour/src/main.rs2
-rw-r--r--examples/url_handler/Cargo.toml2
-rw-r--r--examples/url_handler/src/main.rs13
-rw-r--r--examples/visible_bounds/Cargo.toml6
-rw-r--r--examples/visible_bounds/src/main.rs8
-rw-r--r--examples/websocket/Cargo.toml12
56 files changed, 188 insertions, 151 deletions
diff --git a/examples/arc/Cargo.toml b/examples/arc/Cargo.toml
index e6e74363..5012ff82 100644
--- a/examples/arc/Cargo.toml
+++ b/examples/arc/Cargo.toml
@@ -6,4 +6,5 @@ edition = "2021"
publish = false
[dependencies]
-iced = { path = "../..", features = ["canvas", "tokio", "debug"] }
+iced.workspace = true
+iced.features = ["canvas", "tokio", "debug"]
diff --git a/examples/bezier_tool/Cargo.toml b/examples/bezier_tool/Cargo.toml
index 890e3027..b2547ff1 100644
--- a/examples/bezier_tool/Cargo.toml
+++ b/examples/bezier_tool/Cargo.toml
@@ -6,4 +6,5 @@ edition = "2021"
publish = false
[dependencies]
-iced = { path = "../..", features = ["canvas"] }
+iced.workspace = true
+iced.features = ["canvas"]
diff --git a/examples/checkbox/Cargo.toml b/examples/checkbox/Cargo.toml
index dde8f910..1e027c4c 100644
--- a/examples/checkbox/Cargo.toml
+++ b/examples/checkbox/Cargo.toml
@@ -6,4 +6,4 @@ edition = "2021"
publish = false
[dependencies]
-iced = { path = "../.." }
+iced.workspace = true
diff --git a/examples/clock/Cargo.toml b/examples/clock/Cargo.toml
index 5e869eb5..2d3d5908 100644
--- a/examples/clock/Cargo.toml
+++ b/examples/clock/Cargo.toml
@@ -6,5 +6,7 @@ edition = "2021"
publish = false
[dependencies]
-iced = { path = "../..", features = ["canvas", "tokio", "debug"] }
-time = { version = "0.3.5", features = ["local-offset"] }
+iced.workspace = true
+iced.features = ["canvas", "tokio", "debug"]
+
+time = { version = "0.3", features = ["local-offset"] }
diff --git a/examples/color_palette/Cargo.toml b/examples/color_palette/Cargo.toml
index 3be732bb..2da6c6ed 100644
--- a/examples/color_palette/Cargo.toml
+++ b/examples/color_palette/Cargo.toml
@@ -6,5 +6,7 @@ edition = "2021"
publish = false
[dependencies]
-iced = { path = "../..", features = ["canvas", "palette"] }
-palette = "0.7.0"
+iced.workspace = true
+iced.features = ["canvas", "palette"]
+
+palette.workspace = true
diff --git a/examples/combo_box/Cargo.toml b/examples/combo_box/Cargo.toml
index be1b5e32..0f5ecf2a 100644
--- a/examples/combo_box/Cargo.toml
+++ b/examples/combo_box/Cargo.toml
@@ -6,4 +6,5 @@ edition = "2021"
publish = false
[dependencies]
-iced = { path = "../..", features = ["debug"] }
+iced.workspace = true
+iced.features = ["debug"]
diff --git a/examples/component/Cargo.toml b/examples/component/Cargo.toml
index 9db1e6b4..83b7b8a4 100644
--- a/examples/component/Cargo.toml
+++ b/examples/component/Cargo.toml
@@ -6,4 +6,5 @@ edition = "2021"
publish = false
[dependencies]
-iced = { path = "../..", features = ["debug", "lazy"] }
+iced.workspace = true
+iced.features = ["debug", "lazy"]
diff --git a/examples/counter/Cargo.toml b/examples/counter/Cargo.toml
index e31f440f..1e9bba6b 100644
--- a/examples/counter/Cargo.toml
+++ b/examples/counter/Cargo.toml
@@ -6,4 +6,4 @@ edition = "2021"
publish = false
[dependencies]
-iced = { path = "../.." }
+iced.workspace = true
diff --git a/examples/custom_quad/Cargo.toml b/examples/custom_quad/Cargo.toml
index f097c2dd..31b5055d 100644
--- a/examples/custom_quad/Cargo.toml
+++ b/examples/custom_quad/Cargo.toml
@@ -6,4 +6,5 @@ edition = "2021"
publish = false
[dependencies]
-iced = { path = "../..", features = ["advanced"] }
+iced.workspace = true
+iced.features = ["advanced"]
diff --git a/examples/custom_widget/Cargo.toml b/examples/custom_widget/Cargo.toml
index dda0efe8..1e94bc52 100644
--- a/examples/custom_widget/Cargo.toml
+++ b/examples/custom_widget/Cargo.toml
@@ -6,4 +6,5 @@ edition = "2021"
publish = false
[dependencies]
-iced = { path = "../..", features = ["advanced"] }
+iced.workspace = true
+iced.features = ["advanced"]
diff --git a/examples/download_progress/Cargo.toml b/examples/download_progress/Cargo.toml
index 212832f4..18a49f66 100644
--- a/examples/download_progress/Cargo.toml
+++ b/examples/download_progress/Cargo.toml
@@ -6,7 +6,8 @@ edition = "2021"
publish = false
[dependencies]
-iced = { path = "../..", features = ["tokio"] }
+iced.workspace = true
+iced.features = ["tokio"]
[dependencies.reqwest]
version = "0.11"
diff --git a/examples/events/Cargo.toml b/examples/events/Cargo.toml
index 15ffc0af..87315a10 100644
--- a/examples/events/Cargo.toml
+++ b/examples/events/Cargo.toml
@@ -6,4 +6,5 @@ edition = "2021"
publish = false
[dependencies]
-iced = { path = "../..", features = ["debug"] }
+iced.workspace = true
+iced.features = ["debug"]
diff --git a/examples/events/src/main.rs b/examples/events/src/main.rs
index 7f3a5e1d..32d0da2c 100644
--- a/examples/events/src/main.rs
+++ b/examples/events/src/main.rs
@@ -1,9 +1,8 @@
use iced::alignment;
+use iced::event::{self, Event};
use iced::executor;
-use iced::subscription;
use iced::widget::{button, checkbox, container, text, Column};
use iced::window;
-use iced::Event;
use iced::{
Alignment, Application, Command, Element, Length, Settings, Subscription,
Theme,
@@ -71,7 +70,7 @@ impl Application for Events {
}
fn subscription(&self) -> Subscription<Message> {
- subscription::events().map(Message::EventOccurred)
+ event::listen().map(Message::EventOccurred)
}
fn view(&self) -> Element<Message> {
diff --git a/examples/exit/Cargo.toml b/examples/exit/Cargo.toml
index 34d0789a..b06fbadc 100644
--- a/examples/exit/Cargo.toml
+++ b/examples/exit/Cargo.toml
@@ -5,4 +5,4 @@ edition = "2021"
publish = false
[dependencies]
-iced = { path = "../.." }
+iced.workspace = true
diff --git a/examples/game_of_life/Cargo.toml b/examples/game_of_life/Cargo.toml
index 6de45db6..9b291de8 100644
--- a/examples/game_of_life/Cargo.toml
+++ b/examples/game_of_life/Cargo.toml
@@ -6,8 +6,10 @@ edition = "2021"
publish = false
[dependencies]
-iced = { path = "../..", features = ["canvas", "tokio", "debug"] }
-tokio = { version = "1.0", features = ["sync"] }
-itertools = "0.9"
-rustc-hash = "1.1"
-env_logger = "0.10"
+iced.workspace = true
+iced.features = ["debug", "canvas", "tokio"]
+
+itertools = "0.11"
+rustc-hash.workspace = true
+tokio = { workspace = true, features = ["sync"] }
+tracing-subscriber = "0.3"
diff --git a/examples/game_of_life/src/main.rs b/examples/game_of_life/src/main.rs
index e951d734..a2038f12 100644
--- a/examples/game_of_life/src/main.rs
+++ b/examples/game_of_life/src/main.rs
@@ -18,7 +18,7 @@ use iced::{
use std::time::{Duration, Instant};
pub fn main() -> iced::Result {
- env_logger::builder().format_timestamp(None).init();
+ tracing_subscriber::fmt::init();
GameOfLife::run(Settings {
antialiasing: true,
diff --git a/examples/geometry/Cargo.toml b/examples/geometry/Cargo.toml
index 6068d651..9606dcb3 100644
--- a/examples/geometry/Cargo.toml
+++ b/examples/geometry/Cargo.toml
@@ -6,4 +6,5 @@ edition = "2021"
publish = false
[dependencies]
-iced = { path = "../..", features = ["advanced"] }
+iced.workspace = true
+iced.features = ["advanced"]
diff --git a/examples/integration/Cargo.toml b/examples/integration/Cargo.toml
index 22914742..032cc75e 100644
--- a/examples/integration/Cargo.toml
+++ b/examples/integration/Cargo.toml
@@ -6,19 +6,15 @@ edition = "2021"
publish = false
[dependencies]
-iced_winit = { path = "../../winit" }
-iced_wgpu = { path = "../../wgpu" }
-iced_widget = { path = "../../widget" }
-iced_renderer = { path = "../../renderer", features = ["wgpu"] }
-env_logger = "0.10"
+iced_winit.workspace = true
+iced_wgpu.workspace = true
+iced_widget.workspace = true
+
+tracing-subscriber = "0.3"
[target.'cfg(target_arch = "wasm32")'.dependencies]
-console_error_panic_hook = "0.1.7"
-console_log = "0.2.0"
-log = "0.4"
+console_error_panic_hook = "0.1"
+console_log = "1.0"
+log.workspace = true
wasm-bindgen = "0.2"
web-sys = { version = "0.3", features = ["Element", "HtmlCanvasElement", "Window", "Document"] }
-# This dependency a little bit quirky, it is deep in the tree and without `js` feature it
-# refuses to work with `wasm32-unknown-unknown target`. Unfortunately, we need this patch
-# to make it work
-getrandom = { version = "0.2", features = ["js"] }
diff --git a/examples/integration/src/main.rs b/examples/integration/src/main.rs
index 98b58f16..af48af5f 100644
--- a/examples/integration/src/main.rs
+++ b/examples/integration/src/main.rs
@@ -41,7 +41,7 @@ pub fn main() -> Result<(), Box<dyn std::error::Error>> {
};
#[cfg(not(target_arch = "wasm32"))]
- env_logger::init();
+ tracing_subscriber::fmt::init();
// Initialize winit
let event_loop = EventLoop::new();
diff --git a/examples/lazy/Cargo.toml b/examples/lazy/Cargo.toml
index e03e89a9..4ccb9584 100644
--- a/examples/lazy/Cargo.toml
+++ b/examples/lazy/Cargo.toml
@@ -6,4 +6,5 @@ edition = "2021"
publish = false
[dependencies]
-iced = { path = "../..", features = ["debug", "lazy"] }
+iced.workspace = true
+iced.features = ["debug", "lazy"]
diff --git a/examples/loading_spinners/Cargo.toml b/examples/loading_spinners/Cargo.toml
index ee9a48aa..a32da386 100644
--- a/examples/loading_spinners/Cargo.toml
+++ b/examples/loading_spinners/Cargo.toml
@@ -6,6 +6,8 @@ edition = "2021"
publish = false
[dependencies]
-iced = { path = "../..", features = ["advanced", "canvas"] }
-lyon_algorithms = "1"
-once_cell = "1"
+iced.workspace = true
+iced.features = ["advanced", "canvas"]
+
+lyon_algorithms = "1.0"
+once_cell.workspace = true \ No newline at end of file
diff --git a/examples/modal/Cargo.toml b/examples/modal/Cargo.toml
index 3ac61e6a..009d9653 100644
--- a/examples/modal/Cargo.toml
+++ b/examples/modal/Cargo.toml
@@ -6,4 +6,5 @@ edition = "2021"
publish = false
[dependencies]
-iced = { path = "../..", features = ["advanced"] }
+iced.workspace = true
+iced.features = ["advanced"]
diff --git a/examples/modal/src/main.rs b/examples/modal/src/main.rs
index 8a48f830..4aa70886 100644
--- a/examples/modal/src/main.rs
+++ b/examples/modal/src/main.rs
@@ -1,12 +1,14 @@
+use iced::event::{self, Event};
use iced::executor;
use iced::keyboard;
-use iced::subscription::{self, Subscription};
use iced::theme;
use iced::widget::{
self, button, column, container, horizontal_space, pick_list, row, text,
text_input,
};
-use iced::{Alignment, Application, Command, Element, Event, Length, Settings};
+use iced::{
+ Alignment, Application, Command, Element, Length, Settings, Subscription,
+};
use modal::Modal;
use std::fmt;
@@ -49,7 +51,7 @@ impl Application for App {
}
fn subscription(&self) -> Subscription<Self::Message> {
- subscription::events().map(Message::Event)
+ event::listen().map(Message::Event)
}
fn update(&mut self, message: Message) -> Command<Message> {
diff --git a/examples/multitouch/Cargo.toml b/examples/multitouch/Cargo.toml
index 867312f8..e0d14f58 100644
--- a/examples/multitouch/Cargo.toml
+++ b/examples/multitouch/Cargo.toml
@@ -6,7 +6,8 @@ edition = "2021"
publish = false
[dependencies]
-iced = { path = "../..", features = ["canvas", "tokio", "debug"] }
-tokio = { version = "1.0", features = ["sync"] }
-env_logger = "0.10"
+iced.workspace = true
+iced.features = ["debug", "canvas", "tokio"]
+
+tracing-subscriber = "0.3"
voronator = "0.2"
diff --git a/examples/multitouch/src/main.rs b/examples/multitouch/src/main.rs
index 2830b78d..ba8df7aa 100644
--- a/examples/multitouch/src/main.rs
+++ b/examples/multitouch/src/main.rs
@@ -13,7 +13,7 @@ use iced::{
use std::collections::HashMap;
pub fn main() -> iced::Result {
- env_logger::builder().format_timestamp(None).init();
+ tracing_subscriber::fmt::init();
Multitouch::run(Settings {
antialiasing: true,
diff --git a/examples/pane_grid/Cargo.toml b/examples/pane_grid/Cargo.toml
index 4c0bf072..095ecd10 100644
--- a/examples/pane_grid/Cargo.toml
+++ b/examples/pane_grid/Cargo.toml
@@ -6,4 +6,5 @@ edition = "2021"
publish = false
[dependencies]
-iced = { path = "../..", features = ["debug", "lazy"] }
+iced.workspace = true
+iced.features = ["debug", "lazy"]
diff --git a/examples/pane_grid/src/main.rs b/examples/pane_grid/src/main.rs
index 04896e20..af87e2c0 100644
--- a/examples/pane_grid/src/main.rs
+++ b/examples/pane_grid/src/main.rs
@@ -1,8 +1,6 @@
use iced::alignment::{self, Alignment};
-use iced::event::{self, Event};
use iced::executor;
use iced::keyboard;
-use iced::subscription;
use iced::theme::{self, Theme};
use iced::widget::pane_grid::{self, PaneGrid};
use iced::widget::{
@@ -146,18 +144,12 @@ impl Application for Example {
}
fn subscription(&self) -> Subscription<Message> {
- subscription::events_with(|event, status| {
- if let event::Status::Captured = status {
+ keyboard::on_key_press(|key_code, modifiers| {
+ if !modifiers.command() {
return None;
}
- match event {
- Event::Keyboard(keyboard::Event::KeyPressed {
- modifiers,
- key_code,
- }) if modifiers.command() => handle_hotkey(key_code),
- _ => None,
- }
+ handle_hotkey(key_code)
})
}
diff --git a/examples/pick_list/Cargo.toml b/examples/pick_list/Cargo.toml
index 4aa4603a..030558e7 100644
--- a/examples/pick_list/Cargo.toml
+++ b/examples/pick_list/Cargo.toml
@@ -6,4 +6,5 @@ edition = "2021"
publish = false
[dependencies]
-iced = { path = "../..", features = ["debug"] }
+iced.workspace = true
+iced.features = ["debug"]
diff --git a/examples/pokedex/Cargo.toml b/examples/pokedex/Cargo.toml
index e99fc0c3..bf7e1e35 100644
--- a/examples/pokedex/Cargo.toml
+++ b/examples/pokedex/Cargo.toml
@@ -6,7 +6,9 @@ edition = "2021"
publish = false
[dependencies]
-iced = { path = "../..", features = ["image", "debug", "tokio"] }
+iced.workspace = true
+iced.features = ["image", "debug", "tokio"]
+
serde_json = "1.0"
[dependencies.serde]
@@ -19,5 +21,8 @@ default-features = false
features = ["json", "rustls-tls"]
[dependencies.rand]
-version = "0.7"
-features = ["wasm-bindgen"]
+version = "0.8"
+
+[dependencies.getrandom]
+version = "0.2"
+features = ["js"]
diff --git a/examples/pokedex/src/main.rs b/examples/pokedex/src/main.rs
index 4482814c..8b71a269 100644
--- a/examples/pokedex/src/main.rs
+++ b/examples/pokedex/src/main.rs
@@ -153,7 +153,7 @@ impl Pokemon {
let id = {
let mut rng = rand::rngs::OsRng;
- rng.gen_range(0, Pokemon::TOTAL)
+ rng.gen_range(0..Pokemon::TOTAL)
};
let fetch_entry = async {
diff --git a/examples/progress_bar/Cargo.toml b/examples/progress_bar/Cargo.toml
index 383a9bdd..6624ae15 100644
--- a/examples/progress_bar/Cargo.toml
+++ b/examples/progress_bar/Cargo.toml
@@ -6,4 +6,4 @@ edition = "2021"
publish = false
[dependencies]
-iced = { path = "../.." }
+iced.workspace = true
diff --git a/examples/qr_code/Cargo.toml b/examples/qr_code/Cargo.toml
index 2f164df6..8f33ea8c 100644
--- a/examples/qr_code/Cargo.toml
+++ b/examples/qr_code/Cargo.toml
@@ -6,4 +6,5 @@ edition = "2021"
publish = false
[dependencies]
-iced = { path = "../..", features = ["qr_code"] }
+iced.workspace = true
+iced.features = ["qr_code"]
diff --git a/examples/screenshot/Cargo.toml b/examples/screenshot/Cargo.toml
index b79300b7..dcd77439 100644
--- a/examples/screenshot/Cargo.toml
+++ b/examples/screenshot/Cargo.toml
@@ -6,6 +6,8 @@ edition = "2021"
publish = false
[dependencies]
-iced = { path = "../..", features = ["debug", "image", "advanced"] }
-image = { version = "0.24.6", features = ["png"]}
-env_logger = "0.10.0"
+iced.workspace = true
+iced.features = ["debug", "image", "advanced"]
+
+image = { workspace = true, features = ["png"]}
+tracing-subscriber = "0.3" \ No newline at end of file
diff --git a/examples/screenshot/src/main.rs b/examples/screenshot/src/main.rs
index 83824535..68c9d031 100644
--- a/examples/screenshot/src/main.rs
+++ b/examples/screenshot/src/main.rs
@@ -4,16 +4,15 @@ use iced::theme::{Button, Container};
use iced::widget::{button, column, container, image, row, text, text_input};
use iced::window::screenshot::{self, Screenshot};
use iced::{
- event, executor, keyboard, subscription, Alignment, Application, Command,
- ContentFit, Element, Event, Length, Rectangle, Renderer, Subscription,
- Theme,
+ event, executor, keyboard, Alignment, Application, Command, ContentFit,
+ Element, Event, Length, Rectangle, Renderer, Subscription, Theme,
};
use ::image as img;
use ::image::ColorType;
fn main() -> iced::Result {
- env_logger::builder().format_timestamp(None).init();
+ tracing_subscriber::fmt::init();
Example::run(iced::Settings::default())
}
@@ -254,7 +253,7 @@ impl Application for Example {
}
fn subscription(&self) -> Subscription<Self::Message> {
- subscription::events_with(|event, status| {
+ event::listen_with(|event, status| {
if let event::Status::Captured = status {
return None;
}
diff --git a/examples/scrollable/Cargo.toml b/examples/scrollable/Cargo.toml
index e6411e26..f8c735c0 100644
--- a/examples/scrollable/Cargo.toml
+++ b/examples/scrollable/Cargo.toml
@@ -6,5 +6,7 @@ edition = "2021"
publish = false
[dependencies]
-iced = { path = "../..", features = ["debug"] }
-once_cell = "1.16.0"
+iced.workspace = true
+iced.features = ["debug"]
+
+once_cell.workspace = true
diff --git a/examples/sierpinski_triangle/Cargo.toml b/examples/sierpinski_triangle/Cargo.toml
index 39d45f64..600a9e06 100644
--- a/examples/sierpinski_triangle/Cargo.toml
+++ b/examples/sierpinski_triangle/Cargo.toml
@@ -6,5 +6,7 @@ edition = "2018"
publish = false
[dependencies]
-iced = { path = "../..", features = ["canvas", "debug"] }
-rand = "0.8.4"
+iced.workspace = true
+iced.features = ["debug", "canvas"]
+
+rand = "0.8"
diff --git a/examples/slider/Cargo.toml b/examples/slider/Cargo.toml
index 112d7cff..fad8916e 100644
--- a/examples/slider/Cargo.toml
+++ b/examples/slider/Cargo.toml
@@ -6,4 +6,4 @@ edition = "2021"
publish = false
[dependencies]
-iced = { path = "../.." }
+iced.workspace = true
diff --git a/examples/solar_system/Cargo.toml b/examples/solar_system/Cargo.toml
index 1a98a87e..ca64da14 100644
--- a/examples/solar_system/Cargo.toml
+++ b/examples/solar_system/Cargo.toml
@@ -6,6 +6,8 @@ edition = "2021"
publish = false
[dependencies]
-iced = { path = "../..", features = ["canvas", "tokio", "debug"] }
-env_logger = "0.10.0"
+iced.workspace = true
+iced.features = ["debug", "canvas", "tokio"]
+
rand = "0.8.3"
+tracing-subscriber = "0.3"
diff --git a/examples/solar_system/src/main.rs b/examples/solar_system/src/main.rs
index 58d06206..8fa8946e 100644
--- a/examples/solar_system/src/main.rs
+++ b/examples/solar_system/src/main.rs
@@ -23,7 +23,7 @@ use iced::{
use std::time::Instant;
pub fn main() -> iced::Result {
- env_logger::builder().format_timestamp(None).init();
+ tracing_subscriber::fmt::init();
SolarSystem::run(Settings {
antialiasing: true,
diff --git a/examples/stopwatch/Cargo.toml b/examples/stopwatch/Cargo.toml
index f623feb9..6b1419f6 100644
--- a/examples/stopwatch/Cargo.toml
+++ b/examples/stopwatch/Cargo.toml
@@ -6,4 +6,5 @@ edition = "2021"
publish = false
[dependencies]
-iced = { path = "../..", features = ["smol"] }
+iced.workspace = true
+iced.features = ["smol"]
diff --git a/examples/stopwatch/src/main.rs b/examples/stopwatch/src/main.rs
index 842ba3d4..0b0f0607 100644
--- a/examples/stopwatch/src/main.rs
+++ b/examples/stopwatch/src/main.rs
@@ -1,5 +1,6 @@
use iced::alignment;
use iced::executor;
+use iced::keyboard;
use iced::theme::{self, Theme};
use iced::time;
use iced::widget::{button, column, container, row, text};
@@ -77,12 +78,25 @@ impl Application for Stopwatch {
}
fn subscription(&self) -> Subscription<Message> {
- match self.state {
+ let tick = match self.state {
State::Idle => Subscription::none(),
State::Ticking { .. } => {
time::every(Duration::from_millis(10)).map(Message::Tick)
}
+ };
+
+ fn handle_hotkey(
+ key_code: keyboard::KeyCode,
+ _modifiers: keyboard::Modifiers,
+ ) -> Option<Message> {
+ match key_code {
+ keyboard::KeyCode::Space => Some(Message::Toggle),
+ keyboard::KeyCode::R => Some(Message::Reset),
+ _ => None,
+ }
}
+
+ Subscription::batch(vec![tick, keyboard::on_key_press(handle_hotkey)])
}
fn view(&self) -> Element<Message> {
diff --git a/examples/styling/Cargo.toml b/examples/styling/Cargo.toml
index f771708c..c8a90258 100644
--- a/examples/styling/Cargo.toml
+++ b/examples/styling/Cargo.toml
@@ -6,4 +6,4 @@ edition = "2021"
publish = false
[dependencies]
-iced = { path = "../.." }
+iced.workspace = true
diff --git a/examples/svg/Cargo.toml b/examples/svg/Cargo.toml
index f5a6eaa2..78208fb0 100644
--- a/examples/svg/Cargo.toml
+++ b/examples/svg/Cargo.toml
@@ -6,4 +6,5 @@ edition = "2021"
publish = false
[dependencies]
-iced = { path = "../..", features = ["svg"] }
+iced.workspace = true
+iced.features = ["svg"]
diff --git a/examples/system_information/Cargo.toml b/examples/system_information/Cargo.toml
index 7d1e4b94..41903122 100644
--- a/examples/system_information/Cargo.toml
+++ b/examples/system_information/Cargo.toml
@@ -6,5 +6,7 @@ edition = "2021"
publish = false
[dependencies]
-iced = { path = "../..", features = ["system"] }
-bytesize = { version = "1.1.0" }
+iced.workspace = true
+iced.features = ["system"]
+
+bytesize = "1.1"
diff --git a/examples/toast/Cargo.toml b/examples/toast/Cargo.toml
index f703572c..113313e2 100644
--- a/examples/toast/Cargo.toml
+++ b/examples/toast/Cargo.toml
@@ -6,4 +6,5 @@ edition = "2021"
publish = false
[dependencies]
-iced = { path = "../..", features = ["advanced"] }
+iced.workspace = true
+iced.features = ["advanced"]
diff --git a/examples/toast/src/main.rs b/examples/toast/src/main.rs
index 42f6c348..47b272a9 100644
--- a/examples/toast/src/main.rs
+++ b/examples/toast/src/main.rs
@@ -1,10 +1,12 @@
+use iced::event::{self, Event};
use iced::executor;
use iced::keyboard;
-use iced::subscription::{self, Subscription};
use iced::widget::{
self, button, column, container, pick_list, row, slider, text, text_input,
};
-use iced::{Alignment, Application, Command, Element, Event, Length, Settings};
+use iced::{
+ Alignment, Application, Command, Element, Length, Settings, Subscription,
+};
use toast::{Status, Toast};
@@ -57,7 +59,7 @@ impl Application for App {
}
fn subscription(&self) -> Subscription<Self::Message> {
- subscription::events().map(Message::Event)
+ event::listen().map(Message::Event)
}
fn update(&mut self, message: Message) -> Command<Message> {
diff --git a/examples/todos/Cargo.toml b/examples/todos/Cargo.toml
index 7ad4d558..fea20375 100644
--- a/examples/todos/Cargo.toml
+++ b/examples/todos/Cargo.toml
@@ -6,18 +6,20 @@ edition = "2021"
publish = false
[dependencies]
-iced = { path = "../..", features = ["async-std", "debug"] }
+iced.workspace = true
+iced.features = ["async-std", "debug"]
+
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
-once_cell = "1.15"
+once_cell.workspace = true
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
-async-std = "1.0"
+async-std.workspace = true
directories-next = "2.0"
[target.'cfg(target_arch = "wasm32")'.dependencies]
-web-sys = { version = "0.3", features = ["Window", "Storage"] }
-wasm-timer = "0.2"
+web-sys = { workspace = true, features = ["Window", "Storage"] }
+wasm-timer.workspace = true
[package.metadata.deb]
assets = [
diff --git a/examples/todos/src/main.rs b/examples/todos/src/main.rs
index 6ad7b4fb..62c17926 100644
--- a/examples/todos/src/main.rs
+++ b/examples/todos/src/main.rs
@@ -1,8 +1,6 @@
use iced::alignment::{self, Alignment};
-use iced::event::{self, Event};
use iced::font::{self, Font};
-use iced::keyboard::{self, KeyCode, Modifiers};
-use iced::subscription;
+use iced::keyboard;
use iced::theme::{self, Theme};
use iced::widget::{
self, button, checkbox, column, container, row, scrollable, text,
@@ -52,7 +50,7 @@ enum Message {
FilterChanged(Filter),
TaskMessage(usize, TaskMessage),
TabPressed { shift: bool },
- ToggleFullscreen(window::Mode),
+ ChangeWindowMode(window::Mode),
}
impl Application for Todos {
@@ -163,7 +161,7 @@ impl Application for Todos {
widget::focus_next()
}
}
- Message::ToggleFullscreen(mode) => {
+ Message::ChangeWindowMode(mode) => {
window::change_mode(mode)
}
_ => Command::none(),
@@ -262,33 +260,19 @@ impl Application for Todos {
}
fn subscription(&self) -> Subscription<Message> {
- subscription::events_with(|event, status| match (event, status) {
- (
- Event::Keyboard(keyboard::Event::KeyPressed {
- key_code: keyboard::KeyCode::Tab,
- modifiers,
- ..
+ keyboard::on_key_press(|key_code, modifiers| {
+ match (key_code, modifiers) {
+ (keyboard::KeyCode::Tab, _) => Some(Message::TabPressed {
+ shift: modifiers.shift(),
}),
- event::Status::Ignored,
- ) => Some(Message::TabPressed {
- shift: modifiers.shift(),
- }),
- (
- Event::Keyboard(keyboard::Event::KeyPressed {
- key_code,
- modifiers: Modifiers::SHIFT,
- }),
- event::Status::Ignored,
- ) => match key_code {
- KeyCode::Up => {
- Some(Message::ToggleFullscreen(window::Mode::Fullscreen))
+ (keyboard::KeyCode::Up, keyboard::Modifiers::SHIFT) => {
+ Some(Message::ChangeWindowMode(window::Mode::Fullscreen))
}
- KeyCode::Down => {
- Some(Message::ToggleFullscreen(window::Mode::Windowed))
+ (keyboard::KeyCode::Down, keyboard::Modifiers::SHIFT) => {
+ Some(Message::ChangeWindowMode(window::Mode::Windowed))
}
_ => None,
- },
- _ => None,
+ }
})
}
}
diff --git a/examples/tooltip/Cargo.toml b/examples/tooltip/Cargo.toml
index 25840fb4..57bb0dcb 100644
--- a/examples/tooltip/Cargo.toml
+++ b/examples/tooltip/Cargo.toml
@@ -6,4 +6,5 @@ edition = "2021"
publish = false
[dependencies]
-iced = { path = "../..", features = ["debug"] }
+iced.workspace = true
+iced.features = ["debug"]
diff --git a/examples/tour/Cargo.toml b/examples/tour/Cargo.toml
index 48471f2d..21206ecb 100644
--- a/examples/tour/Cargo.toml
+++ b/examples/tour/Cargo.toml
@@ -6,5 +6,7 @@ edition = "2021"
publish = false
[dependencies]
-iced = { path = "../..", features = ["image", "debug"] }
-env_logger = "0.10.0"
+iced.workspace = true
+iced.features = ["image", "debug"]
+
+tracing-subscriber = "0.3"
diff --git a/examples/tour/src/main.rs b/examples/tour/src/main.rs
index 13bcd5ff..af508206 100644
--- a/examples/tour/src/main.rs
+++ b/examples/tour/src/main.rs
@@ -8,7 +8,7 @@ use iced::widget::{Button, Column, Container, Slider};
use iced::{Color, Element, Font, Length, Renderer, Sandbox, Settings};
pub fn main() -> iced::Result {
- env_logger::init();
+ tracing_subscriber::fmt::init();
Tour::run(Settings::default())
}
diff --git a/examples/url_handler/Cargo.toml b/examples/url_handler/Cargo.toml
index 4dcff92d..7bb9914b 100644
--- a/examples/url_handler/Cargo.toml
+++ b/examples/url_handler/Cargo.toml
@@ -6,4 +6,4 @@ edition = "2021"
publish = false
[dependencies]
-iced = { path = "../.." }
+iced.workspace = true
diff --git a/examples/url_handler/src/main.rs b/examples/url_handler/src/main.rs
index f63fa06a..bf570123 100644
--- a/examples/url_handler/src/main.rs
+++ b/examples/url_handler/src/main.rs
@@ -1,6 +1,5 @@
-use iced::event::{Event, MacOS, PlatformSpecific};
+use iced::event::{self, Event};
use iced::executor;
-use iced::subscription;
use iced::widget::{container, text};
use iced::{
Application, Command, Element, Length, Settings, Subscription, Theme,
@@ -37,9 +36,11 @@ impl Application for App {
fn update(&mut self, message: Message) -> Command<Message> {
match message {
Message::EventOccurred(event) => {
- if let Event::PlatformSpecific(PlatformSpecific::MacOS(
- MacOS::ReceivedUrl(url),
- )) = event
+ if let Event::PlatformSpecific(
+ event::PlatformSpecific::MacOS(event::MacOS::ReceivedUrl(
+ url,
+ )),
+ ) = event
{
self.url = Some(url);
}
@@ -50,7 +51,7 @@ impl Application for App {
}
fn subscription(&self) -> Subscription<Message> {
- subscription::events().map(Message::EventOccurred)
+ event::listen().map(Message::EventOccurred)
}
fn view(&self) -> Element<Message> {
diff --git a/examples/visible_bounds/Cargo.toml b/examples/visible_bounds/Cargo.toml
index cfa56dd2..37594b84 100644
--- a/examples/visible_bounds/Cargo.toml
+++ b/examples/visible_bounds/Cargo.toml
@@ -6,5 +6,7 @@ edition = "2021"
publish = false
[dependencies]
-iced = { path = "../..", features = ["debug"] }
-once_cell = "1"
+iced.workspace = true
+iced.features = ["debug"]
+
+once_cell.workspace = true
diff --git a/examples/visible_bounds/src/main.rs b/examples/visible_bounds/src/main.rs
index 8b684514..42dfc24c 100644
--- a/examples/visible_bounds/src/main.rs
+++ b/examples/visible_bounds/src/main.rs
@@ -1,14 +1,14 @@
+use iced::event::{self, Event};
use iced::executor;
use iced::mouse;
-use iced::subscription::{self, Subscription};
use iced::theme::{self, Theme};
use iced::widget::{
column, container, horizontal_space, row, scrollable, text, vertical_space,
};
use iced::window;
use iced::{
- Alignment, Application, Color, Command, Element, Event, Font, Length,
- Point, Rectangle, Settings,
+ Alignment, Application, Color, Command, Element, Font, Length, Point,
+ Rectangle, Settings, Subscription,
};
pub fn main() -> iced::Result {
@@ -163,7 +163,7 @@ impl Application for Example {
}
fn subscription(&self) -> Subscription<Message> {
- subscription::events_with(|event, _| match event {
+ event::listen_with(|event, _| match event {
Event::Mouse(mouse::Event::CursorMoved { position }) => {
Some(Message::MouseMoved(position))
}
diff --git a/examples/websocket/Cargo.toml b/examples/websocket/Cargo.toml
index 12af9658..2756e8e0 100644
--- a/examples/websocket/Cargo.toml
+++ b/examples/websocket/Cargo.toml
@@ -6,16 +6,16 @@ edition = "2021"
publish = false
[dependencies]
-iced = { path = "../..", features = ["tokio", "debug"] }
-once_cell = "1.15"
+iced.workspace = true
+iced.features = ["debug", "tokio"]
+
+once_cell.workspace = true
+warp = "0.3"
[dependencies.async-tungstenite]
version = "0.23"
features = ["tokio-rustls-webpki-roots"]
[dependencies.tokio]
-version = "1"
+workspace = true
features = ["time"]
-
-[dependencies.warp]
-version = "0.3"