mod blocks {
use lazy_static::lazy_static;
use unic_char_range::CharRange;
use unic_ucd_block::{Block, BlockIter};
lazy_static! {
static ref BLOCKS: Vec<Block> = BlockIter::new().collect();
}
#[derive(Debug)]
pub enum UnicodeBlockId {
BasicLatin,
Latin1Supplement,
LatinExtendedA,
LatinExtendedB,
IPAExtensions,
SpacingModifierLetters,
CombiningDiacriticalMarks,
GreekandCoptic,
Cyrillic,
CyrillicSupplement,
Armenian,
Hebrew,
Arabic,
Syriac,
ArabicSupplement,
Thaana,
NKo,
Samaritan,
Mandaic,
SyriacSupplement,
ArabicExtendedA,
Devanagari,
Bengali,
Gurmukhi,
Gujarati,
Oriya,
Tamil,
Telugu,
Kannada,
Malayalam,
Sinhala,
Thai,
Lao,
Tibetan,
Myanmar,
Georgian,
HangulJamo,
Ethiopic,
EthiopicSupplement,
Cherokee,
UnifiedCanadianAboriginalSyllabics,
Ogham,
Runic,
Tagalog,
Hanunoo,
Buhid,
Tagbanwa,
Khmer,
Mongolian,
UnifiedCanadianAboriginalSyllabicsExtended,
Limbu,
TaiLe,
NewTaiLue,
KhmerSymbols,
Buginese,
TaiTham,
CombiningDiacriticalMarksExtended,
Balinese,
Sundanese,
Batak,
Lepcha,
OlChiki,
CyrillicExtendedC,
SundaneseSupplement,
VedicExtensions,
PhoneticExtensions,
PhoneticExtensionsSupplement,
CombiningDiacriticalMarksSupplement,
LatinExtendedAdditional,
GreekExtended,
GeneralPunctuation,
SuperscriptsandSubscripts,
CurrencySymbols,
CombiningDiacriticalMarksforSymbols,
LetterlikeSymbols,
NumberForms,
Arrows,
MathematicalOperators,
MiscellaneousTechnical,
ControlPictures,
OpticalCharacterRecognition,
EnclosedAlphanumerics,
BoxDrawing,
BlockElements,
GeometricShapes,
MiscellaneousSymbols,
Dingbats,
MiscellaneousMathematicalSymbolsA,
SupplementalArrowsA,
BraillePatterns,
SupplementalArrowsB,
MiscellaneousMathematicalSymbolsB,
SupplementalMathematicalOperators,
MiscellaneousSymbolsandArrows,
Glagolitic,
LatinExtendedC,
Coptic,
GeorgianSupplement,
Tifinagh,
EthiopicExtended,
CyrillicExtendedA,
SupplementalPunctuation,
CJKRadicalsSupplement,
KangxiRadicals,
IdeographicDescriptionCharacters,
CJKSymbolsandPunctuation,
Hiragana,
Katakana,
Bopomofo,
HangulCompatibilityJamo,
Kanbun,
BopomofoExtended,
CJKStrokes,
KatakanaPhoneticExtensions,
EnclosedCJKLettersandMonths,
CJKCompatibility,
CJKUnifiedIdeographsExtensionA,
YijingHexagramSymbols,
CJKUnifiedIdeographs,
YiSyllables,
YiRadicals,
Lisu,
Vai,
CyrillicExtendedB,
Bamum,
ModifierToneLetters,
LatinExtendedD,
SylotiNagri,
CommonIndicNumberForms,
Phagspa,
Saurashtra,
DevanagariExtended,
KayahLi,
Rejang,
HangulJamoExtendedA,
Javanese,
MyanmarExtendedB,
Cham,
MyanmarExtendedA,
TaiViet,
MeeteiMayekExtensions,
EthiopicExtendedA,
LatinExtendedE,
CherokeeSupplement,
MeeteiMayek,
HangulSyllables,
HangulJamoExtendedB,
PrivateUseArea,
CJKCompatibilityIdeographs,
AlphabeticPresentationForms,
ArabicPresentationFormsA,
VariationSelectors,
VerticalForms,
CombiningHalfMarks,
CJKCompatibilityForms,
SmallFormVariants,
ArabicPresentationFormsB,
HalfwidthandFullwidthForms,
Specials,
LinearBSyllabary,
LinearBIdeograms,
AegeanNumbers,
AncientGreekNumbers,
AncientSymbols,
PhaistosDisc,
Lycian,
Carian,
CopticEpactNumbers,
OldItalic,
Gothic,
OldPermic,
Ugaritic,
OldPersian,
Deseret,
Shavian,
Osmanya,
Osage,
Elbasan,
CaucasianAlbanian,
LinearA,
CypriotSyllabary,
ImperialAramaic,
Palmyrene,
Nabataean,
Hatran,
Phoenician,
Lydian,
MeroiticHieroglyphs,
MeroiticCursive,
Kharoshthi,
OldSouthArabian,
OldNorthArabian,
Manichaean,
Avestan,
InscriptionalParthian,
InscriptionalPahlavi,
PsalterPahlavi,
OldTurkic,
OldHungarian,
RumiNumeralSymbols,
Brahmi,
Kaithi,
SoraSompeng,
Chakma,
Mahajani,
Sharada,
SinhalaArchaicNumbers,
Khojki,
Multani,
Khudawadi,
Grantha,
Newa,
Tirhuta,
Siddham,
Modi,
MongolianSupplement,
Takri,
Ahom,
WarangCiti,
ZanabazarSquare,
Soyombo,
PauCinHau,
Bhaiksuki,
Marchen,
MasaramGondi,
Cuneiform,
CuneiformNumbersandPunctuation,
EarlyDynasticCuneiform,
EgyptianHieroglyphs,
AnatolianHieroglyphs,
BamumSupplement,
Mro,
BassaVah,
PahawhHmong,
Miao,
IdeographicSymbolsandPunctuation,
Tangut,
TangutComponents,
KanaSupplement,
KanaExtendedA,
Nushu,
Duployan,
ShorthandFormatControls,
ByzantineMusicalSymbols,
MusicalSymbols,
AncientGreekMusicalNotation,
TaiXuanJingSymbols,
CountingRodNumerals,
MathematicalAlphanumericSymbols,
SuttonSignWriting,
GlagoliticSupplement,
MendeKikakui,
Adlam,
ArabicMathematicalAlphabeticSymbols,
MahjongTiles,
DominoTiles,
PlayingCards,
EnclosedAlphanumericSupplement,
EnclosedIdeographicSupplement,
MiscellaneousSymbolsandPictographs,
Emoticons,
OrnamentalDingbats,
TransportandMapSymbols,
AlchemicalSymbols,
GeometricShapesExtended,
SupplementalArrowsC,
SupplementalSymbolsandPictographs,
CJKUnifiedIdeographsExtensionB,
CJKUnifiedIdeographsExtensionC,
CJKUnifiedIdeographsExtensionD,
CJKUnifiedIdeographsExtensionE,
CJKUnifiedIdeographsExtensionF,
CJKCompatibilityIdeographsSupplement,
Tags,
VariationSelectorsSupplement,
SupplementaryPrivateUseAreaA,
SupplementaryPrivateUseAreaB,
}
impl UnicodeBlockId {
pub fn name(&self) -> &str {
self.block().name
}
pub fn char_range(&self) -> CharRange {
self.block().range
}
pub fn block(&self) -> &'static Block {
&BLOCKS[self.idx()]
}
fn idx(&self) -> usize {
match self {
UnicodeBlockId::BasicLatin => 0,
UnicodeBlockId::Latin1Supplement => 1,
UnicodeBlockId::LatinExtendedA => 2,
UnicodeBlockId::LatinExtendedB => 3,
UnicodeBlockId::IPAExtensions => 4,
UnicodeBlockId::SpacingModifierLetters => 5,
UnicodeBlockId::CombiningDiacriticalMarks => 6,
UnicodeBlockId::GreekandCoptic => 7,
UnicodeBlockId::Cyrillic => 8,
UnicodeBlockId::CyrillicSupplement => 9,
UnicodeBlockId::Armenian => 10,
UnicodeBlockId::Hebrew => 11,
UnicodeBlockId::Arabic => 12,
UnicodeBlockId::Syriac => 13,
UnicodeBlockId::ArabicSupplement => 14,
UnicodeBlockId::Thaana => 15,
UnicodeBlockId::NKo => 16,
UnicodeBlockId::Samaritan => 17,
UnicodeBlockId::Mandaic => 18,
UnicodeBlockId::SyriacSupplement => 19,
UnicodeBlockId::ArabicExtendedA => 20,
UnicodeBlockId::Devanagari => 21,
UnicodeBlockId::Bengali => 22,
UnicodeBlockId::Gurmukhi => 23,
UnicodeBlockId::Gujarati => 24,
UnicodeBlockId::Oriya => 25,
UnicodeBlockId::Tamil => 26,
UnicodeBlockId::Telugu => 27,
UnicodeBlockId::Kannada => 28,
UnicodeBlockId::Malayalam => 29,
UnicodeBlockId::Sinhala => 30,
UnicodeBlockId::Thai => 31,
UnicodeBlockId::Lao => 32,
UnicodeBlockId::Tibetan => 33,
UnicodeBlockId::Myanmar => 34,
UnicodeBlockId::Georgian => 35,
UnicodeBlockId::HangulJamo => 36,
UnicodeBlockId::Ethiopic => 37,
UnicodeBlockId::EthiopicSupplement => 38,
UnicodeBlockId::Cherokee => 39,
UnicodeBlockId::UnifiedCanadianAboriginalSyllabics => 40,
UnicodeBlockId::Ogham => 41,
UnicodeBlockId::Runic => 42,
UnicodeBlockId::Tagalog => 43,
UnicodeBlockId::Hanunoo => 44,
UnicodeBlockId::Buhid => 45,
UnicodeBlockId::Tagbanwa => 46,
UnicodeBlockId::Khmer => 47,
UnicodeBlockId::Mongolian => 48,
UnicodeBlockId::UnifiedCanadianAboriginalSyllabicsExtended => 49,
UnicodeBlockId::Limbu => 50,
UnicodeBlockId::TaiLe => 51,
UnicodeBlockId::NewTaiLue => 52,
UnicodeBlockId::KhmerSymbols => 53,
UnicodeBlockId::Buginese => 54,
UnicodeBlockId::TaiTham => 55,
UnicodeBlockId::CombiningDiacriticalMarksExtended => 56,
UnicodeBlockId::Balinese => 57,
UnicodeBlockId::Sundanese => 58,
UnicodeBlockId::Batak => 59,
UnicodeBlockId::Lepcha => 60,
UnicodeBlockId::OlChiki => 61,
UnicodeBlockId::CyrillicExtendedC => 62,
UnicodeBlockId::SundaneseSupplement => 63,
UnicodeBlockId::VedicExtensions => 64,
UnicodeBlockId::PhoneticExtensions => 65,
UnicodeBlockId::PhoneticExtensionsSupplement => 66,
UnicodeBlockId::CombiningDiacriticalMarksSupplement => 67,
UnicodeBlockId::LatinExtendedAdditional => 68,
UnicodeBlockId::GreekExtended => 69,
UnicodeBlockId::GeneralPunctuation => 70,
UnicodeBlockId::SuperscriptsandSubscripts => 71,
UnicodeBlockId::CurrencySymbols => 72,
UnicodeBlockId::CombiningDiacriticalMarksforSymbols => 73,
UnicodeBlockId::LetterlikeSymbols => 74,
UnicodeBlockId::NumberForms => 75,
UnicodeBlockId::Arrows => 76,
UnicodeBlockId::MathematicalOperators => 77,
UnicodeBlockId::MiscellaneousTechnical => 78,
UnicodeBlockId::ControlPictures => 79,
UnicodeBlockId::OpticalCharacterRecognition => 80,
UnicodeBlockId::EnclosedAlphanumerics => 81,
UnicodeBlockId::BoxDrawing => 82,
UnicodeBlockId::BlockElements => 83,
UnicodeBlockId::GeometricShapes => 84,
UnicodeBlockId::MiscellaneousSymbols => 85,
UnicodeBlockId::Dingbats => 86,
UnicodeBlockId::MiscellaneousMathematicalSymbolsA => 87,
UnicodeBlockId::SupplementalArrowsA => 88,
UnicodeBlockId::BraillePatterns => 89,
UnicodeBlockId::SupplementalArrowsB => 90,
UnicodeBlockId::MiscellaneousMathematicalSymbolsB => 91,
UnicodeBlockId::SupplementalMathematicalOperators => 92,
UnicodeBlockId::MiscellaneousSymbolsandArrows => 93,
UnicodeBlockId::Glagolitic => 94,
UnicodeBlockId::LatinExtendedC => 95,
UnicodeBlockId::Coptic => 96,
UnicodeBlockId::GeorgianSupplement => 97,
UnicodeBlockId::Tifinagh => 98,
UnicodeBlockId::EthiopicExtended => 99,
UnicodeBlockId::CyrillicExtendedA => 100,
UnicodeBlockId::SupplementalPunctuation => 101,
UnicodeBlockId::CJKRadicalsSupplement => 102,
UnicodeBlockId::KangxiRadicals => 103,
UnicodeBlockId::IdeographicDescriptionCharacters => 104,
UnicodeBlockId::CJKSymbolsandPunctuation => 105,
UnicodeBlockId::Hiragana => 106,
UnicodeBlockId::Katakana => 107,
UnicodeBlockId::Bopomofo => 108,
UnicodeBlockId::HangulCompatibilityJamo => 109,
UnicodeBlockId::Kanbun => 110,
UnicodeBlockId::BopomofoExtended => 111,
UnicodeBlockId::CJKStrokes => 112,
UnicodeBlockId::KatakanaPhoneticExtensions => 113,
UnicodeBlockId::EnclosedCJKLettersandMonths => 114,
UnicodeBlockId::CJKCompatibility => 115,
UnicodeBlockId::CJKUnifiedIdeographsExtensionA => 116,
UnicodeBlockId::YijingHexagramSymbols => 117,
UnicodeBlockId::CJKUnifiedIdeographs => 118,
UnicodeBlockId::YiSyllables => 119,
UnicodeBlockId::YiRadicals => 120,
UnicodeBlockId::Lisu => 121,
UnicodeBlockId::Vai => 122,
UnicodeBlockId::CyrillicExtendedB => 123,
UnicodeBlockId::Bamum => 124,
UnicodeBlockId::ModifierToneLetters => 125,
UnicodeBlockId::LatinExtendedD => 126,
UnicodeBlockId::SylotiNagri => 127,
UnicodeBlockId::CommonIndicNumberForms => 128,
UnicodeBlockId::Phagspa => 129,
UnicodeBlockId::Saurashtra => 130,
UnicodeBlockId::DevanagariExtended => 131,
UnicodeBlockId::KayahLi => 132,
UnicodeBlockId::Rejang => 133,
UnicodeBlockId::HangulJamoExtendedA => 134,
UnicodeBlockId::Javanese => 135,
UnicodeBlockId::MyanmarExtendedB => 136,
UnicodeBlockId::Cham => 137,
UnicodeBlockId::MyanmarExtendedA => 138,
UnicodeBlockId::TaiViet => 139,
UnicodeBlockId::MeeteiMayekExtensions => 140,
UnicodeBlockId::EthiopicExtendedA => 141,
UnicodeBlockId::LatinExtendedE => 142,
UnicodeBlockId::CherokeeSupplement => 143,
UnicodeBlockId::MeeteiMayek => 144,
UnicodeBlockId::HangulSyllables => 145,
UnicodeBlockId::HangulJamoExtendedB => 146,
UnicodeBlockId::PrivateUseArea => 147,
UnicodeBlockId::CJKCompatibilityIdeographs => 148,
UnicodeBlockId::AlphabeticPresentationForms => 149,
UnicodeBlockId::ArabicPresentationFormsA => 150,
UnicodeBlockId::VariationSelectors => 151,
UnicodeBlockId::VerticalForms => 152,
UnicodeBlockId::CombiningHalfMarks => 153,
UnicodeBlockId::CJKCompatibilityForms => 154,
UnicodeBlockId::SmallFormVariants => 155,
UnicodeBlockId::ArabicPresentationFormsB => 156,
UnicodeBlockId::HalfwidthandFullwidthForms => 157,
UnicodeBlockId::Specials => 158,
UnicodeBlockId::LinearBSyllabary => 159,
UnicodeBlockId::LinearBIdeograms => 160,
UnicodeBlockId::AegeanNumbers => 161,
UnicodeBlockId::AncientGreekNumbers => 162,
UnicodeBlockId::AncientSymbols => 163,
UnicodeBlockId::PhaistosDisc => 164,
UnicodeBlockId::Lycian => 165,
UnicodeBlockId::Carian => 166,
UnicodeBlockId::CopticEpactNumbers => 167,
UnicodeBlockId::OldItalic => 168,
UnicodeBlockId::Gothic => 169,
UnicodeBlockId::OldPermic => 170,
UnicodeBlockId::Ugaritic => 171,
UnicodeBlockId::OldPersian => 172,
UnicodeBlockId::Deseret => 173,
UnicodeBlockId::Shavian => 174,
UnicodeBlockId::Osmanya => 175,
UnicodeBlockId::Osage => 176,
UnicodeBlockId::Elbasan => 177,
UnicodeBlockId::CaucasianAlbanian => 178,
UnicodeBlockId::LinearA => 179,
UnicodeBlockId::CypriotSyllabary => 180,
UnicodeBlockId::ImperialAramaic => 181,
UnicodeBlockId::Palmyrene => 182,
UnicodeBlockId::Nabataean => 183,
UnicodeBlockId::Hatran => 184,
UnicodeBlockId::Phoenician => 185,
UnicodeBlockId::Lydian => 186,
UnicodeBlockId::MeroiticHieroglyphs => 187,
UnicodeBlockId::MeroiticCursive => 188,
UnicodeBlockId::Kharoshthi => 189,
UnicodeBlockId::OldSouthArabian => 190,
UnicodeBlockId::OldNorthArabian => 191,
UnicodeBlockId::Manichaean => 192,
UnicodeBlockId::Avestan => 193,
UnicodeBlockId::InscriptionalParthian => 194,
UnicodeBlockId::InscriptionalPahlavi => 195,
UnicodeBlockId::PsalterPahlavi => 196,
UnicodeBlockId::OldTurkic => 197,
UnicodeBlockId::OldHungarian => 198,
UnicodeBlockId::RumiNumeralSymbols => 199,
UnicodeBlockId::Brahmi => 200,
UnicodeBlockId::Kaithi => 201,
UnicodeBlockId::SoraSompeng => 202,
UnicodeBlockId::Chakma => 203,
UnicodeBlockId::Mahajani => 204,
UnicodeBlockId::Sharada => 205,
UnicodeBlockId::SinhalaArchaicNumbers => 206,
UnicodeBlockId::Khojki => 207,
UnicodeBlockId::Multani => 208,
UnicodeBlockId::Khudawadi => 209,
UnicodeBlockId::Grantha => 210,
UnicodeBlockId::Newa => 211,
UnicodeBlockId::Tirhuta => 212,
UnicodeBlockId::Siddham => 213,
UnicodeBlockId::Modi => 214,
UnicodeBlockId::MongolianSupplement => 215,
UnicodeBlockId::Takri => 216,
UnicodeBlockId::Ahom => 217,
UnicodeBlockId::WarangCiti => 218,
UnicodeBlockId::ZanabazarSquare => 219,
UnicodeBlockId::Soyombo => 220,
UnicodeBlockId::PauCinHau => 221,
UnicodeBlockId::Bhaiksuki => 222,
UnicodeBlockId::Marchen => 223,
UnicodeBlockId::MasaramGondi => 224,
UnicodeBlockId::Cuneiform => 225,
UnicodeBlockId::CuneiformNumbersandPunctuation => 226,
UnicodeBlockId::EarlyDynasticCuneiform => 227,
UnicodeBlockId::EgyptianHieroglyphs => 228,
UnicodeBlockId::AnatolianHieroglyphs => 229,
UnicodeBlockId::BamumSupplement => 230,
UnicodeBlockId::Mro => 231,
UnicodeBlockId::BassaVah => 232,
UnicodeBlockId::PahawhHmong => 233,
UnicodeBlockId::Miao => 234,
UnicodeBlockId::IdeographicSymbolsandPunctuation => 235,
UnicodeBlockId::Tangut => 236,
UnicodeBlockId::TangutComponents => 237,
UnicodeBlockId::KanaSupplement => 238,
UnicodeBlockId::KanaExtendedA => 239,
UnicodeBlockId::Nushu => 240,
UnicodeBlockId::Duployan => 241,
UnicodeBlockId::ShorthandFormatControls => 242,
UnicodeBlockId::ByzantineMusicalSymbols => 243,
UnicodeBlockId::MusicalSymbols => 244,
UnicodeBlockId::AncientGreekMusicalNotation => 245,
UnicodeBlockId::TaiXuanJingSymbols => 246,
UnicodeBlockId::CountingRodNumerals => 247,
UnicodeBlockId::MathematicalAlphanumericSymbols => 248,
UnicodeBlockId::SuttonSignWriting => 249,
UnicodeBlockId::GlagoliticSupplement => 250,
UnicodeBlockId::MendeKikakui => 251,
UnicodeBlockId::Adlam => 252,
UnicodeBlockId::ArabicMathematicalAlphabeticSymbols => 253,
UnicodeBlockId::MahjongTiles => 254,
UnicodeBlockId::DominoTiles => 255,
UnicodeBlockId::PlayingCards => 256,
UnicodeBlockId::EnclosedAlphanumericSupplement => 257,
UnicodeBlockId::EnclosedIdeographicSupplement => 258,
UnicodeBlockId::MiscellaneousSymbolsandPictographs => 259,
UnicodeBlockId::Emoticons => 260,
UnicodeBlockId::OrnamentalDingbats => 261,
UnicodeBlockId::TransportandMapSymbols => 262,
UnicodeBlockId::AlchemicalSymbols => 263,
UnicodeBlockId::GeometricShapesExtended => 264,
UnicodeBlockId::SupplementalArrowsC => 265,
UnicodeBlockId::SupplementalSymbolsandPictographs => 266,
UnicodeBlockId::CJKUnifiedIdeographsExtensionB => 267,
UnicodeBlockId::CJKUnifiedIdeographsExtensionC => 268,
UnicodeBlockId::CJKUnifiedIdeographsExtensionD => 269,
UnicodeBlockId::CJKUnifiedIdeographsExtensionE => 270,
UnicodeBlockId::CJKUnifiedIdeographsExtensionF => 271,
UnicodeBlockId::CJKCompatibilityIdeographsSupplement => 272,
UnicodeBlockId::Tags => 273,
UnicodeBlockId::VariationSelectorsSupplement => 274,
UnicodeBlockId::SupplementaryPrivateUseAreaA => 275,
UnicodeBlockId::SupplementaryPrivateUseAreaB => 276,
}
}
}
impl From<&UnicodeBlockId> for CharRange {
fn from(source: &UnicodeBlockId) -> Self {
source.char_range()
}
}
}
pub use blocks::UnicodeBlockId;