Trait SwiftField

Source
pub trait SwiftField:
    Clone
    + Debug
    + Serialize
    + for<'de> Deserialize<'de> {
    const TAG: &'static str;

    // Required methods
    fn parse(content: &str) -> Result<Self>
       where Self: Sized;
    fn to_swift_string(&self) -> String;
    fn validate(&self, rules: &FormatRules) -> Result<(), ValidationError>;
    fn description() -> &'static str;

    // Provided methods
    fn tag(&self) -> &'static str { ... }
    fn options() -> Vec<&'static str> { ... }
    fn is_mandatory_for_message_type(message_type: &str) -> bool { ... }
}
Expand description

Generic trait that all SWIFT fields must implement

Required Associated Constants§

Source

const TAG: &'static str

The field tag (e.g., “20”, “50A”, “50K”)

Required Methods§

Source

fn parse(content: &str) -> Result<Self>
where Self: Sized,

Parse field content from raw string

Source

fn to_swift_string(&self) -> String

Serialize field back to SWIFT format

Source

fn validate(&self, rules: &FormatRules) -> Result<(), ValidationError>

Validate field content according to SWIFT rules

Source

fn description() -> &'static str

Get field description for documentation/debugging

Provided Methods§

Source

fn tag(&self) -> &'static str

Get field tag at runtime

Source

fn options() -> Vec<&'static str>

Get field options if any (e.g., “A”, “K”, “F” for field 50)

Source

fn is_mandatory_for_message_type(message_type: &str) -> bool

Check if field is mandatory for a specific message type

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl SwiftField for swift_mt_message::mt_models::fields::beneficiary::Field59

Source§

const TAG: &'static str = "59"

Source§

impl SwiftField for Field52

Source§

const TAG: &'static str = "52"

Source§

impl SwiftField for Field53

Source§

const TAG: &'static str = "53"

Source§

impl SwiftField for Field54

Source§

const TAG: &'static str = "54"

Source§

impl SwiftField for Field55

Source§

const TAG: &'static str = "55"

Source§

impl SwiftField for Field56

Source§

const TAG: &'static str = "56"

Source§

impl SwiftField for Field57

Source§

const TAG: &'static str = "57"

Source§

impl SwiftField for Field50

Source§

const TAG: &'static str = "50"

Source§

impl SwiftField for swift_mt_message::mt_models::fields::beneficiary::field_59::Field59

Source§

const TAG: &'static str = "59"

Source§

impl SwiftField for Field59A

Source§

const TAG: &'static str = "59A"

Source§

impl SwiftField for Field71A

Source§

const TAG: &'static str = "71A"

Source§

impl SwiftField for Field71F

Source§

const TAG: &'static str = "71F"

Source§

impl SwiftField for Field71G

Source§

const TAG: &'static str = "71G"

Source§

impl SwiftField for Field13C

Source§

const TAG: &'static str = "13C"

Source§

impl SwiftField for Field20

Source§

const TAG: &'static str = "20"

Source§

impl SwiftField for Field23B

Source§

const TAG: &'static str = "23B"

Source§

impl SwiftField for Field23E

Source§

const TAG: &'static str = "23E"

Source§

impl SwiftField for Field26T

Source§

const TAG: &'static str = "26T"

Source§

impl SwiftField for Field32A

Source§

const TAG: &'static str = "32A"

Source§

impl SwiftField for Field33B

Source§

const TAG: &'static str = "33B"

Source§

impl SwiftField for Field36

Source§

const TAG: &'static str = "36"

Source§

impl SwiftField for Field70

Source§

const TAG: &'static str = "70"

Source§

impl SwiftField for Field72

Source§

const TAG: &'static str = "72"

Source§

impl SwiftField for Field77B

Source§

const TAG: &'static str = "77B"

Source§

impl SwiftField for Field51A

Source§

const TAG: &'static str = "51A"

Source§

impl SwiftField for Field52A

Source§

const TAG: &'static str = "52A"

Source§

impl SwiftField for Field52D

Source§

const TAG: &'static str = "52D"

Source§

impl SwiftField for Field53A

Source§

const TAG: &'static str = "53A"

Source§

impl SwiftField for Field53B

Source§

const TAG: &'static str = "53B"

Source§

impl SwiftField for Field53D

Source§

const TAG: &'static str = "53D"

Source§

impl SwiftField for Field54A

Source§

const TAG: &'static str = "54A"

Source§

impl SwiftField for Field54B

Source§

const TAG: &'static str = "54B"

Source§

impl SwiftField for Field54D

Source§

const TAG: &'static str = "54D"

Source§

impl SwiftField for Field55A

Source§

const TAG: &'static str = "55A"

Source§

impl SwiftField for Field55B

Source§

const TAG: &'static str = "55B"

Source§

impl SwiftField for Field55D

Source§

const TAG: &'static str = "55D"

Source§

impl SwiftField for Field56A

Source§

const TAG: &'static str = "56A"

Source§

impl SwiftField for Field56C

Source§

const TAG: &'static str = "56C"

Source§

impl SwiftField for Field56D

Source§

const TAG: &'static str = "56D"

Source§

impl SwiftField for Field57A

Source§

const TAG: &'static str = "57A"

Source§

impl SwiftField for Field57B

Source§

const TAG: &'static str = "57B"

Source§

impl SwiftField for Field57C

Source§

const TAG: &'static str = "57C"

Source§

impl SwiftField for Field57D

Source§

const TAG: &'static str = "57D"

Source§

impl SwiftField for Field50A

Source§

const TAG: &'static str = "50A"

Source§

impl SwiftField for Field50F

Source§

const TAG: &'static str = "50F"

Source§

impl SwiftField for Field50K

Source§

const TAG: &'static str = "50K"