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;
fn sample() -> Self
where Self: Sized;
fn sample_with_config(config: &FieldConfig) -> Self
where Self: Sized;
}
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
Sourcefn sample_with_config(config: &FieldConfig) -> Selfwhere
Self: Sized,
fn sample_with_config(config: &FieldConfig) -> Selfwhere
Self: Sized,
Generate a random sample with configuration
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.