Closed lpotthast closed 2 years ago
Yes definitely want an auto impl, maybe something like #[derive(Store(storage = Area::Local))]
Honestly don't have much experience with building macros so this may take some time to implement. Coming as soon as I can figure it out!
Turns out args like that aren't possible, so maybe something like
#[derive(Store, ..)]
#[store(storage = Area::Local)]
See new macro attr here https://github.com/intendednull/yewdux/blob/master/examples/persistent/src/main.rs
If we want a store with persistence, going by the current state of the Readme, we always need to implement even the (sane) default implementation that simply deserializes on load and serializes on every change ourself. Something like this: (I changed it slightly, so that it logs an error instead of panicking. Think this is fine here. Don't know what we could otherwise do with the error..)
I would assume that, at many times, nothing more sophisticated is required and therefore a default (or standard) implementation for the
Store
trait that provides just something like this should be worth it. Havin theStore
macro already, two additional macros namedLocalPersistedStore
andSessionPersistedStore
would do it, letting the user choose theyewdux::storage::Area
being used. With a note at the documentation/readme that anything else can and must be implemented manually.