implement main menu as trait

This commit is contained in:
yggverse 2025-01-27 09:57:57 +02:00
parent 099bba0173
commit 0f89b526f7
2 changed files with 7 additions and 10 deletions

View file

@ -11,16 +11,16 @@ use std::rc::Rc;
// Config options
const LABEL_MAX_LENGTH: usize = 28;
pub struct Menu {
pub menu_button: MenuButton,
pub trait Menu {
fn menu(action: (&Rc<BrowserAction>, &Rc<WindowAction>), profile: &Rc<Profile>) -> Self;
}
#[rustfmt::skip] // @TODO template builder?
impl Menu {
impl Menu for MenuButton {
// Constructors
/// Build new `Self`
pub fn build(
fn menu(
(browser_action, window_action): (&Rc<BrowserAction>, &Rc<WindowAction>),
profile: &Rc<Profile>,
) -> Self {
@ -252,10 +252,7 @@ impl Menu {
}
});
// Result
Self {
menu_button
}
menu_button
}
}