diff options
| author | Laurenz <laurmaedje@gmail.com> | 2023-06-06 21:13:59 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2023-06-06 22:06:16 +0200 |
| commit | fd417da04f7ca4b995de7f6510abafd3e9c31307 (patch) | |
| tree | 3675529c75ca7363701ac8ea306de2cc1d3cbcb3 /library/src/layout/stack.rs | |
| parent | 168bdf35bd773e67343c965cb473492cc5cae9e7 (diff) | |
Improve value casting infrastructure
Diffstat (limited to 'library/src/layout/stack.rs')
| -rw-r--r-- | library/src/layout/stack.rs | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/library/src/layout/stack.rs b/library/src/layout/stack.rs index 2ce2cc28..f8670026 100644 --- a/library/src/layout/stack.rs +++ b/library/src/layout/stack.rs @@ -90,19 +90,16 @@ impl Debug for StackChild { } } -cast_from_value! { +cast! { StackChild, + self => match self { + Self::Spacing(spacing) => spacing.into_value(), + Self::Block(content) => content.into_value(), + }, v: Spacing => Self::Spacing(v), v: Content => Self::Block(v), } -cast_to_value! { - v: StackChild => match v { - StackChild::Spacing(spacing) => spacing.into(), - StackChild::Block(content) => content.into(), - } -} - /// Performs stack layout. struct StackLayouter<'a> { /// The stacking direction. |
