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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
//! # rust_iso20022
//!
//! ISO 20022 financial message definitions and identification for Rust,
//! generated from the official ISO 20022 XSD schemas.
//!
//! The crate has three layers:
//!
//! * a small hand-written **core** ([`MxId`], [`BusinessArea`], the
//! [`from_xml`] / [`to_xml`] helpers and the [`Error`] type);
//! * a generated **message model** (`generated`) — one Rust module per
//! message version, e.g. `generated::pacs::pacs_008_001_08`, whose types
//! derive `yaserde` for XML (de)serialization; and
//! * a generated **catalogue** ([`catalogue`]) listing every message id and its
//! namespace, as static [`phf`] tables.
//!
//! ## Which API should I use?
//!
//! | Task | API | Feature |
//! |---|---|---|
//! | Identify a message from its XML namespace | [`detect`], [`MxId`] | none |
//! | Inspect arbitrary fields without generated types | [`MxNode::parse`] | none |
//! | Read AppHdr and common business metadata | [`read_business_message`] | none |
//! | Parse or build generated message types | [`from_xml`], [`to_xml`] | `model-<area>` |
//! | Serialize as JSON | `from_json`, `to_json` | `serde` |
//! | Convert amount and date strings | `convert` | `convert` |
//!
//! The first four letters of a message name select its model feature and Rust
//! module. For example, `pacs.008.001.08` uses feature `model-pacs` and type
//! `generated::pacs::pacs_008_001_08::Document`. Prefer per-area features over
//! the umbrella `model` feature, which compiles all 1,130 message modules.
//!
//! See the [model feature guide] for all 32 generated business areas, or start
//! with the repository's runnable [`inspect_message`] and [`typed_payment`]
//! examples.
//!
//! [model feature guide]: https://github.com/rust-iso/rust_iso20022/blob/main/docs/model-features.md
//! [`inspect_message`]: https://github.com/rust-iso/rust_iso20022/blob/main/examples/inspect_message.rs
//! [`typed_payment`]: https://github.com/rust-iso/rust_iso20022/blob/main/examples/typed_payment.rs
//!
//! ## Sample code
//! ```
//! use rust_iso20022::{MxId, BusinessArea};
//!
//! // Identify a message from its namespace or bare name.
//! let id = rust_iso20022::from_namespace(
//! "urn:iso:std:iso:20022:tech:xsd:pacs.008.001.08",
//! )
//! .unwrap();
//! assert_eq!(id.business_area, BusinessArea::pacs);
//! assert_eq!(id.message_name(), "pacs.008.001.08");
//!
//! // The catalogue knows every generated message.
//! assert!(rust_iso20022::catalogue::contains("pacs.008.001.08"));
//! let entry = rust_iso20022::catalogue::from_message_name("pacs.008.001.08").unwrap();
//! assert_eq!(entry.namespace, "urn:iso:std:iso:20022:tech:xsd:pacs.008.001.08");
//! ```
/// Compatibility XSD-facet validation retained for generated values.
/// Additive typed builders whose outputs are canonical generated documents.
/// Deterministic semantic comparison of schema-derived message versions.
/// Exact, source-addressed market-profile releases and dispatch.
/// Layered reports, executable rules, and explanation registry.
/// Serde-backed compatibility views used by legacy WebAssembly exports.
pub use MxNode;
/// Typed conversions for scalar values (`convert` feature).
compile_error!;
pub use crateparse_json;
pub use crate;
pub use crate;
pub use crate;
/// Parse XML into the typed message `T` only if the XML's detected message type
/// matches `T` (prowide-style guarded parse). Requires the `model` feature on
/// the caller side to name a concrete `Document` type.
///
/// ```
/// # #[cfg(feature = "model-pacs")] {
/// use rust_iso20022::generated::pacs::pacs_008_001_08::Document;
/// let xml = r#"<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pacs.008.001.08"></Document>"#;
/// // Parses because the detected type matches `Document`.
/// let _ = rust_iso20022::parse_as::<Document>(xml);
/// # }
/// ```
/// Static schema-derived message and field discovery.
/// Business Application Header (BAH / `head.001`) reading.
pub use crateapp_hdr;
/// Schema descriptors plus business metadata extraction compatibility APIs;
/// descriptors never replace the generated message model.
/// Validated scalar helpers with typed errors and generated-field conversions.
/// Financial-data redaction policy for diagnostics and adapters.
/// Runtime ISO 20022 schema fetcher (`catalogue` feature).
/// Generated ISO 20022 message types, one module per message version. Enabled
/// by any `model-<area>` feature (or `model` for all areas).
/// Parse an [`MxId`] from a full namespace, partial namespace or bare message
/// name. Returns `None` if it cannot be parsed.
///
/// ```
/// let id = rust_iso20022::from_namespace("pacs.008.001.08").unwrap();
/// assert_eq!(id.message_name(), "pacs.008.001.08");
/// assert!(rust_iso20022::from_namespace("not-a-message").is_none());
/// ```