6 UcdFile
, UcdFileByCodepoint
, Codepoints
, CodepointIter
,
7 parse_codepoint_association
,
11 /// A single row in the `DerivedAge.txt` file.
12 #[derive(Clone, Debug, Default, Eq, PartialEq)]
14 /// The codepoint or codepoint range for this entry.
15 pub codepoints
: Codepoints
,
16 /// The age assigned to the codepoints in this entry.
20 impl UcdFile
for Age
{
21 fn relative_file_path() -> &'
static Path
{
22 Path
::new("DerivedAge.txt")
26 impl UcdFileByCodepoint
for Age
{
27 fn codepoints(&self) -> CodepointIter
{
28 self.codepoints
.into_iter()
32 impl FromStr
for Age
{
35 fn from_str(line
: &str) -> Result
<Age
, Error
> {
36 let (codepoints
, script
) = parse_codepoint_association(line
)?
;
38 codepoints
: codepoints
,
39 age
: script
.to_string(),
50 let line
= "2BD2 ; 10.0 # GROUP MARK\n";
51 let row
: Age
= line
.parse().unwrap();
52 assert_eq
!(row
.codepoints
, 0x2BD2);
53 assert_eq
!(row
.age
, "10.0");
58 let line
= "11D0B..11D36 ; 10.0 # [44] MASARAM GONDI LETTER AU..MASARAM GONDI VOWEL SIGN VOCALIC R\n";
59 let row
: Age
= line
.parse().unwrap();
60 assert_eq
!(row
.codepoints
, (0x11D0B, 0x11D36));
61 assert_eq
!(row
.age
, "10.0");