embedded-menu
embedded-menu copied to clipboard
add support for global `SelectValue` name
currently doing
#[derive(embedded_menu::SelectValue, PartialEq, Eq, Clone, Copy)]
#[display_as(">")]
pub enum Page {
Main,
#[display_as("toto")]
InputDebug,
SelectInput,
SelectOutput,
Settings,
}
compiles but #[display_as(">")] doesn't do anything, we need to do
#[derive(embedded_menu::SelectValue, PartialEq, Eq, Clone, Copy)]
pub enum Page {
#[display_as(">")]
Main,
#[display_as("toto")]
InputDebug,
#[display_as(">")]
SelectInput,
#[display_as(">")]
SelectOutput,
#[display_as(">")]
Settings,
}
which can be done better.
with the current pr, a top level attribute (like shown in the first example) gives
impl embedded_menu::items::menu_item::SelectValue for Page {
fn next(&mut self) {
*self = match self {
Self::Main => Self::InputDebug,
Self::InputDebug => Self::SelectInput,
Self::SelectInput => Self::SelectOutput,
Self::SelectOutput => Self::Settings,
Self::Settings => Self::Main,
};
}
fn marker(&self) -> &str {
match self {
Self::Main => ">",
Self::InputDebug => "toto",
Self::SelectInput => ">",
Self::SelectOutput => ">",
Self::Settings => ">",
}
}
}
The top level attribute can be overwritten by the same attribute on each specific variant
I appreciate your enthusiasm but I have no energy or motivation to maintain this crate. Feel free to fork it and turn it into whatever you like it to be.
Okay 👍 sorry for the inconveniences 🙇