Why this fires¶
A namespaced derive attribute does not match the option schema declared by its
@derive_for: the option may be unknown, duplicated, missing, non-literal, or
have the wrong type. Typed attributes accept named arguments only.
struct DbFieldOpts { primary: bool = false }
@derive_for(DbTable, namespace: db, field_attrs: DbFieldOpts)
fn derive_db_table(info) -> Syntax<.Items> {
return quote items { impl ${info.ref} {} }
}
struct Account {
@db(primary: "yes") // TE217: expected bool
id: int,
}Fix it¶
Use completion inside @db(...) to select a schema field, then pass a
compile-time literal of the declared type.