Remove `StrokeKind::default` (#5658)

Since there is no natural default for `RectShape`.
This commit is contained in:
Emil Ernerfeldt 2025-01-30 21:02:50 +01:00 committed by GitHub
parent 04fca9c324
commit 4b9da5f650
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 11 additions and 10 deletions

View File

@ -69,16 +69,10 @@ pub enum StrokeKind {
Outside, Outside,
} }
impl Default for StrokeKind {
fn default() -> Self {
Self::Middle
}
}
/// Describes the width and color of paths. The color can either be solid or provided by a callback. For more information, see [`ColorMode`] /// Describes the width and color of paths. The color can either be solid or provided by a callback. For more information, see [`ColorMode`]
/// ///
/// The default stroke is the same as [`Stroke::NONE`]. /// The default stroke is the same as [`Stroke::NONE`].
#[derive(Clone, Debug, Default, PartialEq)] #[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub struct PathStroke { pub struct PathStroke {
pub width: f32, pub width: f32,
@ -86,6 +80,13 @@ pub struct PathStroke {
pub kind: StrokeKind, pub kind: StrokeKind,
} }
impl Default for PathStroke {
#[inline]
fn default() -> Self {
Self::NONE
}
}
impl PathStroke { impl PathStroke {
/// Same as [`PathStroke::default`]. /// Same as [`PathStroke::default`].
pub const NONE: Self = Self { pub const NONE: Self = Self {
@ -99,7 +100,7 @@ impl PathStroke {
Self { Self {
width: width.into(), width: width.into(),
color: ColorMode::Solid(color.into()), color: ColorMode::Solid(color.into()),
kind: StrokeKind::default(), kind: StrokeKind::Middle,
} }
} }
@ -114,7 +115,7 @@ impl PathStroke {
Self { Self {
width: width.into(), width: width.into(),
color: ColorMode::UV(Arc::new(callback)), color: ColorMode::UV(Arc::new(callback)),
kind: StrokeKind::default(), kind: StrokeKind::Middle,
} }
} }
@ -168,7 +169,7 @@ impl From<Stroke> for PathStroke {
Self { Self {
width: value.width, width: value.width,
color: ColorMode::Solid(value.color), color: ColorMode::Solid(value.color),
kind: StrokeKind::default(), kind: StrokeKind::Middle,
} }
} }
} }