Skip to content

Commit

Permalink
Derive Default on enums. (#103)
Browse files Browse the repository at this point in the history
  • Loading branch information
waywardmonkeys authored Aug 10, 2024
1 parent db89c81 commit 6ecf702
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
9 changes: 2 additions & 7 deletions parley/src/layout/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,20 +82,15 @@ pub struct RunData {
pub advance: f32,
}

#[derive(Copy, Clone, PartialEq)]
#[derive(Copy, Clone, Default, PartialEq)]
pub enum BreakReason {
#[default]
None,
Regular,
Explicit,
Emergency,
}

impl Default for BreakReason {
fn default() -> Self {
Self::None
}
}

#[derive(Clone, Default)]
pub struct LineData {
/// Range of the source text.
Expand Down
9 changes: 2 additions & 7 deletions parley/src/layout/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,16 @@ pub use line::{GlyphRun, LineMetrics, PositionedInlineBox, PositionedLayoutItem}
pub use run::RunMetrics;

/// Alignment of a layout.
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
#[derive(Copy, Clone, Default, PartialEq, Eq, Debug)]
#[repr(u8)]
pub enum Alignment {
#[default]
Start,
Middle,
End,
Justified,
}

impl Default for Alignment {
fn default() -> Self {
Self::Start
}
}

/// Text layout.
#[derive(Clone)]
pub struct Layout<B: Brush> {
Expand Down

0 comments on commit 6ecf702

Please sign in to comment.