pub struct EnvelopeOptions { /* private fields */ }Expand description
How Mapper::to_edifact_interchange_with builds the interchange envelope.
The default is to regenerate: emit a UNA service string advice and
stamp the UNB date and time from the clock. That is right for a re-send,
and it is what Mapper::to_edifact_interchange does.
It is wrong for a caller comparing a render against its input, because the
two differences are not about the message (issue #161). Such a caller has
the original — the forward direction hands it back as Interchangedaten —
and can ask for it here.
let options = EnvelopeOptions::default()
.emit_una(false)
.datum_zeit_from(&interchange.interchangedaten);§What this cannot reproduce
Non-default delimiters. The whole render — envelope and body alike — uses
EdifactDelimiters::default, so an input whose UNA declared other
delimiters cannot be reproduced, and emit_una(true) always advertises the
defaults. Suppressing the UNA is honest about that; claiming delimiters
the body does not honour would not be.
Implementations§
Source§impl EnvelopeOptions
impl EnvelopeOptions
Sourcepub fn emit_una(self, emit: bool) -> Self
pub fn emit_una(self, emit: bool) -> Self
Whether to emit the UNA service string advice. Default true.
An input that carried no UNA gains one unless this is false.
Sourcepub fn datum_zeit(
self,
datum: impl Into<String>,
zeit: impl Into<String>,
) -> Self
pub fn datum_zeit( self, datum: impl Into<String>, zeit: impl Into<String>, ) -> Self
Interchange date (yymmdd) and time (hhmm) for UNB, instead of the
clock.
Both go into the header verbatim. A value that is not the right number
of digits is refused when the interchange is rendered — with
MapperError::MalformedEnvelopeDateTime, not silently — because UNB
is the segment whose defects surface at the receiving gateway rather
than anywhere the sender looks.
Sourcepub fn datum_zeit_from(self, daten: &Interchangedaten) -> Self
pub fn datum_zeit_from(self, daten: &Interchangedaten) -> Self
Take the UNB date and time from the Interchangedaten the forward
direction produced. Fields it does not carry are left to the clock.