Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Derive Default on enums. #103

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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