1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
use std::convert::TryFrom;
pub mod codepoint;
mod emoji_data;
pub mod mcc;
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub enum VariationSelector {
VS01 = 1,
VS02 = 2,
VS03 = 3,
VS15 = 15,
VS16 = 16,
}
impl TryFrom<char> for VariationSelector {
type Error = ();
fn try_from(ch: char) -> Result<Self, Self::Error> {
match ch {
'\u{FE00}' => Ok(VariationSelector::VS01),
'\u{FE01}' => Ok(VariationSelector::VS02),
'\u{FE02}' => Ok(VariationSelector::VS03),
'\u{FE0E}' => Ok(VariationSelector::VS15),
'\u{FE0F}' => Ok(VariationSelector::VS16),
_ => Err(()),
}
}
}
pub fn bool_prop_emoji_presentation(ch: char) -> bool {
emoji_data::EMOJI_PRESENTATION.contains_u32(ch as u32)
}