/// Saves the configuration at application exit.
Saves the configuration at application exit.
Saves the configuration at application exit .
fn save_config(
    mut exit: EventReader<'_, '_, AppExit>,
    config_path: Res<'_, ConfigPath>,
    lib_path: Res<'_, LibPath>,
    background_color: Res<'_, ClearColor>,
    visuals: Res<'_, egui::Visuals>,
) {
    // If the application is being exited:
    if exit.iter().next().is_some() {
        let config = Config {
            lib_path: lib_path.clone(),
            background_color: BgColor::new(background_color.as_ref()),
            light_mode: LightMode(!visuals.dark_mode),
        };
        config.save(&config_path.0);
    }
}
fn save_config ( mut exit : EventReader < ' _ , ' _ , AppExit > , config_path : Res < ' _ , ConfigPath > , lib_path : Res < ' _ , LibPath > , background_color : Res < ' _ , ClearColor > , visuals : Res < ' _ , egui :: Visuals > , ) { // If the application is being exited: if exit . iter ( ) . next ( ) . is_some ( ) { let config = Config { lib_path : lib_path . clone ( ) , background_color : BgColor :: new ( background_color . as_ref ( ) ) , light_mode : LightMode ( ! visuals . dark_mode ) , } ; config . save ( & config_path . 0 ) ; } }
Saves the configuration at application exit.
Saves the configuration at application exit .
exit
EventReader<'_, '_, AppExit>
config_path
Res<'_, ConfigPath>
lib_path
Res<'_, LibPath>
background_color
Res<'_, ClearColor>
visuals
Res<'_, egui::Visuals>