Skip to main content

NavStore

Trait NavStore 

Source
pub trait NavStore {
    // Required methods
    fn load(&self, key: &str) -> Option<String>;
    fn save(&self, key: &str, value: &str);
}
Expand description

A key/value sink a nav surface’s .restore persists its state through, so navigation survives a relaunch or an Android process death (docs/navigation.md). The framework never installs one — an app opts in by installing a store (e.g. day_part_prefs::install_nav_store) and marking the surfaces it wants remembered with .restore(key). With no store installed, .restore is a silent no-op, so a surface’s .restore call never fails to build.

Keys are opaque to day-core and namespaced by the surface’s .restore(key) argument; the store implementation is responsible for keeping them clear of the app’s own data.

Required Methods§

Source

fn load(&self, key: &str) -> Option<String>

The last value saved under key, or None if nothing was stored (first launch).

Source

fn save(&self, key: &str, value: &str)

Persist value under key, replacing any prior value.

Implementors§

Day API ↩ Guides· daybrite.dev