Skip to main content

EdifactTokenizer

Struct EdifactTokenizer 

Source
pub struct EdifactTokenizer { /* private fields */ }
Expand description

Tokenizes raw EDIFACT byte input into segment strings.

Handles release character escaping, whitespace normalization (strips \r\n), and UNA segment detection.

Implementations§

Source§

impl EdifactTokenizer

Source

pub fn new(delimiters: EdifactDelimiters) -> Self

Creates a new tokenizer with the given delimiters.

Source

pub fn delimiters(&self) -> &EdifactDelimiters

Returns the delimiters used by this tokenizer.

Source

pub fn tokenize_segments<'a>(&self, input: &'a [u8]) -> SegmentIter<'a>

Tokenizes EDIFACT input into segment strings.

Splits on segment terminator, respecting release character escaping. Strips \r and \n characters from the input (EDIFACT uses them only for readability).

Each yielded string is a segment WITHOUT its terminator character.

Source

pub fn tokenize_elements<'a>(&self, segment: &'a str) -> ElementIter<'a>

Tokenizes a segment string into data elements.

Splits on element separator, preserving release character escaping (unescaping happens at the component level).

Source

pub fn tokenize_components<'a>(&self, element: &'a str) -> ComponentIter<'a>

Tokenizes a data element into components.

Splits on component separator and unescapes release character sequences.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.