Skip to main content

AppConfig

Struct AppConfig 

Source
#[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: AppLogLevel

If enabled, logs error and info messages.

Default is LevelFilter::Error to log all errors by default

§enable_visual_panic_hook: bool

If the app crashes / panics, a window with a message box pops up. Setting this to false disables the popup box.

§enable_logging_on_panic: bool

If this is set to true (the default), a backtrace + error information gets logged to stdout and the logging file (only if logging is enabled).

§enable_tab_navigation: bool

(STUB) Whether keyboard navigation should be enabled (default: true). Currently not implemented.

§termination_behavior: AppTerminationBehavior

Determines what happens when all windows are closed. Default: EndProcess (terminate when last window closes).

§icon_provider: IconProviderHandle

Icon provider for the application. Register icons here before calling App::run(). Each window will clone this provider (cheap, Arc-based).

§bundled_fonts: NamedFontVec

Fonts bundled with the application. These fonts are loaded into memory and take priority over system fonts.

§font_loading: FontLoadingConfig

Configuration for how system fonts should be loaded. Default: LoadAllSystemFonts (scan all system fonts at startup)

§mock_css_environment: OptionCssMockEnvironment

Optional 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: SystemStyle

System 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

Source

pub fn create() -> Self

Source

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§

Source§

impl Clone for AppConfig

Source§

fn clone(&self) -> AppConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AppConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for AppConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.