Derive Macro IntoRowWithPersianRug

Source
#[derive(IntoRowWithPersianRug)]
{
    // Attributes available to this derive:
    #[django]
}
Available on crate features row and persian-rug only.
Expand description

Derive the IntoRowWithContext trait for persian-rug types.

This is only implemented for structs with named fields. All fields will be included in the output by default, which means they must have types which implement IntoCellValue. The annotations for this derive macro use the django attribute, which has the following significant options here:

  • #[django(rename="new_name")] Expose the annotated member in the output `new_name instead of using its name in the source code.

  • #[django(exclude)] Do not include the annotated member in any output.

  • #[django(foreign_key="field_name")] The field has a type which is itself IntoRow. Rather than requiring the field’s type to implement IntoCellValue, instead take the value of the field from the cell called field_name in the field’s own type’s output row.

The struct itself must also be annotated with the django attribute, which gives the persian-rug constraints to apply to to each derived impl:

  • #[django(persian_rug(context=Rug))] The persian-rug context type for this type is Rug.

  • #[django(persian_rug(context=C, access(Foo<C>)))] The persian-rug context type is the template parameter C. The context must provide access to Foo<C>.