From 91cf14c18c17d3b6628b50315ac7127687eae25c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Tue, 5 Jun 2018 11:36:55 +0200 Subject: [PATCH 1/2] Expose serializer::serialize_name. I want to use it to remove some stupid allocations in Servo, which effectively do: serialize_identifier(format!("--{}", custom_prop_name)); And could do instead: write_str("--"); serialize_name(custom_prop_name); --- src/serializer.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/serializer.rs b/src/serializer.rs index 1a737946..34f5569d 100644 --- a/src/serializer.rs +++ b/src/serializer.rs @@ -188,8 +188,11 @@ pub fn serialize_identifier(mut value: &str, dest: &mut W) -> fmt::Result whe } } - -fn serialize_name(value: &str, dest: &mut W) -> fmt::Result where W:fmt::Write { +/// Write a CSS name, like a custom property name. +/// +/// You should only use this when you know what you're doing, when in doubt, +/// consider using `serialize_identifier`. +pub fn serialize_name(value: &str, dest: &mut W) -> fmt::Result where W:fmt::Write { let mut chunk_start = 0; for (i, b) in value.bytes().enumerate() { let escaped = match b { From b4d5e05439ac948de1902b56aebf2492a0f150cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Tue, 5 Jun 2018 11:39:21 +0200 Subject: [PATCH 2/2] Bump version. --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index e2a436fd..d4652633 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cssparser" -version = "0.23.7" +version = "0.23.8" authors = [ "Simon Sapin " ] description = "Rust implementation of CSS Syntax Level 3"