pub trait SwiftField:
Serialize
+ for<'de> Deserialize<'de>
+ Clone
+ Debug {
// Required methods
fn parse(value: &str) -> Result<Self>
where Self: Sized;
fn to_swift_string(&self) -> String;
fn validate(&self) -> ValidationResult;
fn format_spec() -> &'static str;
}
Expand description
Core trait for all Swift field types
Required Methods§
Sourcefn parse(value: &str) -> Result<Self>where
Self: Sized,
fn parse(value: &str) -> Result<Self>where
Self: Sized,
Parse field value from string representation
Sourcefn to_swift_string(&self) -> String
fn to_swift_string(&self) -> String
Convert field back to SWIFT string format
Sourcefn validate(&self) -> ValidationResult
fn validate(&self) -> ValidationResult
Validate field according to SWIFT format rules
Sourcefn format_spec() -> &'static str
fn format_spec() -> &'static str
Get field format specification
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.