MessageParser

Struct MessageParser 

Source
pub struct MessageParser<'a> { /* private fields */ }
Expand description

Message parser that tracks position while parsing SWIFT messages

Implementations§

Source§

impl<'a> MessageParser<'a>

Source

pub fn new(input: &'a str, message_type: &str) -> Self

Create a new message parser

Source

pub fn with_duplicates(self, allow: bool) -> Self

Enable or disable duplicate field handling

Source

pub fn parse_field<T: SwiftField>(&mut self, tag: &str) -> Result<T, ParseError>

Parse a required field

Source

pub fn parse_optional_field<T: SwiftField>( &mut self, tag: &str, ) -> Result<Option<T>, ParseError>

Parse an optional field (only checks immediate next field, not searching ahead)

Source

pub fn parse_repeated_field<T: SwiftField>( &mut self, tag: &str, ) -> Result<Vec<T>, ParseError>

Parse a repeated field (returns Vec)

Source

pub fn parse_variant_field<T: SwiftField>( &mut self, base_tag: &str, ) -> Result<T, ParseError>

Parse a field with variant detection (for enum fields)

Source

pub fn parse_optional_variant_field<T: SwiftField>( &mut self, base_tag: &str, ) -> Result<Option<T>, ParseError>

Parse an optional field with variant detection

Source

pub fn detect_variant_optional(&self, base_tag: &str) -> Option<String>

Detect variant for optional fields

Source

pub fn position(&self) -> usize

Get current position in input

Source

pub fn remaining(&self) -> &str

Get remaining unparsed content (useful for debugging)

Source

pub fn is_complete(&self) -> bool

Check if we’ve reached the end of input

Source

pub fn detect_field(&self, tag: &str) -> bool

Check if a field exists in the remaining content

Source

pub fn peek_field_variant(&self, base_tag: &str) -> Option<String>

Peek at the variant of a field without consuming it Returns the variant letter (e.g., “A”, “K”, “C”, “L”) if the field exists

Trait Implementations§

Source§

impl<'a> Debug for MessageParser<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for MessageParser<'a>

§

impl<'a> RefUnwindSafe for MessageParser<'a>

§

impl<'a> Send for MessageParser<'a>

§

impl<'a> Sync for MessageParser<'a>

§

impl<'a> Unpin for MessageParser<'a>

§

impl<'a> UnwindSafe for MessageParser<'a>

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> Fake for T

Source§

fn fake<U>(&self) -> U
where Self: FakeBase<U>,

Source§

fn fake_with_rng<U, R>(&self, rng: &mut R) -> U
where R: Rng + ?Sized, Self: FakeBase<U>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more