style: Use derive(Parse) for X and Y.

This commit is contained in:
Emilio Cobos Álvarez 2017-12-15 20:10:17 +01:00
parent 4abd1dc819
commit 8fbdbc8f95
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C

View file

@ -42,17 +42,21 @@ pub enum PositionComponent<S> {
Side(S, Option<LengthOrPercentage>), Side(S, Option<LengthOrPercentage>),
} }
define_css_keyword_enum! { X: /// A keyword for the X direction.
"left" => Left, #[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse, PartialEq, ToComputedValue, ToCss)]
"right" => Right, #[allow(missing_docs)]
pub enum X {
Left,
Right,
} }
add_impls_for_keyword_enum!(X);
define_css_keyword_enum! { Y: /// A keyword for the Y direction.
"top" => Top, #[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse, PartialEq, ToComputedValue, ToCss)]
"bottom" => Bottom, #[allow(missing_docs)]
pub enum Y {
Top,
Bottom,
} }
add_impls_for_keyword_enum!(Y);
impl Parse for Position { impl Parse for Position {
fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> { fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {