Skip to main content

Crate hyperdb_api_derive

Crate hyperdb_api_derive 

Source
Expand description

Procedural macros for hyperdb-api.

Currently exposes #[derive(FromRow)], which generates an hyperdb_api::FromRow impl for a struct by mapping each field to a column with the matching name.

Re-exported by hyperdb-api so callers don’t need to add this crate as a direct dependency. Use it as use hyperdb_api::FromRow; and #[derive(FromRow)] on a struct.

§Example

use hyperdb_api::FromRow;

#[derive(FromRow)]
struct User {
    id: i32,
    name: String,
    // Map to a different column name with `rename`:
    #[hyperdb(rename = "email_address")]
    email: Option<String>,
}

§Attributes

Derive Macros§

FromRow
Derives hyperdb_api::FromRow for a struct.