Use derive macros to implement Data in Flex types
@@ -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.
///
@@ -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.
///
@@ -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) {}
