pub trait CsvField: Sized {
// Required methods
fn encode_field(&self) -> String;
fn decode_field(input: &str) -> Result<Self, CsvDecodeError>;
}Expand description
A scalar value that maps to and from a single CSV field.
Encoding never fails — every supported value has a text form. Decoding is strict: the field text must parse exactly into the target type.
Implemented for the integer types, bool ("true"/"false"), String,
and Option<T> (an empty field decodes to None).
Required Methods§
Sourcefn encode_field(&self) -> String
fn encode_field(&self) -> String
Encodes self into a field value.
Sourcefn decode_field(input: &str) -> Result<Self, CsvDecodeError>
fn decode_field(input: &str) -> Result<Self, CsvDecodeError>
Decodes a field value into Self, or returns a CsvDecodeError.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".