carrier_core/lib.rs
1//! # carrier-core — what the German carrier interfaces share
2//!
3//! WBCI (provider ↔ provider) and S/PRI (network owner ↔ service provider) are separate
4//! interfaces of the AK S&P, but they carry the same identifiers, count the same working days,
5//! wrap their payloads in the same kind of envelope and must read the same hostile XML safely.
6//! This crate holds that common ground, so a fix in one interface is a fix in both:
7//!
8//! | Module | What |
9//! |---|---|
10//! | [`text`] | schema facets, [`ValueError`], the [`text_type!`] and [`code_enum!`] macros |
11//! | [`id`] | [`CarrierCode`], [`VorabstimmungsId`], [`LineId`] |
12//! | [`calendar`] | working days: weekends, nationwide public holidays, closed days |
13//! | [`count`] | working-day and working-hour arithmetic with an [`count::Explanation`] |
14//! | [`envelope`] | [`Zeitstempel`], [`SignaturId`], [`SignaturText`] |
15//! | [`xml`] | the bounded tree parser, the schema-order cursor and the writer |
16//! | [`sim`] | [`sim::Latency`] of the simulated peers |
17//!
18//! Its API serves the sibling crates `wbci` and `spri`, which re-export what their users need;
19//! it is not stable on its own.
20//!
21//! ```
22//! use carrier_core::{CarrierCode, VorabstimmungsId};
23//!
24//! let carrier: CarrierCode = "DEU.EKP1".parse()?;
25//! let id = VorabstimmungsId::allocate(&carrier, 13)?;
26//! assert_eq!(id.as_str(), "DEU.EKP1.V000000013");
27//! # Ok::<(), carrier_core::ValueError>(())
28//! ```
29//!
30//! Unofficial; not affiliated with or endorsed by the AK S&P, VATM or BUGLAS.
31
32pub mod calendar;
33pub mod count;
34pub mod envelope;
35pub mod id;
36pub mod sim;
37pub mod text;
38pub mod xml;
39
40pub use calendar::Calendar;
41pub use envelope::{SignaturId, SignaturText, Zeitstempel};
42pub use id::{CarrierCode, LineId, MAX_SEQUENCE, VorabstimmungsId};
43pub use text::{ValueError, ValueErrorKind};