1 // This file is part of ICU4X. For terms of use, please see the file
2 // called LICENSE at the top level of the ICU4X source tree
3 // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ).
4
5 // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations
6 #![cfg_attr(not(any(test, feature = "std")), no_std)]
7 #![cfg_attr(
8 not(test),
9 deny(
10 clippy::indexing_slicing,
11 clippy::unwrap_used,
12 clippy::expect_used,
13 clippy::panic,
14 // Exhaustiveness and Debug is not required for Diplomat types
15 )
16 )]
17 // Diplomat limitations
18 #![allow(
19 clippy::needless_lifetimes,
20 clippy::result_unit_err,
21 clippy::should_implement_trait
22 )]
23
24 //! This crate contains the source of truth for the [Diplomat](https://github.com/rust-diplomat/diplomat)-generated
25 //! FFI bindings. This generates the C, C++, JavaScript, and TypeScript bindings. This crate also contains the `extern "C"`
26 //! FFI for ICU4X.
27 //!
28 //! While the types in this crate are public, APIs from this crate are *not intended to be used from Rust*
29 //! and as such this crate may unpredictably change its Rust API across compatible semver versions. The `extern "C"` APIs exposed
30 //! by this crate, while not directly documented, are stable within the same major semver version, as are the bindings exposed under
31 //! the `cpp/` and `js/` folders.
32 //!
33 //! This crate may still be explored for documentation on docs.rs, and there are language-specific docs available as well.
34 //! C++, Dart, and TypeScript headers contain inline documentation, which is available pre-rendered: [C++], [TypeScript].
35 //!
36 //! This crate is `no_std`-compatible. If you wish to use it in `no_std` mode, you must write a wrapper crate that defines an allocator
37 //! and a panic hook in order to compile as a C library.
38 //!
39 //! More information on using ICU4X from C++ can be found in [our tutorial].
40 //!
41 //! [our tutorial]: https://github.com/unicode-org/icu4x/blob/main/tutorials/cpp.md
42 //! [TypeScript]: https://unicode-org.github.io/icu4x/tsdoc
43 //! [C++]: https://unicode-org.github.io/icu4x/cppdoc
44
45 // Renamed so you can't accidentally use it
46 #[cfg(target_arch = "wasm32")]
47 extern crate std as rust_std;
48
49 #[cfg(all(not(feature = "std"), feature = "looping_panic_handler"))]
50 #[panic_handler]
panic(_info: &core::panic::PanicInfo) -> !51 fn panic(_info: &core::panic::PanicInfo) -> ! {
52 loop {}
53 }
54
55 extern crate alloc;
56 #[cfg(all(not(feature = "std"), feature = "libc_alloc"))]
57 extern crate libc_alloc;
58
59 // Common modules
60 pub mod errors;
61 pub mod locale_core;
62 #[cfg(feature = "logging")]
63 pub mod logging;
64 #[macro_use]
65 pub mod provider;
66
67 // Components
68
69 #[cfg(feature = "properties")]
70 pub mod bidi;
71 #[cfg(any(feature = "datetime", feature = "timezone", feature = "calendar"))]
72 pub mod calendar;
73 #[cfg(feature = "casemap")]
74 pub mod casemap;
75 #[cfg(feature = "collator")]
76 pub mod collator;
77 #[cfg(feature = "properties")]
78 pub mod collections_sets;
79 #[cfg(any(feature = "datetime", feature = "timezone", feature = "calendar"))]
80 pub mod date;
81 #[cfg(any(feature = "datetime", feature = "timezone", feature = "calendar"))]
82 pub mod datetime;
83 #[cfg(feature = "datetime")]
84 pub mod datetime_formatter;
85 #[cfg(feature = "decimal")]
86 pub mod decimal;
87 #[cfg(feature = "experimental")]
88 pub mod displaynames;
89 #[cfg(feature = "locale")]
90 pub mod exemplar_chars;
91 #[cfg(feature = "locale")]
92 pub mod fallbacker;
93 #[cfg(feature = "decimal")]
94 pub mod fixed_decimal;
95 #[cfg(any(feature = "datetime", feature = "timezone"))]
96 pub mod iana_parser;
97 #[cfg(feature = "list")]
98 pub mod list;
99 #[cfg(feature = "locale")]
100 pub mod locale;
101 #[cfg(feature = "locale")]
102 pub mod locale_directionality;
103 #[cfg(feature = "datetime")]
104 pub mod neo_datetime;
105 #[cfg(feature = "normalizer")]
106 pub mod normalizer;
107 #[cfg(feature = "normalizer")]
108 pub mod normalizer_properties;
109 #[cfg(feature = "plurals")]
110 pub mod pluralrules;
111 #[cfg(feature = "properties")]
112 pub mod properties_bidi;
113 #[cfg(feature = "properties")]
114 pub mod properties_enums;
115 #[cfg(feature = "properties")]
116 pub mod properties_iter;
117 #[cfg(feature = "properties")]
118 pub mod properties_maps;
119 #[cfg(feature = "properties")]
120 pub mod properties_names;
121 #[cfg(feature = "properties")]
122 pub mod properties_sets;
123 #[cfg(feature = "properties")]
124 pub mod properties_unisets;
125 #[cfg(feature = "properties")]
126 pub mod script;
127 #[cfg(feature = "segmenter")]
128 pub mod segmenter_grapheme;
129 #[cfg(feature = "segmenter")]
130 pub mod segmenter_line;
131 #[cfg(feature = "segmenter")]
132 pub mod segmenter_sentence;
133 #[cfg(feature = "segmenter")]
134 pub mod segmenter_word;
135 #[cfg(any(feature = "datetime", feature = "timezone", feature = "calendar"))]
136 pub mod time;
137 #[cfg(any(feature = "datetime", feature = "timezone"))]
138 pub mod timezone;
139 #[cfg(feature = "experimental")]
140 pub mod units_converter;
141 #[cfg(any(feature = "datetime", feature = "timezone"))]
142 pub mod utc_offset;
143 #[cfg(feature = "calendar")]
144 pub mod week;
145 #[cfg(any(feature = "datetime", feature = "timezone"))]
146 pub mod windows_parser;
147 #[cfg(feature = "datetime")]
148 pub mod zoned_datetime;
149 #[cfg(feature = "datetime")]
150 pub mod zoned_formatter;
151