aboutsummaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2021-04-08 09:51:44 +0200
committerMartin Fischer <martin@push-f.com>2021-04-08 15:40:48 +0200
commit69c070d9436028a3eed97596243bb52aee198210 (patch)
tree9708a10a3225d46571fc3d15bf2f9130d520d6b1 /src/lib.rs
parent071a1bf860900482079c0f602430ebdc425e5fee (diff)
merge buffer_queue and smallcharset from markup5ever
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 1d6e2d1..95647ff 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -18,8 +18,31 @@ pub use tendril;
#[macro_use]
mod macros;
+/// Create a [`SmallCharSet`], with each space-separated number stored in the set.
+///
+/// # Examples
+///
+/// ```
+/// # #[macro_use] extern crate markup5ever;
+/// # fn main() {
+/// let set = small_char_set!(12 54 42);
+/// assert_eq!(set.bits,
+/// 0b00000000_01000000_00000100_00000000_00000000_00000000_00010000_00000000);
+/// # }
+/// ```
+///
+/// [`SmallCharSet`]: struct.SmallCharSet.html
+#[macro_export]
+macro_rules! small_char_set ( ($($e:expr)+) => (
+ $ crate ::util::smallcharset::SmallCharSet {
+ bits: $( (1 << ($e as usize)) )|+
+ }
+));
+
mod util {
pub mod str;
+ pub mod buffer_queue;
+ pub mod smallcharset;
}
pub mod tokenizer;