-
Notifications
You must be signed in to change notification settings - Fork 125
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
RFC: remove StateData trait #487
Comments
I just looked through the history of gotham and it looks like |
Considering #494, removing |
How so? You could still make the opinionated assumption that Option is mapped to try_take. Possibly you could even force this in the type system (ie not let the user store Option in state). Personally I think not being able to store non crate structures directly in the state is a far greater annoyance. |
Well, I'll wait to see an actual implementation, maybe there's a clever trick that I didn't think of that makes this possible. |
Currently to be able to store something in
State
, the data needs to implement theStateData
trait. ThisStateData
trait is really just an alias forAny + Send
. It would be really nice if implementing this trait would not be needed. Here are some reasons why:StateData
can be removed and replaced with directAny + Send
without issues. There is thus no technical reason for the existence of this trait.gotham::state::State
, you need to either add theStateData
proc-macro to the declaration, or manually implementgotham::state::StateData
. This is an extra line of code that is not needed.State
, you need to wrap it with of a wrapper struct just so you can implementStateData
. This adds unnecessary bloat.I propose that the
StateData
trait andStateData
proc-macro are removed. All methods onState
andFromState
that currently take aStateData
would take anyAny + Send
instead.More benefits:
The text was updated successfully, but these errors were encountered: