Derive Macro typescript_type_def::TypeDef 
source · #[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 structs and enums 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 the struct/enum body puts the TypeScript type definition under a namespace of- x.y.z. Note that- write_definition_filewill additionally place all type definitions under a root namespace.
- #[type_def(type_of = "T")]on a struct or tuple field will use the Rust type- T’s TypeScript definition instead of the field’s type.- Tmust be a valid Rust type which implements- TypeDefand whose JSON format matches the JSON format of the field’s type. This attribute can be used to specify the type definition for a foreign type using your own type.
serde attribute support
Legend:
- ✓ - full support
- ? - may support in the future
- ✗ - will not support