8000 Convert UNICODE_VERSION into a tuple. · unicode-rs/rust-caseless@237fb8c · GitHub
[go: up one dir, main page]

Skip to content

Commit 237fb8c

Browse files
author
Clar Charr
committed
Convert UNICODE_VERSION into a tuple.
1 parent efebf58 commit 237fb8c

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "caseless"
3-
version = "0.1.4"
3+
version = "0.2.0"
44
authors = ["Simon Sapin <simon.sapin@exyr.org>"]
55
description = "Unicode caseless matching"
66
repository = "https://github.com/SimonSapin/rust-caseless"

src/build.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,22 @@ const MAX_FOLDED_CODE_POINTS: usize = 3;
1313
fn main() {
1414
let mut lines = include_str!("../CaseFolding.txt").lines();
1515
let first_line = lines.next().unwrap();
16-
let version_regex = Regex::new(r"^# CaseFolding-(\d+.\d+.\d+).txt$").unwrap();
17-
let unicode_version = &version_regex.captures(first_line).unwrap()[1];
16+
let version_regex = Regex::new(r"^# CaseFolding-(\d+)\.(\d+)\.(\d+).txt$").unwrap();
17+
let unicode_version = &version_regex.captures(first_line).unwrap();
18+
let (major, minor, patch): (u64, u64, u64) = (
19+
unicode_version[1].parse().unwrap(),
20+
unicode_version[2].parse().unwrap(),
21+
unicode_version[3].parse().unwrap(),
22+
);
1823

1924
let dst = Path::new(&env::var("OUT_DIR").unwrap()).join("case_folding_data.rs");
20-
let mut f = &mut File::create(&dst).unwrap();
25+
let f = &mut File::create(&dst).unwrap();
2126

2227
macro_rules! w {
2328
($($args: tt)+) => { (write!(f, $($args)+)).unwrap(); }
2429
};
2530

26 5091 -
w!("pub const UNICODE_VERSION: &'static str = \"{}\";\n", unicode_version);
31+
w!("pub const UNICODE_VERSION: (u64, u64, u64) = ({}, {}, {});\n", major, minor, patch);
2732
w!("const CASE_FOLDING_TABLE: &'static [(char, [char; 3])] = &[\n");
2833

2934
// Entry with C (common case folding) or F (full case folding) status

0 commit comments

Comments
 (0)
0