#[derive(Options)]
{
// Attributes available to this derive:
#[option]
}
Expand description
Derive Options for a unit-variant enum: the (value, label) list a
choice field, a select filter and a column share.
#[derive(Debug, Clone, Copy, PartialEq, Eq, tablo_core::Options)]
pub enum Status {
Draft,
#[option(label = "Live")]
Published,
}
assert_eq!(Status::Published.value(), "published");
assert_eq!(Status::Published.label(), "Live");
assert_eq!(Status::from_value("draft"), Some(Status::Draft));Each variant stores its snake_case name and reads as that name in
sentence case. #[option(value = "..")] and #[option(label = "..")]
override either. A generic enum, a variant with fields, two variants
storing one value, and an unknown key are compile errors.
Derive Options for a unit-variant enum; documented on the tablo-core re-export.