Derive Macro specta_macros::Type
source · #[derive(Type)]
{
// Attributes available to this derive:
#[specta]
#[serde]
}
Expand description
Implements Type
for a given struct or enum.
§Example
use specta::Type;
// Use it on structs
#[derive(Type)]
pub struct MyCustomStruct {
pub name: String,
}
#[derive(Type)]
pub struct MyCustomStruct2(String, i32, bool);
// Use it on enums
#[derive(Type)]
pub enum MyCustomType {
VariantOne,
VariantTwo(String, i32),
VariantThree { name: String, age: i32 },
}