#[repr(C)]pub struct AppConfig {
pub log_level: AppLogLevel,
pub enable_visual_panic_hook: bool,
pub enable_logging_on_panic: bool,
pub enable_tab_navigation: bool,
pub termination_behavior: AppTerminationBehavior,
pub icon_provider: IconProviderHandle,
pub bundled_fonts: NamedFontVec,
pub font_loading: FontLoadingConfig,
pub mock_css_environment: OptionCssMockEnvironment,
pub system_style: SystemStyle,
}Expand description
Configuration for optional features, such as whether to enable logging or panic hooks
Fields§
§log_level: AppLogLevelIf enabled, logs error and info messages.
Default is LevelFilter::Error to log all errors by default
enable_visual_panic_hook: boolIf the app crashes / panics, a window with a message box pops up.
Setting this to false disables the popup box.
enable_logging_on_panic: boolIf this is set to true (the default), a backtrace + error information
gets logged to stdout and the logging file (only if logging is enabled).
(STUB) Whether keyboard navigation should be enabled (default: true). Currently not implemented.
termination_behavior: AppTerminationBehaviorDetermines what happens when all windows are closed. Default: EndProcess (terminate when last window closes).
icon_provider: IconProviderHandleIcon provider for the application. Register icons here before calling App::run(). Each window will clone this provider (cheap, Arc-based).
bundled_fonts: NamedFontVecFonts bundled with the application. These fonts are loaded into memory and take priority over system fonts.
font_loading: FontLoadingConfigConfiguration for how system fonts should be loaded. Default: LoadAllSystemFonts (scan all system fonts at startup)
mock_css_environment: OptionCssMockEnvironmentOptional mock environment for CSS evaluation.
When set, this overrides the auto-detected system properties (OS, theme, etc.) for CSS @-rules and dynamic selectors. This is useful for:
- Testing OS-specific styles on a different platform
- Screenshot testing with consistent environment
- Previewing how the app looks on different systems
Default: None (use auto-detected system properties)
system_style: SystemStyleSystem style detected at startup (theme, colors, fonts, etc.)
This is detected once at AppConfig::create() and passed to all windows.
You can override this after creation to use a custom system style,
for example to test how your app looks on a different platform.
Implementations§
Source§impl AppConfig
impl AppConfig
pub fn create() -> Self
Sourcepub fn with_mock_environment(self, env: CssMockEnvironment) -> Self
pub fn with_mock_environment(self, env: CssMockEnvironment) -> Self
Create config with a mock CSS environment for testing
This allows you to simulate how your app would look on a different OS, with a different theme, language, or accessibility settings.
§Example
let config = AppConfig::create()
.with_mock_environment(CssMockEnvironment {
os: OptionOsCondition::Some(OsCondition::Linux),
theme: OptionThemeCondition::Some(ThemeCondition::Dark),
..Default::default()
});Trait Implementations§
Auto Trait Implementations§
impl Freeze for AppConfig
impl RefUnwindSafe for AppConfig
impl Send for AppConfig
impl Sync for AppConfig
impl Unpin for AppConfig
impl UnsafeUnpin for AppConfig
impl UnwindSafe for AppConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more