Derive Macro typescript_type_def::TypeDef [−][src]
#[derive(TypeDef)]
{
// Attributes available to this derive:
#[type_def]
#[serde]
}
Expand description
A derive proc-macro for the TypeDef
trait.
This macro can be used on struct
s and enum
s which also derive
serde::Serialize
and/or
serde::Deserialize
,
and will generate a TypeDef
implementation which matches the shape
of the JSON produced by using serde_json
on
the target type. This macro will also read and adapt to #[serde(...)]
attributes on the target type’s definition.
This macro also reads the following attributes:
#[type_def(namespace = "x.y.z")]
on thestruct
/enum
body puts the TypeScript type definition under a namespace ofx.y.z
. Note thatwrite_definition_file
will additionally place all type definitions under a root namespace.
serde
attribute support
Legend:
- ✓ - full support
- ? - may support in the future
- ✗ - will not support