1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
// This file is part of ICU4X. For terms of use, please see the file
// called LICENSE at the top level of the ICU4X source tree
// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ).

// https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations
#![cfg_attr(not(any(test, feature = "std")), no_std)]
#![cfg_attr(
    not(test),
    deny(
        clippy::indexing_slicing,
        clippy::unwrap_used,
        clippy::expect_used,
        clippy::panic,
        // Exhaustiveness and Debug is not required for Diplomat types
    )
)]
// Diplomat limitations
#![allow(
    clippy::needless_lifetimes,
    clippy::result_unit_err,
    clippy::should_implement_trait
)]

//! This crate contains the source of truth for the [Diplomat](https://github.com/rust-diplomat/diplomat)-generated
//! FFI bindings. This generates the C, C++, JavaScript, and TypeScript bindings. This crate also contains the `extern "C"`
//! FFI for ICU4X.
//!
//! While the types in this crate are public, APIs from this crate are *not intended to be used from Rust*
//! and as such this crate may unpredictably change its Rust API across compatible semver versions. The `extern "C"` APIs exposed
//! by this crate, while not directly documented, are stable within the same major semver version, as are the bindings exposed under
//! the `cpp/` and `js/` folders.
//!
//! This crate may still be explored for documentation on docs.rs, and there are language-specific docs available as well.
//! C++, Dart, and TypeScript headers contain inline documentation, which is available pre-rendered: [C++], [TypeScript].
//!
//! 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
//! and a panic hook in order to compile as a C library.
//!
//! More information on using ICU4X from C++ can be found in [our tutorial].
//!
//! [our tutorial]: https://github.com/unicode-org/icu4x/blob/main/tutorials/cpp.md
//! [TypeScript]: https://unicode-org.github.io/icu4x/tsdoc
//! [C++]: https://unicode-org.github.io/icu4x/cppdoc

// Renamed so you can't accidentally use it
#[cfg(target_arch = "wasm32")]
extern crate std as rust_std;

#[cfg(all(not(feature = "std"), feature = "looping_panic_handler"))]
#[panic_handler]
fn panic(_info: &core::panic::PanicInfo) -> ! {
    loop {}
}

extern crate alloc;
#[cfg(all(not(feature = "std"), feature = "libc_alloc"))]
extern crate libc_alloc;

// Common modules
pub mod errors;
pub mod locale_core;
#[cfg(feature = "logging")]
pub mod logging;
#[macro_use]
pub mod provider;

// Components

#[cfg(feature = "properties")]
pub mod bidi;
#[cfg(any(feature = "datetime", feature = "timezone", feature = "calendar"))]
pub mod calendar;
#[cfg(feature = "casemap")]
pub mod casemap;
#[cfg(feature = "collator")]
pub mod collator;
#[cfg(feature = "properties")]
pub mod collections_sets;
#[cfg(any(feature = "datetime", feature = "timezone", feature = "calendar"))]
pub mod date;
#[cfg(any(feature = "datetime", feature = "timezone", feature = "calendar"))]
pub mod datetime;
#[cfg(feature = "datetime")]
pub mod datetime_formatter;
#[cfg(feature = "decimal")]
pub mod decimal;
#[cfg(feature = "experimental")]
pub mod displaynames;
#[cfg(feature = "locale")]
pub mod exemplar_chars;
#[cfg(feature = "locale")]
pub mod fallbacker;
#[cfg(feature = "decimal")]
pub mod fixed_decimal;
#[cfg(feature = "list")]
pub mod list;
#[cfg(feature = "locale")]
pub mod locale;
#[cfg(feature = "locale")]
pub mod locale_directionality;
#[cfg(feature = "normalizer")]
pub mod normalizer;
#[cfg(feature = "normalizer")]
pub mod normalizer_properties;
#[cfg(feature = "plurals")]
pub mod pluralrules;
#[cfg(feature = "properties")]
pub mod properties_enums;
#[cfg(feature = "properties")]
pub mod properties_iter;
#[cfg(feature = "properties")]
pub mod properties_maps;
#[cfg(feature = "properties")]
pub mod properties_names;
#[cfg(feature = "properties")]
pub mod properties_sets;
#[cfg(feature = "properties")]
pub mod properties_unisets;
#[cfg(feature = "properties")]
pub mod script;
#[cfg(feature = "segmenter")]
pub mod segmenter_grapheme;
#[cfg(feature = "segmenter")]
pub mod segmenter_line;
#[cfg(feature = "segmenter")]
pub mod segmenter_sentence;
#[cfg(feature = "segmenter")]
pub mod segmenter_word;
#[cfg(any(feature = "datetime", feature = "timezone", feature = "calendar"))]
pub mod time;
#[cfg(any(feature = "datetime", feature = "timezone"))]
pub mod timezone;
#[cfg(any(feature = "datetime", feature = "timezone"))]
pub mod timezone_mapper;
#[cfg(feature = "experimental")]
pub mod units_converter;
#[cfg(feature = "calendar")]
pub mod week;
#[cfg(feature = "datetime")]
pub mod zoned_formatter;