Skip to main content

Crate rok_search_macros

Crate rok_search_macros 

Source
Expand description

Proc-macro crate for rok-orm search abstraction.

Provides #[derive(Searchable)] which generates an impl rok_orm::search::Searchable for any struct, reading #[searchable(rank = N)] field attributes.

This crate is re-exported by rok-orm when features = ["search", "search-macros"].

§Example

#[derive(serde::Serialize, serde::Deserialize, Searchable)]
#[searchable(index = "posts")]
pub struct Post {
    pub id: i64,
    #[searchable(rank = 10)]
    pub title: String,
    #[searchable(rank = 5)]
    pub body: String,
    pub published: bool,
}

Derive Macros§

Searchable
Derive macro that implements rok_orm::search::Searchable for a struct.