Merge branch 'master' into advanced-text

This commit is contained in:
Héctor Ramón Jiménez 2023-03-17 20:17:23 +01:00
commit d1dc62ebcd
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
7 changed files with 21 additions and 38 deletions

View file

@ -1,7 +1,8 @@
/// The interaction of a mouse cursor. /// The interaction of a mouse cursor.
#[derive(Debug, Eq, PartialEq, Clone, Copy, PartialOrd, Ord)] #[derive(Debug, Eq, PartialEq, Clone, Copy, PartialOrd, Ord, Default)]
#[allow(missing_docs)] #[allow(missing_docs)]
pub enum Interaction { pub enum Interaction {
#[default]
Idle, Idle,
Pointer, Pointer,
Grab, Grab,
@ -12,9 +13,3 @@ pub enum Interaction {
ResizingHorizontally, ResizingHorizontally,
ResizingVertically, ResizingVertically,
} }
impl Default for Interaction {
fn default() -> Interaction {
Interaction::Idle
}
}

View file

@ -6,7 +6,7 @@ The __[`main`]__ file contains all the code of the example.
You can run it with `cargo run`: You can run it with `cargo run`:
``` ```
cargo run --package pick_list cargo run --package checkbox
``` ```
[`main`]: src/main.rs [`main`]: src/main.rs

View file

@ -61,8 +61,9 @@ impl Sandbox for Example {
} }
} }
#[derive(Debug, Clone, Copy, PartialEq, Eq)] #[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum Language { pub enum Language {
#[default]
Rust, Rust,
Elm, Elm,
Ruby, Ruby,
@ -84,12 +85,6 @@ impl Language {
]; ];
} }
impl Default for Language {
fn default() -> Language {
Language::Rust
}
}
impl std::fmt::Display for Language { impl std::fmt::Display for Language {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!( write!(

View file

@ -440,19 +440,16 @@ fn view_controls(tasks: &[Task], current_filter: Filter) -> Element<Message> {
.into() .into()
} }
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] #[derive(
Debug, Clone, Copy, PartialEq, Eq, Default, Serialize, Deserialize,
)]
pub enum Filter { pub enum Filter {
#[default]
All, All,
Active, Active,
Completed, Completed,
} }
impl Default for Filter {
fn default() -> Self {
Filter::All
}
}
impl Filter { impl Filter {
fn matches(&self, task: &Task) -> bool { fn matches(&self, task: &Task) -> bool {
match self { match self {

View file

@ -59,9 +59,10 @@ impl<'a> Default for Stroke<'a> {
} }
/// The shape used at the end of open subpaths when they are stroked. /// The shape used at the end of open subpaths when they are stroked.
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy, Default)]
pub enum LineCap { pub enum LineCap {
/// The stroke for each sub-path does not extend beyond its two endpoints. /// The stroke for each sub-path does not extend beyond its two endpoints.
#[default]
Butt, Butt,
/// At the end of each sub-path, the shape representing the stroke will be /// At the end of each sub-path, the shape representing the stroke will be
/// extended by a square. /// extended by a square.
@ -71,17 +72,12 @@ pub enum LineCap {
Round, Round,
} }
impl Default for LineCap {
fn default() -> LineCap {
LineCap::Butt
}
}
/// The shape used at the corners of paths or basic shapes when they are /// The shape used at the corners of paths or basic shapes when they are
/// stroked. /// stroked.
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy, Default)]
pub enum LineJoin { pub enum LineJoin {
/// A sharp corner. /// A sharp corner.
#[default]
Miter, Miter,
/// A round corner. /// A round corner.
Round, Round,
@ -89,12 +85,6 @@ pub enum LineJoin {
Bevel, Bevel,
} }
impl Default for LineJoin {
fn default() -> LineJoin {
LineJoin::Miter
}
}
/// The dash pattern used when stroking the line. /// The dash pattern used when stroking the line.
#[derive(Debug, Clone, Copy, Default)] #[derive(Debug, Clone, Copy, Default)]
pub struct LineDash<'a> { pub struct LineDash<'a> {

View file

@ -6,7 +6,7 @@ pub mod icon;
pub use icon::Icon; pub use icon::Icon;
pub use position::Position; pub use position::Position;
pub use settings::Settings; pub use settings::{PlatformSpecific, Settings};
pub use crate::core::window::*; pub use crate::core::window::*;
pub use crate::runtime::window::*; pub use crate::runtime::window::*;

View file

@ -1,5 +1,7 @@
use crate::window::{Icon, Position}; use crate::window::{Icon, Position};
pub use iced_winit::settings::PlatformSpecific;
/// The window settings of an application. /// The window settings of an application.
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct Settings { pub struct Settings {
@ -32,6 +34,9 @@ pub struct Settings {
/// The icon of the window. /// The icon of the window.
pub icon: Option<Icon>, pub icon: Option<Icon>,
/// Platform specific settings.
pub platform_specific: PlatformSpecific,
} }
impl Default for Settings { impl Default for Settings {
@ -47,6 +52,7 @@ impl Default for Settings {
transparent: false, transparent: false,
always_on_top: false, always_on_top: false,
icon: None, icon: None,
platform_specific: Default::default(),
} }
} }
} }
@ -64,7 +70,7 @@ impl From<Settings> for iced_winit::settings::Window {
transparent: settings.transparent, transparent: settings.transparent,
always_on_top: settings.always_on_top, always_on_top: settings.always_on_top,
icon: settings.icon.map(Icon::into), icon: settings.icon.map(Icon::into),
platform_specific: Default::default(), platform_specific: settings.platform_specific,
} }
} }
} }