leptos-rs/leptos

`StoreFieldReader` and `StoreFieldWriter` should be public

Closed this issue · 5 comments

Is your feature request related to a problem? Please describe.
Field's in reactive_store implement the StoreField trait, however the .reader() and .writer() methods on StoreField for Field returns private types: StoreFieldReader and StoreFieldWriter. This makes it impossible in cases where you might need to work with these types, since they cannot be imported.

Describe the solution you'd like
Make these types public.

When writing this issue, I wasn't actually aware these are read/write guards. However I'm not sure if that makes the issue no longer relevant or not.

The motivation for this is that I couldn't find a generic type for writing to a store field. Field implements read traits, but doesn't seem to implement anything for updating besides .writer() (unless I'm mistaken). I'm not sure if I can do anything such as try_maybe_update(...) on a store field due to the lack of impl Update for Field.

gbj commented

Oops does Field not implement Write? Surely that's just an accidental omission on my part.

Is Field also planned to implement Update to allow for try_maybe_update(...)?

gbj commented

Update is automatically implemented for all types that implement Write.

Oops my mistake, a manual impl of Update in thawui confused me with this. If the issue is resolved with 9718041 feel free to close. I don't have a real need for StoreFieldReader and StoreFieldWriter to be public anymore.