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

Allow druid_derive macros in druid crate #731

Merged
merged 2 commits into from
Mar 22, 2020
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
3 changes: 3 additions & 0 deletions druid/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@
#![allow(clippy::new_ret_no_self, clippy::needless_doctest_main)]
#![cfg_attr(docsrs, feature(doc_cfg))]

// Allows to use macros from druid_derive in this crate
extern crate self as druid;

use druid_shell as shell;
pub use druid_shell::{kurbo, piet};

Expand Down
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?
Comment on lines -703 to -704
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't know what to do with this comment

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can just delete that.

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