pub trait ToStructMappingFieldwhere
    Self: Sized,
{ fn sm_mutator(key: &str, value: &str) -> Result<Self, MutatorError>; }
Expand description

The public trait ToStructMappingField allows to implement a new type serialization

Example

impl ToStructMappingField for bool {
#[inline]
fn sm_mutator(key: &str, value: &str) -> Result<Self, MutatorError> {
    value
        .parse::<bool>()
        .map_err(|err| MutatorError::InvalidValue {
            key: key.to_string(),
            error: err.to_string(),
        })
}

Required Methods

Method to convert a &str into a Self value for serialization

Implementations on Foreign Types

Implementors