macro_rules! char_collect { ({ $($x:tt)+ }) => { ... }; ( $( $x:expr ),* ) => { ... }; }
Expand description
Generate a [CharCollection] from a sequence of char
s,
CharRanges, or Unicode Blocks.
The macro can be used with either a comma-separated list of items, or with an expression representing set operations.
use char_collection::char_collect;
use unicode_blocks::UnicodeBlockId;
use unic_char_range::CharRange;
let c1 = char_collect!(
'a'..='z',
CharRange::closed('D', 'G'),
UnicodeBlockId::Cyrillic,
0x01..=0x05,
'@');
let c2 = char_collect!({ ('a'..='z') - ('p'..='t') + UnicodeBlockId::Bengali });
NOTE: Parenthetical expressions currently aren’t supported unless they start with a
CharCollection
.
use char_collection::char_collect;
// This works:
let c1 = char_collect!({ ('a'..='z') + (char_collect!('A'..='Z') - ('L'..='P')) });
// This doesn't:
let c1 = char_collect!({ ('a'..='z') + (('A'..='Z') - ('L'..='P')) });