Struct SwiftMessage

Source
pub struct SwiftMessage<T: SwiftMessageBody> {
    pub basic_header: BasicHeader,
    pub application_header: ApplicationHeader,
    pub user_header: Option<UserHeader>,
    pub trailer: Option<Trailer>,
    pub message_type: String,
    pub fields: T,
}
Expand description

Complete SWIFT message with headers and body

Fields§

§basic_header: BasicHeader

Basic Header (Block 1)

§application_header: ApplicationHeader

Application Header (Block 2)

§user_header: Option<UserHeader>

User Header (Block 3) - Optional

§trailer: Option<Trailer>

Trailer (Block 5) - Optional

§message_type: String

Message type identifier

§fields: T

Parsed message body with typed fields

Implementations§

Source§

impl<T: SwiftMessageBody> SwiftMessage<T>

Source

pub fn has_reject_codes(&self) -> bool

Check if this message contains reject codes (MT103 specific)

Reject messages are identified by checking:

  1. Field 20 (Sender’s Reference) for “REJT” prefix
  2. Block 3 field 108 (MUR - Message User Reference) for “REJT”
  3. Field 72 (Sender to Receiver Information) containing /REJT/ code
Source

pub fn has_return_codes(&self) -> bool

Check if this message contains return codes (MT103 specific)

Return messages are identified by checking:

  1. Field 20 (Sender’s Reference) for “RETN” prefix
  2. Block 3 field 108 (MUR - Message User Reference) for “RETN”
  3. Field 72 (Sender to Receiver Information) containing /RETN/ code
Source

pub fn is_cover_message(&self) -> bool

Source

pub fn is_stp_message(&self) -> bool

Source

pub fn validate_business_rules(&self) -> ValidationResult

Validate message against business rules using JSONLogic This validation method has access to both headers and message fields, allowing for comprehensive validation of MT103 and other message types.

Source

pub fn to_mt_message(&self) -> String

Source

pub fn sample() -> Self

Generate a sample SWIFT message with headers and message body Returns a complete message with all blocks including sample headers

Source

pub fn sample_minimal() -> Self

Generate a minimal sample SWIFT message (mandatory fields only) Returns a complete message with headers and minimal field set

Source

pub fn sample_full() -> Self

Generate a full sample SWIFT message (all fields populated) Returns a complete message with headers and all possible fields

Source

pub fn sample_with_config(config: &MessageConfig) -> Self

Generate a sample SWIFT message with custom configuration Returns a complete message with headers and configurable field generation

Trait Implementations§

Source§

impl<T: Clone + SwiftMessageBody> Clone for SwiftMessage<T>

Source§

fn clone(&self) -> SwiftMessage<T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug + SwiftMessageBody> Debug for SwiftMessage<T>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'de, T> Deserialize<'de> for SwiftMessage<T>
where T: Deserialize<'de> + SwiftMessageBody,

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<T> Serialize for SwiftMessage<T>

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl<T> Freeze for SwiftMessage<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for SwiftMessage<T>
where T: RefUnwindSafe,

§

impl<T> Send for SwiftMessage<T>

§

impl<T> Sync for SwiftMessage<T>

§

impl<T> Unpin for SwiftMessage<T>
where T: Unpin,

§

impl<T> UnwindSafe for SwiftMessage<T>
where T: UnwindSafe,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,