Skip to main content

WindowBoundsStore

Trait WindowBoundsStore 

Source
pub trait WindowBoundsStore {
    // Required methods
    fn load(&self) -> Option<SavedBounds>;
    fn save(&self, bounds: SavedBounds);
}
Expand description

Where the shell restores window bounds from and saves them to.

Implement it on whatever already owns the app’s settings; the shell calls load once before the window is created and save when the geometry changes (gated on no mouse button being held, so a drag-resize doesn’t thrash the disk) and once more on exit.

Required Methods§

Source

fn load(&self) -> Option<SavedBounds>

Bounds from the last run, or None for a first launch.

Source

fn save(&self, bounds: SavedBounds)

Persist bounds. Called from the event loop, so keep it cheap — an app that already batches its own state can just record the value here and let its own save path write it.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§