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
//! `mf2-runtime` — the MessageFormat 2 evaluator of Rust MF2: it formats a message **from a catalog**, walking
//! `mf2-catalog`'s views in place — resolution, declarations (lazily, each at
//! most once), selection, fallback, the Default Bidi Strategy, format to
//! parts, markup, the `u:` options — and it holds the function registry, the
//! custom-function API and the core functions: `:string`, and `:number`,
//! `:integer`, `:offset` with their complete semantics and neutral symbols.
//!
//! | Item | What |
//! |---|---|
//! | [`Formatter`] | the entry point: `simple`, `write`, `parts`, `*_named` |
//! | [`Sink`], [`PartSink`], [`ErrorSink`] | where output and errors go |
//! | [`Arg`], [`Value`], [`Number`] | arguments and resolved values |
//! | [`Function`], [`Registry`], [`functions`] | handlers; a registry names only the handlers its corpus uses, and no other is linked |
//! | [`Host`] | NFC, float text, zone offsets, a date formatter, a number formatter (`intl`) from the platform |
//! | [`DateTime`], [`TimeZone`], [`NumberSpec`], [`Digits`], [`Measure`] | what the function crates and custom functions build on |
//!
//! Client-path code: `no_std` + `alloc`, `forbid(unsafe_code)`, no
//! `core::fmt`, no panicking operation; built-in handlers never allocate.
//!
//! # The user guide
//!
//! The [Rust MF2 book](https://evancarroll.github.io/rust-mf2/) is the user
//! guide: how the crates fit together, web and native applications, the
//! command line, and what 2.x promises.
//! An application reaches this crate through
//! [`mf2`](https://docs.rs/mf2), which re-exports it; a custom function is
//! written against [`Function`].
// docs.rs (`cargo xtask docs-rs`): each feature-gated item says which features it needs.
extern crate alloc;
pub use StrRef;
pub use ;
pub use MarkupKind;
pub use ;
pub use FormatError;
pub use ;
pub use ;
pub use ;
/// Canonical equivalence with a catalog key from the catalog's map, for the
/// differential fuzz target (`fuzz/fuzz_targets/nfc.rs`) and the
/// conformance crate's differential test, both of which check it against
/// full NFC. Applications use [`FnContext::equivalent`].
pub use equivalent as nfc_equivalent;
pub use ;
pub use ;
pub use select as plural_category;
pub use ;
pub use ;
pub use ;
/// Whether numbers format through the host:
/// feature `web-number-intl` without `web-number-builtin`, on
/// `wasm32-unknown-unknown` only. The numeric
/// functions — the core's and `mf2-fn-number`'s — then take the display,
/// `:integer`'s rounding and the plural category from
/// the host's [`NumberFormatter`] ([`Host::numbers`]: the browser's
/// `Intl.NumberFormat` and `Intl.PluralRules`) instead of the Rust digit
/// plan, rounding and plural evaluator, which are not linked. Everywhere
/// else — servers, `wasm32-wasip1`, native tests, and a browser with
/// `web-number-builtin` — `false`: the Rust path.
pub const INTL_NUMBERS: bool = cfg!;
// The backend the numeric functions were compiled over is the one the
// constant states: the two are chosen by the same condition, written twice.
const _: = assert!;
// With both of a browser's number features on, this crate's own code
// formats: the stronger of the two, whichever crate asked for the other.
const _: = assert!;