Dioxus Shareables
dioxus-shareables adds hooks for sharing structures between dioxus components. Version 0.2.x provides three interfaces:
-
The
shareable!()macro creates a single shared value.use *; use shareable; shareable!; -
A
Listprovides an array of shared values. Using aList<T>rather than aVec<T>allows components which use only one or two list items to get updated only when the specific list items they use are changed.use *; use ; shareable!;Listis aVecinternally, and the methods it implements therefore get their names and behavior fromVec. -
The
shareable_struct!{}macro provides a sharedstructwith interfaces that encapsulate different behavior. The idea is that each field of the struct will be stored in a separate global, and loaded only when requested. The actions block describes possible ways of using the struct in terms of what type of access (WorRW) they need to fields of the struct. The struct can then be initialized using an "action" which describes which fields we need which type of access to.use *; shareable_struct!
A note on version numbers.
If you're looking at the versions on Crates.io, you might notice that there the first release was a version 1.0. The simple version of the story is that I'm new to sharing my code with others and did not think about semver. Since then I've yanked all the release versions to sync the version numbers on this crate with the latest dioxus prerelease version.