-
-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add global state management #187
Conversation
States are cheap to clone right? So this should be fine. 😄 |
No, it depends if the state is put in an |
Oh, great! I assumed you were going to implement clone-able state because of the said limitations 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clippy found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
Superseded by #194 |
This PR adds global state management as well as a
State
extractor to get the state in any handlers.Note : Before merging this PR, it is necessary to use dynamics handler for the
on_disconnect
function. Otherwise it wont be possible to use the state in these handlers.Currently it is not possible to use the references in extractors because of the following problem :
In the
ConnectHandler
implementation below for any function with arguments that implementsFromConnectParts
and are specified by values. To add a lifetime to extractors we could add a lifetime on the traitFromConnectParts
. The problem is that the provided lifetime should be the one declared with thefor<'a>
corresponding to the function and its scope is rather limited.Because of this issue any given state must be clonable so it can be given by value to the handlers.
Close :