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
Consider making Router Data not an Option #38
Comments
Yes, that's most likely a leftover artifact from an earlier design... I will definitely take another look at this and reconsider. Unless there is another reason that currently escapes me, I agree it should not use The other thing I dislike about the Router but could not figure out a way around is the requirement to pass some data, even just unit type |
See Tide's https://github.com/http-rs/tide/blob/1d6f120c9e6c0e723bb8929dc0f601cd4f9d1449/src/server.rs#L59-L61 |
@tv42 - of course, seems so obvious in hindsight :) Thanks for pointing that out. The only downside is that we still need to add I've got a branch up with this change if you would like to take a look: f95b3ad |
For posterity, |
It seems the only reason
Router
andRouteContext
data
method return anOption<Data>
is because you've decided to implementDefault
for a router. Nothing seems to use that default. Could I convince you to remove theDefault
and make data be not optional? That would remove a.unwrap()
from practically every handler of every app using data.For inspiration/justification/examples:
The text was updated successfully, but these errors were encountered: