#[derive(Type)]
{
// Attributes available to this derive:
#[specta]
#[serde]
}
Available on crate feature
derive
only.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 },
}