pub struct WindowStateStore { /* private fields */ }Expand description
Bounded JSON state store in the app-data directory.
Implementations§
Source§impl WindowStateStore
impl WindowStateStore
Sourcepub fn for_app_id(app_id: &str) -> Self
pub fn for_app_id(app_id: &str) -> Self
Return the platform app-data state path for an app id.
Sourcepub fn save(&self, state: &WindowState) -> Result<(), WindowStateError>
pub fn save(&self, state: &WindowState) -> Result<(), WindowStateError>
Atomically replace state using a uniquely created sibling temporary file.
Readers see either complete version. This guarantees atomic visibility, not durability across power loss.
On Windows, the state directory must support POSIX-style atomic rename (Windows 10 version 1607 or later on a supported filesystem such as NTFS). Unsupported filesystems return an error rather than weaken this guarantee.
Sourcepub fn load_valid(
&self,
displays: &[DisplayBounds],
) -> Result<Option<WindowState>, WindowStateError>
pub fn load_valid( &self, displays: &[DisplayBounds], ) -> Result<Option<WindowState>, WindowStateError>
Load visible state, returning None for absent or stale geometry.
Malformed or oversized input returns a typed error. On Windows, a transient access denial during replacement is retried at most seven times.
Trait Implementations§
Source§impl Clone for WindowStateStore
impl Clone for WindowStateStore
Auto Trait Implementations§
impl Freeze for WindowStateStore
impl RefUnwindSafe for WindowStateStore
impl Send for WindowStateStore
impl Sync for WindowStateStore
impl Unpin for WindowStateStore
impl UnsafeUnpin for WindowStateStore
impl UnwindSafe for WindowStateStore
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
Mutably borrows from an owned value. Read more