1#![allow(
18 non_snake_case,
19 non_camel_case_types,
20)]
21
22#[cfg(all(feature = "icu_version_in_env", feature = "icu_config"))]
23compile_error!(
24 "Features `icu_version_in_env` and `icu_config` are not compatible."
25 + " Choose at most one of them."
26);
27
28#[cfg(all(feature = "icu_config", not(feature = "use-bindgen")))]
29compile_error!("Feature `icu_config` is useless without the feature `use-bindgen`");
30
31#[cfg(all(not(feature = "renaming"), not(feature = "use-bindgen")))]
34compile_error!("You must use `renaming` when not using `use-bindgen`");
35
36#[cfg(feature = "use-bindgen")]
37include!(concat!(env!("OUT_DIR"), "/macros.rs"));
38#[cfg(all(
39 feature = "use-bindgen",
40 feature = "icu_config",
41 not(feature = "icu_version_in_env")
42))]
43include!(concat!(env!("OUT_DIR"), "/lib.rs"));
44
45#[cfg(not(feature = "use-bindgen"))]
46include!("../bindgen/macros.rs");
47
48#[cfg(all(
49 not(feature = "use-bindgen"),
50 not(feature = "icu_version_in_env"),
51 not(feature = "icu_config")
52))]
53include!("../bindgen/lib.rs");
54
55#[cfg(all(
56 not(feature = "use-bindgen"),
57 feature = "icu_version_in_env",
58 not(feature = "icu_config")
59))]
60include!(concat!(
61 "../bindgen/lib_",
62 env!("RUST_ICU_MAJOR_VERSION_NUMBER"),
63 ".rs"
64));
65
66impl std::fmt::Display for UErrorCode {
69 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
70 write!(f, "{:?}", self)
71 }
72}
73
74extern crate libc;
75
76impl From<i8> for UCharCategory {
77 fn from(value: i8) -> Self {
78 match value {
79 0 => UCharCategory::U_UNASSIGNED,
80 1 => UCharCategory::U_UPPERCASE_LETTER,
81 2 => UCharCategory::U_LOWERCASE_LETTER,
82 3 => UCharCategory::U_TITLECASE_LETTER,
83 4 => UCharCategory::U_MODIFIER_LETTER,
84 5 => UCharCategory::U_OTHER_LETTER,
85 6 => UCharCategory::U_NON_SPACING_MARK,
86 7 => UCharCategory::U_ENCLOSING_MARK,
87 8 => UCharCategory::U_COMBINING_SPACING_MARK,
88 9 => UCharCategory::U_DECIMAL_DIGIT_NUMBER,
89 10 => UCharCategory::U_LETTER_NUMBER,
90 11 => UCharCategory::U_OTHER_NUMBER,
91 12 => UCharCategory::U_SPACE_SEPARATOR,
92 13 => UCharCategory::U_LINE_SEPARATOR,
93 14 => UCharCategory::U_PARAGRAPH_SEPARATOR,
94 15 => UCharCategory::U_CONTROL_CHAR,
95 16 => UCharCategory::U_FORMAT_CHAR,
96 17 => UCharCategory::U_PRIVATE_USE_CHAR,
97 18 => UCharCategory::U_SURROGATE,
98 19 => UCharCategory::U_DASH_PUNCTUATION,
99 20 => UCharCategory::U_START_PUNCTUATION,
100 21 => UCharCategory::U_END_PUNCTUATION,
101 22 => UCharCategory::U_CONNECTOR_PUNCTUATION,
102 23 => UCharCategory::U_OTHER_PUNCTUATION,
103 24 => UCharCategory::U_MATH_SYMBOL,
104 25 => UCharCategory::U_CURRENCY_SYMBOL,
105 26 => UCharCategory::U_MODIFIER_SYMBOL,
106 27 => UCharCategory::U_OTHER_SYMBOL,
107 28 => UCharCategory::U_INITIAL_PUNCTUATION,
108 29 => UCharCategory::U_FINAL_PUNCTUATION,
109 30 => UCharCategory::U_CHAR_CATEGORY_COUNT,
110 _ => {
111 panic!("could not convert: {}", value);
112 }
113 }
114 }
115}
116
117#[doc(hidden)]
119pub mod __private_do_not_use {
120 pub extern crate paste;
121}