Trait ParseAndFormat

Source
pub trait ParseAndFormat<T> {
    // Required methods
    fn parse(value: &str) -> Result<T, ParseError>;
    fn format(value: &T) -> String;
}
Expand description

Trait used to tie strongly typed models into form inputs. Libraries must define their own form inputs (although macros are provided to make this easy), and then implement ParseAndFormat for their input for all supported types. In other words, impl ParseAndFormat<MyType> for MyTextInput<MyType>.

Required Methods§

Source

fn parse(value: &str) -> Result<T, ParseError>

Source

fn format(value: &T) -> String

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.

Implementors§