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
impl Field36
Sourcepub fn new(rate: f64) -> Result<Self, ParseError>
pub fn new(rate: f64) -> Result<Self, ParseError>
Create a new Field36 with validation
Sourcepub fn from_raw(raw_rate: impl Into<String>) -> Result<Self, ParseError>
pub fn from_raw(raw_rate: impl Into<String>) -> Result<Self, ParseError>
Create from raw rate string
Sourcepub fn format_rate(rate: f64) -> String
pub fn format_rate(rate: f64) -> String
Format rate for SWIFT output (preserving decimal places, using comma)
Sourcepub fn is_reasonable_rate(&self) -> bool
pub fn is_reasonable_rate(&self) -> bool
Check if this is a reasonable exchange rate (between 0.0001 and 10000)
Sourcepub fn description(&self) -> String
pub fn description(&self) -> String
Get human-readable description
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Field36
impl<'de> Deserialize<'de> for Field36
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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 SwiftField for Field36
impl SwiftField for Field36
Source§fn parse(value: &str) -> Result<Self, ParseError>
fn parse(value: &str) -> Result<Self, ParseError>
Parse field value from string representation
Source§fn to_swift_string(&self) -> String
fn to_swift_string(&self) -> String
Convert field back to SWIFT string format
Source§fn validate(&self) -> ValidationResult
fn validate(&self) -> ValidationResult
Validate field according to SWIFT format rules
Source§fn format_spec() -> &'static str
fn format_spec() -> &'static str
Get field format specification
impl StructuralPartialEq for Field36
Auto Trait Implementations§
impl Freeze for Field36
impl RefUnwindSafe for Field36
impl Send for Field36
impl Sync for Field36
impl Unpin for Field36
impl UnwindSafe for Field36
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more