You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: components/segmenter/src/lib.rs
+13
Original file line number
Diff line number
Diff line change
@@ -106,6 +106,19 @@
106
106
//! ```
107
107
//!
108
108
//! See [`SentenceSegmenter`] for more examples.
109
+
//!
110
+
//! # `#![no_std]` support
111
+
//!
112
+
//! Like all of ICU4X, this module is `#![no_std]` by default. However, the LSTM segmenters (enabled
113
+
//! with features `default`, `auto` or `lstm`) require `f32::exp` and `f32::tanh`, which are currently
114
+
//! not included in `core`[^1]. Building without `std` will instead use `math.h`'s `expf` and `tanhf`
115
+
//! functions, which need to be linked. There are two ways to do this:
116
+
//! * If your target has a `libm` implementation, you can link with `-lm` to use native implementations.
117
+
//! * If your target does not have a `libm` implementation, you can use the [`compiler_builtins`](https://github.com/rust-lang/compiler-builtins/tree/master)
118
+
//! crate to provide the implementations. Keep in mind that these will usually perform worse than a
119
+
//! native `libm`.
120
+
//!
121
+
//! [^1]: See [rust-lang/rfcs#2505](https://github.com/rust-lang/rfcs/issues/2505)
0 commit comments