SergioBenitez / state

A Rust library for safe and effortless global and thread-local state management.
Other
209 stars 13 forks source link

Examples #12

Closed wyhinton closed 3 years ago

wyhinton commented 3 years ago

Hello!

I'm very interested in this crate. However, I think getting started would be much aided by a couple of minimal examples? Do this exist somewhere? If any exist maybe they could be added to the .readme?

SergioBenitez commented 3 years ago

The rustdocs (https://docs.rs/state) have quite a number of examples. Does those not suffice?

SergioBenitez commented 3 years ago

I'm assuming yes! Let me know if there's something missing.

wyhinton commented 3 years ago

@SergioBenitez sorry for the late response.

I suppose I was looking for more examples that would demonstrate how to use state to design UI components. For example, if we have many Button structs which we'd like to each have an on/off state, and on some event I'd like to toggle their state from on to off, then I'm a little unsure about how to go about using this library. I know that the library can do global mutable statics, but what if we want to manage state within a bunch of structs?