Skip to main content

WallpaperBackend

Trait WallpaperBackend 

Source
pub trait WallpaperBackend {
    // Required method
    fn build_commands(
        images: &[FileInfo],
        config: &Config,
    ) -> WallSwitchResult<Vec<Command>>;

    // Provided method
    fn apply(images: &[FileInfo], config: &Config) -> WallSwitchResult<()> { ... }
}
Expand description

Core trait defining the wallpaper application logic. Follows the “Functional Core, Imperative Shell” pattern.

Required Methods§

Source

fn build_commands( images: &[FileInfo], config: &Config, ) -> WallSwitchResult<Vec<Command>>

PURE FUNCTION: Only constructs the required system commands. Does NOT execute them. This makes the logic highly testable and predictable.

Provided Methods§

Source

fn apply(images: &[FileInfo], config: &Config) -> WallSwitchResult<()>

IMPURE FUNCTION: Executes the built commands. It defaults to sequentially running build_commands, but can be overridden by compositors that require complex state checks (e.g., Hyprland preloading, Swaybg daemon spawning).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§