Skip to content

Commit

Permalink
Use derive macros to implement Data in Flex types
Browse files Browse the repository at this point in the history
  • Loading branch information
emigr2k1 authored and cmyr committed Mar 22, 2020
1 parent 14e3fa3 commit 69f8f05
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions druid/src/widget/flex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ pub(crate) enum Axis {
///
/// If a widget is smaller than the container on the minor axis, this determines
/// where it is positioned.
#[derive(Debug, Clone, Copy, PartialEq)]
#[derive(Debug, Clone, Copy, PartialEq, Data)]
pub enum CrossAxisAlignment {
/// Top or leading.
///
Expand All @@ -224,7 +224,7 @@ pub enum CrossAxisAlignment {
///
/// If there is surplus space on the main axis after laying out children, this
/// enum represents how children are laid out in this space.
#[derive(Debug, Clone, Copy, PartialEq)]
#[derive(Debug, Clone, Copy, PartialEq, Data)]
pub enum MainAxisAlignment {
/// Top or leading.
///
Expand Down Expand Up @@ -700,20 +700,6 @@ impl Spacing {
}
}

// we have these impls mostly for our 'flex' example, but I could imagine
// them being broadly useful?
impl Data for MainAxisAlignment {
fn same(&self, other: &MainAxisAlignment) -> bool {
self == other
}
}

impl Data for CrossAxisAlignment {
fn same(&self, other: &CrossAxisAlignment) -> bool {
self == other
}
}

impl<T: Data> Widget<T> for Spacer {
fn event(&mut self, _: &mut EventCtx, _: &Event, _: &mut T, _: &Env) {}
fn lifecycle(&mut self, _: &mut LifeCycleCtx, _: &LifeCycle, _: &T, _: &Env) {}
Expand Down

0 comments on commit 69f8f05

Please sign in to comment.