use std::str::FromStr;
#[derive(Clone, Copy, PartialEq, Debug, Hash, Eq)]
pub enum AttributeName {
Width,
Height,
MinWidth,
MinHeight,
MaxWidth,
MaxHeight,
Padding,
Background,
Border,
BorderAlign,
Direction,
Shadow,
CornerRadius,
CornerSmoothing,
Color,
FontSize,
FontFamily,
FontStyle,
FontWeight,
FontWidth,
MainAlign,
CrossAlign,
TextAlign,
TextShadow,
MaxLines,
LineHeight,
LetterSpacing,
WordSpacing,
Decoration,
DecorationColor,
DecorationStyle,
TextOverflow,
Rotate,
Overflow,
Margin,
Position,
PositionTop,
PositionRight,
PositionBottom,
PositionLeft,
Opacity,
Content,
Name,
Focusable,
Role,
FocusId,
Alt,
CanvasReference,
Layer,
OffsetY,
OffsetX,
Reference,
CursorReference,
CursorIndex,
CursorColor,
CursorMode,
CursorId,
Highlights,
HighlightColor,
HighlightMode,
ImageReference,
ImageData,
SvgData,
SvgContent,
Spacing,
}
impl FromStr for AttributeName {
type Err = String;
fn from_str(attr: &str) -> Result<Self, Self::Err> {
match attr {
"width" => Ok(AttributeName::Width),
"height" => Ok(AttributeName::Height),
"min_width" => Ok(AttributeName::MinWidth),
"min_height" => Ok(AttributeName::MinHeight),
"max_width" => Ok(AttributeName::MaxWidth),
"max_height" => Ok(AttributeName::MaxHeight),
"padding" => Ok(AttributeName::Padding),
"background" => Ok(AttributeName::Background),
"border" => Ok(AttributeName::Border),
"border_align" => Ok(AttributeName::BorderAlign),
"direction" => Ok(AttributeName::Direction),
"shadow" => Ok(AttributeName::Shadow),
"corner_radius" => Ok(AttributeName::CornerRadius),
"corner_smoothing" => Ok(AttributeName::CornerSmoothing),
"color" => Ok(AttributeName::Color),
"font_size" => Ok(AttributeName::FontSize),
"font_family" => Ok(AttributeName::FontFamily),
"font_style" => Ok(AttributeName::FontStyle),
"font_weight" => Ok(AttributeName::FontWeight),
"font_width" => Ok(AttributeName::FontWidth),
"main_align" => Ok(AttributeName::MainAlign),
"cross_align" => Ok(AttributeName::CrossAlign),
"text_align" => Ok(AttributeName::TextAlign),
"text_shadow" => Ok(AttributeName::TextShadow),
"max_lines" => Ok(AttributeName::MaxLines),
"line_height" => Ok(AttributeName::LineHeight),
"letter_spacing" => Ok(AttributeName::LetterSpacing),
"word_spacing" => Ok(AttributeName::WordSpacing),
"decoration" => Ok(AttributeName::Decoration),
"decoration_color" => Ok(AttributeName::DecorationColor),
"decoration_style" => Ok(AttributeName::DecorationStyle),
"text_overflow" => Ok(AttributeName::TextOverflow),
"rotate" => Ok(AttributeName::Rotate),
"overflow" => Ok(AttributeName::Overflow),
"margin" => Ok(AttributeName::Margin),
"position" => Ok(AttributeName::Position),
"position_top" => Ok(AttributeName::PositionTop),
"position_right" => Ok(AttributeName::PositionRight),
"position_bottom" => Ok(AttributeName::PositionBottom),
"position_left" => Ok(AttributeName::PositionLeft),
"opacity" => Ok(AttributeName::Opacity),
"content" => Ok(AttributeName::Content),
"name" => Ok(AttributeName::Name),
"focusable" => Ok(AttributeName::Focusable),
"role" => Ok(AttributeName::Role),
"focus_id" => Ok(AttributeName::FocusId),
"alt" => Ok(AttributeName::Alt),
"canvas_reference" => Ok(AttributeName::CanvasReference),
"layer" => Ok(AttributeName::Layer),
"offset_y" => Ok(AttributeName::OffsetY),
"offset_x" => Ok(AttributeName::OffsetX),
"reference" => Ok(AttributeName::Reference),
"cursor_reference" => Ok(AttributeName::CursorReference),
"cursor_index" => Ok(AttributeName::CursorIndex),
"cursor_color" => Ok(AttributeName::CursorColor),
"cursor_mode" => Ok(AttributeName::CursorMode),
"cursor_id" => Ok(AttributeName::CursorId),
"highlights" => Ok(AttributeName::Highlights),
"highlight_color" => Ok(AttributeName::HighlightColor),
"highlight_mode" => Ok(AttributeName::HighlightMode),
"image_reference" => Ok(AttributeName::ImageReference),
"image_data" => Ok(AttributeName::ImageData),
"svg_data" => Ok(AttributeName::SvgData),
"svg_content" => Ok(AttributeName::SvgContent),
"spacing" => Ok(AttributeName::Spacing),
_ => Err(format!("{attr} not supported.")),
}
}
}