From 8cdfa445d6629ffef4cb84967ff7017654045bc2 Mon Sep 17 00:00:00 2001 From: mo khan Date: Wed, 2 Jul 2025 18:36:06 -0600 Subject: chore: add vendor directory --- vendor/unicode-script/src/lib.rs | 560 ++++++ vendor/unicode-script/src/tables.rs | 3497 +++++++++++++++++++++++++++++++++++ 2 files changed, 4057 insertions(+) create mode 100644 vendor/unicode-script/src/lib.rs create mode 100644 vendor/unicode-script/src/tables.rs (limited to 'vendor/unicode-script/src') diff --git a/vendor/unicode-script/src/lib.rs b/vendor/unicode-script/src/lib.rs new file mode 100644 index 00000000..a8e3026b --- /dev/null +++ b/vendor/unicode-script/src/lib.rs @@ -0,0 +1,560 @@ +//! This crate exposes the Unicode `Script` and `Script_Extension` +//! properties from [UAX #24](http://www.unicode.org/reports/tr24/) + +#![cfg_attr(not(test), no_std)] +#![cfg_attr(feature = "bench", feature(test))] + +mod tables; + +use core::convert::TryFrom; +use core::fmt; +use core::u64; +pub use tables::script_extensions; +use tables::{get_script, get_script_extension, NEXT_SCRIPT}; +pub use tables::{Script, UNICODE_VERSION}; + +impl Script { + /// Get the full name of a script. + pub fn full_name(self) -> &'static str { + self.inner_full_name() + } + + /// Attempts to parse script name from the provided string. + /// Returns `None` if the provided string does not represent a valid + /// script full name. + pub fn from_full_name(input: &str) -> Option { + Self::inner_from_full_name(input) + } + + /// Get the four-character short name of a script. + pub fn short_name(self) -> &'static str { + self.inner_short_name() + } + + /// Attempts to parse script name from the provided string. + /// Returns `None` if the provided string does not represent a valid + /// script four-character short name. + pub fn from_short_name(input: &str) -> Option { + Self::inner_from_short_name(input) + } + + /// Is this script "Recommended" according to + /// [UAX #31](www.unicode.org/reports/tr31/#Table_Recommended_Scripts)? + pub fn is_recommended(self) -> bool { + use Script::*; + match self { + Common | Inherited | Arabic | Armenian | Bengali | Bopomofo | Cyrillic | Devanagari + | Ethiopic | Georgian | Greek | Gujarati | Gurmukhi | Han | Hangul | Hebrew + | Hiragana | Kannada | Katakana | Khmer | Lao | Latin | Malayalam | Myanmar | Oriya + | Sinhala | Tamil | Telugu | Thaana | Thai | Tibetan => true, + _ => false, + } + } +} + +impl From