#[derive(DecodeScalar)]
{
// Attributes available to this derive:
#[knuffel]
}
Expand description
Currently DecodeScalar derive is only implemented for enums
ยงEnums
Only enums that contain no data are supported:
#[derive(knuffel::DecodeScalar)]
enum Color {
Red,
Blue,
Green,
InfraRed,
}This will match scalar values in kebab-case. For example, this node decoder:
#[derive(knuffel::Decode)]
struct Document {
#[knuffel(child, unwrap(arguments))]
all_colors: Vec<Color>,
}Can be populated from the following text:
all-colors "red" "blue" "green" "infra-red"