[−][src]Attribute Macro meilimelo_macros::schema
#[schema]
Macro to mark a struct as a schema to be used with meilimelo
Right now, this macro only adds the same struct as child struct in a new
_formatted
field. MeiliSearch uses this field to provide augmented data
in the results (highlights, crops, etc.).
Example
use meilimelo::prelude::*; #[meilimelo::schema] struct Employee { firstname: String, lastname: String }
The above struct renders as follows:
ⓘThis example is not tested
#[derive(Debug, Default, Serialize, Deserialize)] struct FormattedEmployee { firstname: String, lastname: String } #[derive(Debug, Default, Serialize, Deserialize)] struct Employee { firstname: String, lastname: String, #[serde(rename = "_formatted")] formatted: FormattedEmployee }