aboutsummaryrefslogtreecommitdiffstats
path: root/components/style_traits/values.rs
diff options
context:
space:
mode:
authorAnthony Ramine <n.oxyde@gmail.com>2017-08-28 09:37:25 +0200
committerAnthony Ramine <n.oxyde@gmail.com>2017-08-28 12:26:43 +0200
commitba4136b5a8da58a6130aa3fab0654764bcdda25f (patch)
tree5135d881103ddc84c38aa8f0909bcce12159b7c3 /components/style_traits/values.rs
parent41c3be54ea414638e1b922d9ba06d0c98aec7988 (diff)
downloadservo-ba4136b5a8da58a6130aa3fab0654764bcdda25f.tar.gz
servo-ba4136b5a8da58a6130aa3fab0654764bcdda25f.zip
Document how style traits can be derived
Diffstat (limited to 'components/style_traits/values.rs')
-rw-r--r--components/style_traits/values.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/components/style_traits/values.rs b/components/style_traits/values.rs
index 5e4c093fd73..94e59e26bbe 100644
--- a/components/style_traits/values.rs
+++ b/components/style_traits/values.rs
@@ -18,8 +18,12 @@ use std::fmt::{self, Write};
/// of their name;
/// * unit variants whose name starts with "Moz" or "Webkit" are prepended
/// with a "-";
-/// * variants with fields get serialised as the space-separated serialisations
-/// of their fields.
+/// * if `#[css(comma)]` is found on a variant, its fields are separated by
+/// commas, otherwise, by spaces;
+/// * if `#[css(function)]` is found on a variant, the variant name gets
+/// serialised like unit variants and its fields are surrounded by parentheses;
+/// * finally, one can put `#[css(derive_debug)]` on the whole type, to
+/// implement `Debug` by a single call to `ToCss::to_css`.
pub trait ToCss {
/// Serialize `self` in CSS syntax, writing to `dest`.
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: Write;