Attribute Macro persian_rug_derive::persian_rug
source ยท #[persian_rug]
Expand description
Convert an annotated struct into a Context
Each field marked with #[table]
will be converted to be a
Table
of values of the same type. An implementation of Context
will be provided. In addition, an implementation of Owner
for
each field type will be derived for the overall struct.
Note that a Context
can only contain one table of each type.
Example:
use persian_rug::{contextual, persian_rug, Proxy};
#[contextual(MyRug)]
struct Foo {
a: i32
}
#[contextual(MyRug)]
struct Bar {
a: i32,
b: Proxy<Foo>
};
#[persian_rug]
struct MyRug(#[table] Foo, #[table] Bar);