Skip to content

Commit 91af1c5

Browse files
committed
Update all examples to Rust 2024
1 parent 9ceb467 commit 91af1c5

File tree

82 files changed

+96
-95
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+96
-95
lines changed

examples/arc/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "arc"
33
version = "0.1.0"
44
authors = ["ThatsNoMoon <[email protected]>"]
5-
edition = "2021"
5+
edition = "2024"
66
publish = false
77

88
[dependencies]

examples/arc/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::{f32::consts::PI, time::Instant};
22

33
use iced::mouse;
44
use iced::widget::canvas::{
5-
self, stroke, Cache, Canvas, Geometry, Path, Stroke,
5+
self, Cache, Canvas, Geometry, Path, Stroke, stroke,
66
};
77
use iced::window;
88
use iced::{Element, Fill, Point, Rectangle, Renderer, Subscription, Theme};

examples/bezier_tool/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "bezier_tool"
33
version = "0.1.0"
44
authors = ["Héctor Ramón Jiménez <[email protected]>"]
5-
edition = "2021"
5+
edition = "2024"
66
publish = false
77

88
[dependencies]

examples/changelog/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "changelog"
33
version = "0.1.0"
44
authors = ["Héctor Ramón Jiménez <[email protected]>"]
5-
edition = "2021"
5+
edition = "2024"
66
publish = false
77

88
[lints.clippy]

examples/checkbox/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "checkbox"
33
version = "0.1.0"
44
authors = ["Casper Rogild Storm<[email protected]>"]
5-
edition = "2021"
5+
edition = "2024"
66
publish = false
77

88
[dependencies]

examples/clock/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "clock"
33
version = "0.1.0"
44
authors = ["Héctor Ramón Jiménez <[email protected]>"]
5-
edition = "2021"
5+
edition = "2024"
66
publish = false
77

88
[dependencies]

examples/clock/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
use iced::mouse;
22
use iced::time::{self, milliseconds};
3-
use iced::widget::canvas::{stroke, Cache, Geometry, LineCap, Path, Stroke};
3+
use iced::widget::canvas::{Cache, Geometry, LineCap, Path, Stroke, stroke};
44
use iced::widget::{canvas, container};
5-
use iced::{alignment, Radians};
65
use iced::{
76
Degrees, Element, Fill, Font, Point, Rectangle, Renderer, Size,
87
Subscription, Theme, Vector,
98
};
9+
use iced::{Radians, alignment};
1010

1111
pub fn main() -> iced::Result {
1212
tracing_subscriber::fmt::init();

examples/color_palette/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "color_palette"
33
version = "0.1.0"
44
authors = ["Clark Moody <[email protected]>"]
5-
edition = "2021"
5+
edition = "2024"
66
publish = false
77

88
[dependencies]

examples/color_palette/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
use iced::alignment;
22
use iced::mouse;
33
use iced::widget::canvas::{self, Canvas, Frame, Geometry, Path};
4-
use iced::widget::{column, row, text, Slider};
4+
use iced::widget::{Slider, column, row, text};
55
use iced::{
66
Center, Color, Element, Fill, Font, Pixels, Point, Rectangle, Renderer,
77
Size, Vector,
88
};
9-
use palette::{convert::FromColor, rgb::Rgb, Darken, Hsl, Lighten, ShiftHue};
9+
use palette::{Darken, Hsl, Lighten, ShiftHue, convert::FromColor, rgb::Rgb};
1010
use std::marker::PhantomData;
1111
use std::ops::RangeInclusive;
1212

examples/combo_box/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "combo_box"
33
version = "0.1.0"
44
authors = ["Joao Freitas <[email protected]>"]
5-
edition = "2021"
5+
edition = "2024"
66
publish = false
77

88
[dependencies]

examples/counter/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "counter"
33
version = "0.1.0"
44
authors = ["Héctor Ramón Jiménez <[email protected]>"]
5-
edition = "2021"
5+
edition = "2024"
66
publish = false
77

88
[dependencies]

examples/counter/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use iced::widget::{button, column, text, Column};
21
use iced::Center;
2+
use iced::widget::{Column, button, column, text};
33

44
pub fn main() -> iced::Result {
55
iced::run("A cool counter", Counter::update, Counter::view)
@@ -43,7 +43,7 @@ impl Counter {
4343
mod tests {
4444
use super::*;
4545
use iced_test::selector::text;
46-
use iced_test::{simulator, Error};
46+
use iced_test::{Error, simulator};
4747

4848
#[test]
4949
fn it_counts() -> Result<(), Error> {

examples/custom_quad/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "custom_quad"
33
version = "0.1.0"
44
authors = ["Robert Krahn"]
5-
edition = "2021"
5+
edition = "2024"
66
publish = false
77

88
[dependencies]

examples/custom_shader/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "custom_shader"
33
version = "0.1.0"
44
authors = ["Bingus <[email protected]>"]
5-
edition = "2021"
5+
edition = "2024"
66

77
[dependencies]
88
iced.workspace = true

examples/custom_shader/src/scene/pipeline/cube.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use crate::scene::pipeline::Vertex;
22
use crate::wgpu;
33

4-
use glam::{vec2, vec3, Vec3};
5-
use rand::{thread_rng, Rng};
4+
use glam::{Vec3, vec2, vec3};
5+
use rand::{Rng, thread_rng};
66

77
/// A single instance of a cube.
88
#[derive(Debug, Clone)]

examples/custom_widget/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "custom_widget"
33
version = "0.1.0"
44
authors = ["Héctor Ramón Jiménez <[email protected]>"]
5-
edition = "2021"
5+
edition = "2024"
66
publish = false
77

88
[dependencies]

examples/download_progress/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "download_progress"
33
version = "0.1.0"
44
authors = ["Songtronix <[email protected]>", "Folyd <[email protected]>"]
5-
edition = "2021"
5+
edition = "2024"
66
publish = false
77

88
[dependencies]

examples/download_progress/src/download.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use iced::futures::StreamExt;
2-
use iced::task::{sipper, Straw};
2+
use iced::task::{Straw, sipper};
33

44
use std::sync::Arc;
55

examples/download_progress/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ mod download;
33
use download::download;
44

55
use iced::task;
6-
use iced::widget::{button, center, column, progress_bar, text, Column};
6+
use iced::widget::{Column, button, center, column, progress_bar, text};
77
use iced::{Center, Element, Function, Right, Task};
88

99
pub fn main() -> iced::Result {

examples/editor/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "editor"
33
version = "0.1.0"
44
authors = ["Héctor Ramón Jiménez <[email protected]>"]
5-
edition = "2021"
5+
edition = "2024"
66
publish = false
77

88
[dependencies]

examples/events/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "events"
33
version = "0.1.0"
44
authors = ["Héctor Ramón Jiménez <[email protected]>"]
5-
edition = "2021"
5+
edition = "2024"
66
publish = false
77

88
[dependencies]

examples/events/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use iced::event::{self, Event};
2-
use iced::widget::{button, center, checkbox, text, Column};
2+
use iced::widget::{Column, button, center, checkbox, text};
33
use iced::window;
44
use iced::{Center, Element, Fill, Subscription, Task};
55

examples/exit/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "exit"
33
version = "0.1.0"
4-
edition = "2021"
4+
edition = "2024"
55
publish = false
66

77
[dependencies]

examples/ferris/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "ferris"
33
version = "0.1.0"
44
authors = ["Héctor Ramón Jiménez <[email protected]>"]
5-
edition = "2021"
5+
edition = "2024"
66
publish = false
77

88
[dependencies]

examples/gallery/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "gallery"
33
version = "0.1.0"
44
authors = ["Héctor Ramón Jiménez <[email protected]>"]
5-
edition = "2021"
5+
edition = "2024"
66
publish = false
77

88
[dependencies]

examples/gallery/src/civitai.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use bytes::Bytes;
22
use serde::Deserialize;
3-
use sipper::{sipper, Straw};
3+
use sipper::{Straw, sipper};
44
use tokio::task;
55

66
use std::fmt;

examples/gallery/src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ mod civitai;
77
use crate::civitai::{Error, Id, Image, Rgba, Size};
88

99
use iced::animation;
10-
use iced::time::{milliseconds, Instant};
10+
use iced::time::{Instant, milliseconds};
1111
use iced::widget::{
1212
button, center_x, container, horizontal_space, image, mouse_area, opaque,
1313
pop, row, scrollable, stack,
1414
};
1515
use iced::window;
1616
use iced::{
17-
color, Animation, ContentFit, Element, Fill, Function, Subscription, Task,
18-
Theme,
17+
Animation, ContentFit, Element, Fill, Function, Subscription, Task, Theme,
18+
color,
1919
};
2020

2121
use std::collections::HashMap;

examples/game_of_life/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "game_of_life"
33
version = "0.1.0"
44
authors = ["Héctor Ramón Jiménez <[email protected]>"]
5-
edition = "2021"
5+
edition = "2024"
66
publish = false
77

88
[dependencies]

examples/game_of_life/src/main.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ mod grid {
261261
pub fn tick(
262262
&mut self,
263263
amount: usize,
264-
) -> Option<impl Future<Output = Message>> {
264+
) -> Option<impl Future<Output = Message> + use<>> {
265265
let tick = self.state.tick(amount)?;
266266

267267
self.last_queued_ticks = amount;
@@ -722,7 +722,8 @@ mod grid {
722722
fn tick(
723723
&mut self,
724724
amount: usize,
725-
) -> Option<impl Future<Output = Result<Life, TickError>>> {
725+
) -> Option<impl Future<Output = Result<Life, TickError>> + use<>>
726+
{
726727
if self.is_ticking {
727728
return None;
728729
}

examples/geometry/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "geometry"
33
version = "0.1.0"
44
authors = ["Héctor Ramón Jiménez <[email protected]>"]
5-
edition = "2021"
5+
edition = "2024"
66
publish = false
77

88
[dependencies]

examples/geometry/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ mod rainbow {
4747
cursor: mouse::Cursor,
4848
_viewport: &Rectangle,
4949
) {
50+
use iced::advanced::Renderer as _;
5051
use iced::advanced::graphics::mesh::{
5152
self, Mesh, Renderer as _, SolidVertex2D,
5253
};
53-
use iced::advanced::Renderer as _;
5454

5555
let bounds = layout.bounds();
5656

@@ -152,8 +152,8 @@ mod rainbow {
152152
}
153153
}
154154

155-
use iced::widget::{center_x, center_y, column, scrollable};
156155
use iced::Element;
156+
use iced::widget::{center_x, center_y, column, scrollable};
157157
use rainbow::rainbow;
158158

159159
pub fn main() -> iced::Result {

examples/gradient/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "gradient"
33
version = "0.1.0"
4-
edition = "2021"
4+
edition = "2024"
55
publish = false
66

77
[dependencies]

examples/gradient/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use iced::theme;
33
use iced::widget::{
44
checkbox, column, container, horizontal_space, row, slider, text,
55
};
6-
use iced::{color, Center, Color, Element, Fill, Radians, Theme};
6+
use iced::{Center, Color, Element, Fill, Radians, Theme, color};
77

88
pub fn main() -> iced::Result {
99
tracing_subscriber::fmt::init();

examples/integration/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "integration"
33
version = "0.1.0"
44
authors = ["Héctor Ramón Jiménez <[email protected]>"]
5-
edition = "2021"
5+
edition = "2024"
66
publish = false
77

88
[dependencies]

examples/integration/src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ use controls::Controls;
55
use scene::Scene;
66

77
use iced_wgpu::graphics::Viewport;
8-
use iced_wgpu::{wgpu, Engine, Renderer};
8+
use iced_wgpu::{Engine, Renderer, wgpu};
9+
use iced_winit::Clipboard;
910
use iced_winit::conversion;
1011
use iced_winit::core::mouse;
1112
use iced_winit::core::renderer;
1213
use iced_winit::core::{Color, Font, Pixels, Size, Theme};
1314
use iced_winit::futures;
14-
use iced_winit::runtime::program;
1515
use iced_winit::runtime::Debug;
16+
use iced_winit::runtime::program;
1617
use iced_winit::winit;
17-
use iced_winit::Clipboard;
1818

1919
use winit::{
2020
event::WindowEvent,

examples/layout/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "layout"
33
version = "0.1.0"
44
authors = ["Héctor Ramón Jiménez <[email protected]>"]
5-
edition = "2021"
5+
edition = "2024"
66
publish = false
77

88
[dependencies]

examples/layout/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ use iced::widget::{
77
text, vertical_rule,
88
};
99
use iced::{
10-
color, Center, Element, Fill, Font, Length, Point, Rectangle, Renderer,
11-
Shrink, Subscription, Theme,
10+
Center, Element, Fill, Font, Length, Point, Rectangle, Renderer, Shrink,
11+
Subscription, Theme, color,
1212
};
1313

1414
pub fn main() -> iced::Result {

0 commit comments

Comments
 (0)