#[derive(IntoRowWithPersianRug)]
{
// Attributes available to this derive:
#[django]
}
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 itselfIntoRow
. Rather than requiring the field’s type to implementIntoCellValue
, instead take the value of the field from the cell calledfield_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 isRug
. -
#[django(persian_rug(context=C, access(Foo<C>)))]
The persian-rug context type is the template parameterC
. The context must provide access toFoo<C>
.