pub struct EdifactDelimiters {
pub component: u8,
pub element: u8,
pub decimal: u8,
pub release: u8,
pub segment: u8,
pub reserved: u8,
}Expand description
EDIFACT delimiter characters.
The six characters that control EDIFACT message structure. When no UNA service string advice is present, the standard defaults apply:
- Component separator:
:(colon) - Element separator:
+(plus) - Decimal mark:
.(period) - Release character:
?(question mark) - Segment terminator:
'(apostrophe) - Reserved:
(space)
Fields§
§component: u8Component data element separator (default: :).
element: u8Data element separator (default: +).
decimal: u8Decimal mark (default: .).
release: u8Release character / escape (default: ?).
segment: u8Segment terminator (default: ').
reserved: u8Reserved for future use (default: ).
Implementations§
Source§impl EdifactDelimiters
impl EdifactDelimiters
Sourcepub fn from_una(una: &[u8]) -> Result<Self, UnaParseError>
pub fn from_una(una: &[u8]) -> Result<Self, UnaParseError>
Parse delimiters from a UNA service string advice segment.
The UNA segment is exactly 9 bytes: UNA followed by 6 delimiter characters.
Format: UNA<component><element><decimal><release><reserved><terminator>
§Errors
Returns an error if the input is not exactly 9 bytes or does not start with UNA.
Sourcepub fn detect(input: &[u8]) -> (bool, Self)
pub fn detect(input: &[u8]) -> (bool, Self)
Detect delimiters from an EDIFACT message.
If the message starts with a UNA segment, parses delimiters from it. Otherwise, returns the standard defaults.
Returns (has_una, delimiters).
Sourcepub fn to_una_string(&self) -> String
pub fn to_una_string(&self) -> String
Formats the delimiters as a UNA service string advice segment.
Returns the 9-byte UNA string: UNA:+.? '
Trait Implementations§
Source§impl Clone for EdifactDelimiters
impl Clone for EdifactDelimiters
Source§fn clone(&self) -> EdifactDelimiters
fn clone(&self) -> EdifactDelimiters
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more