mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Move impl's into macro for macro-generated keyword types
Three keyword types are created through a macro but have some of their impl's handled elsewhere. Since all impl's are the same, this commit moves them into the macro to have them auto generated, for more concise code.
This commit is contained in:
parent
18c72ac28d
commit
f6d09a39f8
2 changed files with 17 additions and 52 deletions
|
@ -11,6 +11,7 @@
|
|||
use Atom;
|
||||
pub use cssparser::{RGBA, Token, Parser, serialize_identifier, serialize_string};
|
||||
use parser::{Parse, ParserContext};
|
||||
use properties::animated_properties::{ComputeDistance, Interpolate};
|
||||
use std::ascii::AsciiExt;
|
||||
use std::borrow::Cow;
|
||||
use std::fmt::{self, Debug};
|
||||
|
@ -126,6 +127,20 @@ macro_rules! define_keyword_type {
|
|||
}
|
||||
}
|
||||
|
||||
impl Interpolate for $name {
|
||||
#[inline]
|
||||
fn interpolate(&self, _other: &Self, _progress: f64) -> Result<Self, ()> {
|
||||
Ok($name)
|
||||
}
|
||||
}
|
||||
|
||||
impl ComputeDistance for $name {
|
||||
#[inline]
|
||||
fn compute_distance(&self, _other: &Self) -> Result<f64, ()> {
|
||||
Err(())
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Debug for $name {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, $css)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue