Struct Field36

Source
pub struct Field36 {
    pub rate: f64,
    pub raw_rate: String,
}
Expand description

§Field 36: Exchange Rate

§Overview

Field 36 specifies the exchange rate to be applied between the currencies in Field 33B (Instructed Currency and Amount) and Field 32A (Value Date/Currency/Amount) in SWIFT payment messages. This field is only present when the currency codes in these two fields differ, indicating a foreign exchange transaction is required.

§Format Specification

Format: 12d

  • 12d: Up to 12 digits including decimal separator
  • Decimal separator: Comma (,) as per SWIFT convention
  • Precision: Up to 6 decimal places (trailing zeros removed)
  • Character set: Digits 0-9 and comma (,)
  • Validation: Must be positive, non-zero value

§Usage Context

Field 36 is commonly used in:

  • MT103: Single Customer Credit Transfer (when currency conversion required)
  • MT202: General Financial Institution Transfer (FX transactions)
  • MT202COV: Cover for customer credit transfer with FX
  • MT200: Financial Institution Transfer (simple FX)

§Business Applications

  • Currency conversion: Applying agreed exchange rates to international payments
  • FX transparency: Providing clear rate information to receiving institutions
  • Reconciliation: Enabling accurate settlement calculations
  • Compliance: Meeting regulatory requirements for FX rate disclosure
  • Audit trails: Maintaining records of applied exchange rates

§Examples

:36:1,2345
└─── USD/EUR rate of 1.2345 (1 USD = 1.2345 EUR)

:36:0,8765
└─── EUR/USD rate of 0.8765 (1 EUR = 0.8765 USD)

:36:110,5
└─── USD/JPY rate of 110.5 (1 USD = 110.5 JPY)

:36:1
└─── 1:1 rate (special cases, same currency family)

Fields§

§rate: f64

Exchange rate value

§raw_rate: String

Raw rate string as received (preserves original formatting)

Implementations§

Source§

impl Field36

Source

pub fn new(rate: f64) -> Result<Self, ParseError>

Create a new Field36 with validation

Source

pub fn from_raw(raw_rate: impl Into<String>) -> Result<Self, ParseError>

Create from raw rate string

Source

pub fn rate(&self) -> f64

Get the exchange rate value

Source

pub fn raw_rate(&self) -> &str

Get the raw rate string

Source

pub fn format_rate(rate: f64) -> String

Format rate for SWIFT output (preserving decimal places, using comma)

Source

pub fn is_reasonable_rate(&self) -> bool

Check if this is a reasonable exchange rate (between 0.0001 and 10000)

Source

pub fn description(&self) -> String

Get human-readable description

Trait Implementations§

Source§

impl Clone for Field36

Source§

fn clone(&self) -> Field36

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 Debug for Field36

Source§

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

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

impl<'de> Deserialize<'de> for Field36

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 Display for Field36

Source§

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

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

impl PartialEq for Field36

Source§

fn eq(&self, other: &Field36) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Field36

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
Source§

impl SwiftField for Field36

Source§

fn parse(value: &str) -> Result<Self, ParseError>

Parse field value from string representation
Source§

fn to_swift_string(&self) -> String

Convert field back to SWIFT string format
Source§

fn validate(&self) -> ValidationResult

Validate field according to SWIFT format rules
Source§

fn format_spec() -> &'static str

Get field format specification
Source§

impl StructuralPartialEq for Field36

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> 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,