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
//! # 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.
//!
//! ## 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");
//! ```
pub use MxNode;
/// Typed conversions for scalar values (`convert` feature).
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);
/// # }
/// ```
/// Business Application Header (BAH / `head.001`) reading.
pub use crateapp_hdr;
/// Business metadata extraction from a message (sender/amount/currency/dates).
pub use cratemetadata;
/// 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());
/// ```