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 deriving Parse on keywords. #19578

Merged
merged 4 commits into from Dec 15, 2017
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

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

  • Loading branch information
emilio committed Dec 15, 2017
commit 8fbdbc8f951807a811fa833ac03379a15e711d73
@@ -42,17 +42,21 @@ pub enum PositionComponent<S> {
Side(S, Option<LengthOrPercentage>),
}

define_css_keyword_enum! { X:
"left" => Left,
"right" => Right,
/// A keyword for the X direction.
#[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse, PartialEq, ToComputedValue, ToCss)]
#[allow(missing_docs)]
pub enum X {
Left,
Right,
}
add_impls_for_keyword_enum!(X);

define_css_keyword_enum! { Y:
"top" => Top,
"bottom" => Bottom,
/// A keyword for the Y direction.
#[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse, PartialEq, ToComputedValue, ToCss)]
#[allow(missing_docs)]
pub enum Y {
Top,
Bottom,
}
add_impls_for_keyword_enum!(Y);

impl Parse for Position {
fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.