//! Settings-mode helper logic for the TUI settings overlay. //! //! Flow: exposes small mutation functions (currently just cycling the //! internet access mode) invoked by keybindings while the settings overlay //! is active. use crate::model::settings::{Settings, InternetMode}; /// Advance the internet access mode to the next value in the cycle. /// /// Flow: Off -> `ReadOnly` -> Full -> Off, wrapping around. /// /// Why: used by a settings-toggle keybinding to step through modes /// without needing a dropdown/menu. /// /// Return: nothing; mutates `settings.internet_mode` in place. pub fn cycle_internet_mode(settings: &mut Settings) { settings.internet_mode = match settings.internet_mode { InternetMode::Off => InternetMode::ReadOnly, InternetMode::ReadOnly => InternetMode::Full, InternetMode::Full => InternetMode::Off, }; }