Derive the most trivial ToCss implementations 🌋

For now, all variants get serialised as the space-separated serialisations
of their fields. Unit variants are not supported.
This commit is contained in:
Anthony Ramine 2017-06-04 15:45:09 +02:00
parent 6d6f03974d
commit c4f1d647a0
18 changed files with 113 additions and 263 deletions

View file

@ -209,7 +209,7 @@ impl Parse for AlignJustifyContent {
/// Value of the `align-self` or `justify-self` property.
///
/// https://drafts.csswg.org/css-align/#self-alignment
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, ToCss)]
pub struct AlignJustifySelf(pub AlignFlags);
impl AlignJustifySelf {
@ -228,12 +228,6 @@ impl AlignJustifySelf {
no_viewport_percentage!(AlignJustifySelf);
impl ToCss for AlignJustifySelf {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
self.0.to_css(dest)
}
}
impl Parse for AlignJustifySelf {
// auto | normal | stretch | <baseline-position> |
// [ <overflow-position>? && <self-position> ]
@ -253,7 +247,7 @@ impl Parse for AlignJustifySelf {
/// Value of the `align-items` property
///
/// https://drafts.csswg.org/css-align/#self-alignment
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, ToCss)]
pub struct AlignItems(pub AlignFlags);
impl AlignItems {
@ -272,12 +266,6 @@ impl AlignItems {
no_viewport_percentage!(AlignItems);
impl ToCss for AlignItems {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
self.0.to_css(dest)
}
}
impl Parse for AlignItems {
// normal | stretch | <baseline-position> |
// [ <overflow-position>? && <self-position> ]
@ -297,7 +285,7 @@ impl Parse for AlignItems {
/// Value of the `justify-items` property
///
/// https://drafts.csswg.org/css-align/#justify-items-property
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, ToCss)]
pub struct JustifyItems(pub AlignFlags);
impl JustifyItems {
@ -316,12 +304,6 @@ impl JustifyItems {
no_viewport_percentage!(JustifyItems);
impl ToCss for JustifyItems {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
self.0.to_css(dest)
}
}
impl Parse for JustifyItems {
// auto | normal | stretch | <baseline-position> |
// [ <overflow-position>? && <self-position> ]