diff --git a/benches/tui_update.rs b/benches/tui_update.rs index 5a3a70b66..d46921a8d 100644 --- a/benches/tui_update.rs +++ b/benches/tui_update.rs @@ -17,62 +17,14 @@ fn tui_update(c: &mut Criterion) { &size, |b, size| { b.iter(|| match size { - 1 => dioxus::tui::launch_cfg( - app3, - Config { - headless: true, - ..Default::default() - }, - ), - 2 => dioxus::tui::launch_cfg( - app6, - Config { - headless: true, - ..Default::default() - }, - ), - 3 => dioxus::tui::launch_cfg( - app9, - Config { - headless: true, - ..Default::default() - }, - ), - 4 => dioxus::tui::launch_cfg( - app12, - Config { - headless: true, - ..Default::default() - }, - ), - 5 => dioxus::tui::launch_cfg( - app15, - Config { - headless: true, - ..Default::default() - }, - ), - 6 => dioxus::tui::launch_cfg( - app18, - Config { - headless: true, - ..Default::default() - }, - ), - 7 => dioxus::tui::launch_cfg( - app21, - Config { - headless: true, - ..Default::default() - }, - ), - 8 => dioxus::tui::launch_cfg( - app24, - Config { - headless: true, - ..Default::default() - }, - ), + 1 => dioxus::tui::launch_cfg(app3, Config::default().with_headless()), + 2 => dioxus::tui::launch_cfg(app6, Config::default().with_headless()), + 3 => dioxus::tui::launch_cfg(app9, Config::default().with_headless()), + 4 => dioxus::tui::launch_cfg(app12, Config::default().with_headless()), + 5 => dioxus::tui::launch_cfg(app15, Config::default().with_headless()), + 6 => dioxus::tui::launch_cfg(app18, Config::default().with_headless()), + 7 => dioxus::tui::launch_cfg(app21, Config::default().with_headless()), + 8 => dioxus::tui::launch_cfg(app24, Config::default().with_headless()), _ => (), }) }, diff --git a/packages/tui/src/config.rs b/packages/tui/src/config.rs index 47ec817ee..fc2fb3da5 100644 --- a/packages/tui/src/config.rs +++ b/packages/tui/src/config.rs @@ -21,15 +21,18 @@ impl Config { } } - pub fn with_ctrl_c_quit(self, ctrl_c_quit: bool) -> Self { + pub fn with_ctrl_c_quit(self) -> Self { Self { - ctrl_c_quit, + ctrl_c_quit: true, ..self } } - pub fn with_headless(self, headless: bool) -> Self { - Self { headless, ..self } + pub fn with_headless(self) -> Self { + Self { + headless: true, + ..self + } } }