Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 26 additions & 3 deletions src/libstd_unicode/tables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,32 @@

#![allow(missing_docs, non_upper_case_globals, non_snake_case)]

/// The version of [Unicode](http://www.unicode.org/)
/// that the unicode parts of `CharExt` and `UnicodeStrPrelude` traits are based on.
pub const UNICODE_VERSION: (u64, u64, u64) = (10, 0, 0);
/// Represents a Unicode Version.
///
/// See also: <http://www.unicode.org/versions/>
#[derive(Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd)]
pub struct UnicodeVersion {
/// Major version.
pub major: u32,

/// Minor version.
pub minor: u32,

/// Micro (or Update) version.
pub micro: u32,

// Private field to keep struct expandable.
_priv: (),
}

/// The version of [Unicode](http://www.unicode.org/) that the Unicode parts of
/// `CharExt` and `UnicodeStrPrelude` traits are based on.
pub const UNICODE_VERSION: UnicodeVersion = UnicodeVersion {
major: 10,
minor: 0,
micro: 0,
_priv: (),
};


// BoolTrie is a trie for representing a set of Unicode codepoints. It is
Expand Down
29 changes: 26 additions & 3 deletions src/libstd_unicode/unicode.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,9 +560,32 @@ def emit_norm_module(f, canon, compat, combine, norm_props):
pattern = "for Version (\d+)\.(\d+)\.(\d+) of the Unicode"
unicode_version = re.search(pattern, readme.read()).groups()
rf.write("""
/// The version of [Unicode](http://www.unicode.org/)
/// that the unicode parts of `CharExt` and `UnicodeStrPrelude` traits are based on.
pub const UNICODE_VERSION: (u64, u64, u64) = (%s, %s, %s);
/// Represents a Unicode Version.
///
/// See also: <http://www.unicode.org/versions/>
#[derive(Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd)]
pub struct UnicodeVersion {
/// Major version.
pub major: u32,

/// Minor version.
pub minor: u32,

/// Micro (or Update) version.
pub micro: u32,

// Private field to keep struct expandable.
_priv: (),
}

/// The version of [Unicode](http://www.unicode.org/) that the Unicode parts of
/// `CharExt` and `UnicodeStrPrelude` traits are based on.
pub const UNICODE_VERSION: UnicodeVersion = UnicodeVersion {
major: %s,
minor: %s,
micro: %s,
_priv: (),
};
""" % unicode_version)
(canon_decomp, compat_decomp, gencats, combines,
to_upper, to_lower, to_title) = load_unicode_data("UnicodeData.txt")
Expand Down