Skip to main content

Crate carrier_core

Crate carrier_core 

Source
Expand description

§carrier-core — what the German carrier interfaces share

WBCI (provider ↔ provider) and S/PRI (network owner ↔ service provider) are separate interfaces of the AK S&P, but they carry the same identifiers, count the same working days, wrap their payloads in the same kind of envelope and must read the same hostile XML safely. This crate holds that common ground, so a fix in one interface is a fix in both:

ModuleWhat
textschema facets, ValueError, the text_type! and code_enum! macros
idCarrierCode, VorabstimmungsId, LineId
calendarworking days: weekends, nationwide public holidays, closed days
countworking-day and working-hour arithmetic with an count::Explanation
envelopeZeitstempel, SignaturId, SignaturText
xmlthe bounded tree parser, the schema-order cursor and the writer
simsim::Latency of the simulated peers

Its API serves the sibling crates wbci and spri, which re-export what their users need; it is not stable on its own.

use carrier_core::{CarrierCode, VorabstimmungsId};

let carrier: CarrierCode = "DEU.EKP1".parse()?;
let id = VorabstimmungsId::allocate(&carrier, 13)?;
assert_eq!(id.as_str(), "DEU.EKP1.V000000013");

Unofficial; not affiliated with or endorsed by the AK S&P, VATM or BUGLAS.

Re-exports§

pub use calendar::Calendar;
pub use envelope::SignaturId;
pub use envelope::SignaturText;
pub use envelope::Zeitstempel;
pub use id::CarrierCode;
pub use id::LineId;
pub use id::MAX_SEQUENCE;
pub use id::VorabstimmungsId;
pub use text::ValueError;
pub use text::ValueErrorKind;

Modules§

calendar
Working days (Arbeitstage, AT).
count
Counting working days and working hours, with the arithmetic kept for the reader.
envelope
Envelope values every payload carries: the send timestamp and the signing certificate.
id
Identifiers both WBCI and S/PRI carry: carrier codes, the Vorabstimmungs-ID and the LineID.
sim
What the simulated peers of both interfaces share: how long they take to answer.
text
Lexical facets of the carrier schemas: the permitted character set, whitespace handling and lengths, and the macros that turn them into newtypes and code enumerations.
xml
The hardened XML foundation: a bounded tree parser, a cursor that walks an element’s children in schema order, and an indenting writer.

Macros§

code_enum
Declares a Copy enum of schema codes with as_str, from_code and Display.
request_id
Declares a WBCI request id CC.ICC.<letter>[0-9A-Z]{9} with allocate and carrier.
text_type
Declares a newtype over String with a TextSpec.