#[derive(Flat)]
{
// Attributes available to this derive:
#[flat]
}
Expand description
Derive Flat and Emit for region-based storage.
Generates implementations for both the Flat marker trait and the Emit
builder trait, enabling declarative region construction.
§Field attributes
§#[flat(into)]
On a primitive or Other-classified field, the generated make() builder
accepts impl Into<T> instead of T. This allows callers to pass values
that can be cheaply converted.
ⓘ
#[derive(Flat)]
struct Inst {
#[flat(into)]
op: u16,
typ: Type,
}
// Now `op` accepts any `impl Into<u16>`:
Inst::make(42u8, Type(0))§Variant attributes
§#[flat(rename = "name")]
On an enum variant, overrides the generated make_* method name.
ⓘ
#[derive(Flat)]
#[repr(C, u8)]
enum Term {
#[flat(rename = "ret")]
Return { values: NearList<Value> },
Jmp(Jmp),
}
// Instead of `Term::make_return(...)`:
Term::ret(...)