pub trait ModelSerializer: Serialize + Sized {
type Model: Model;
type Input;
// Required method
fn from_input(input: Self::Input) -> Self;
// Provided methods
fn to_json(input: Self::Input) -> Result<Value, Error> { ... }
fn fields() -> &'static [SerializerField] { ... }
}Expand description
Converts a materialized ORM model into an API representation.
Required Associated Types§
Required Methods§
fn from_input(input: Self::Input) -> Self
Provided Methods§
fn to_json(input: Self::Input) -> Result<Value, Error>
fn fields() -> &'static [SerializerField]
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".