diff options
| author | Laurenz <laurmaedje@gmail.com> | 2023-03-13 21:39:38 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2023-03-13 21:40:06 +0100 |
| commit | 880b1847bd4170ce80be5781c2163ba085cdcaff (patch) | |
| tree | 3fbfdb70cb04c4922f0ec9e3f29f2c63d11d753b /library/src/layout | |
| parent | cb3c263c4a67f4d361dbdb5048a1c073bd1fff96 (diff) | |
Derive `Cast` for enums
Diffstat (limited to 'library/src/layout')
| -rw-r--r-- | library/src/layout/par.rs | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/library/src/layout/par.rs b/library/src/layout/par.rs index 6178c059..2d7c5d62 100644 --- a/library/src/layout/par.rs +++ b/library/src/layout/par.rs @@ -193,30 +193,15 @@ impl Resolve for HorizontalAlign { } /// How to determine line breaks in a paragraph. -#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash, Cast)] pub enum Linebreaks { /// Determine the line breaks in a simple first-fit style. Simple, /// Optimize the line breaks for the whole paragraph. - Optimized, -} - -cast_from_value! { - Linebreaks, - /// Determine the line breaks in a simple first-fit style. - "simple" => Self::Simple, - /// Optimize the line breaks for the whole paragraph. /// /// Typst will try to produce more evenly filled lines of text by /// considering the whole paragraph when calculating line breaks. - "optimized" => Self::Optimized, -} - -cast_to_value! { - v: Linebreaks => Value::from(match v { - Linebreaks::Simple => "simple", - Linebreaks::Optimized => "optimized", - }) + Optimized, } /// A paragraph break. |
