SergioBenitez / state

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

Thread local state in Container without Send #3

Closed droundy closed 3 years ago

droundy commented 6 years ago

It would be ideal to be able to have non-Send types in thread local storage in a container. As long as they stay on the thread, that should work, right?

An alternate solution would be to create a separate thread local version of Container.

SergioBenitez commented 6 years ago

We could certainly have an analogous LocalContainer struct.

Can you tell me more about your use-case? In particular, do you have types that are Sync but not Send, or types that are neither?

droundy commented 6 years ago

My types are neither Sync nor Send.

On Tue, Feb 20, 2018 at 3:19 AM Sergio Benitez notifications@github.com wrote:

We could certainly have an analogous LocalContainer struct.

Can you tell me more about your use-case? In particular, do you have types that are Sync but not Send, or types that are neither?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/SergioBenitez/state/issues/3#issuecomment-366946800, or mute the thread https://github.com/notifications/unsubscribe-auth/AAIZKSpb0xUfGgPJobNlst9qZftOzImXks5tWqpTgaJpZM4SFjIV .

vorot93 commented 5 years ago

GObject/GTK+ is neither Sync nor send

SergioBenitez commented 5 years ago

@vorot93 I'd really like to implement this, and I even started implementing it. The challenge is doing it in a way that doesn't result in a complete duplication of every type. That, it would be a shame to have two versions of most types in this library: one for Sync + Send, and another without the bounds.