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§
Required Methods§
Sourcefn to_swift_string(&self) -> String
fn to_swift_string(&self) -> String
Serialize field back to SWIFT format
Sourcefn validate(&self, rules: &FormatRules) -> Result<(), ValidationError>
fn validate(&self, rules: &FormatRules) -> Result<(), ValidationError>
Validate field content according to SWIFT rules
Sourcefn description() -> &'static str
fn description() -> &'static str
Get field description for documentation/debugging
Provided Methods§
Sourcefn is_mandatory_for_message_type(message_type: &str) -> bool
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.