-
Notifications
You must be signed in to change notification settings - Fork 154
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 support for struct
Route
s
#434
Conversation
This makes artic-hen7/perseus#151 and more advanced custom router patterns feasible.
This stuffed up some tests, and I'm fairly certain it actually isn't necessary.
Codecov Report
@@ Coverage Diff @@
## master #434 +/- ##
==========================================
- Coverage 64.97% 64.75% -0.22%
==========================================
Files 52 52
Lines 8268 8385 +117
==========================================
+ Hits 5372 5430 +58
- Misses 2896 2955 +59
Continue to review full report at Codecov.
|
Note that only |
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.
Sorry don't have time for a full review right now. I'll try to get to this soon.
No problem, Perseus can run off my fork in the meantime. |
@lukechu10, would it be possible to merge this fairly soon and get a new beta release out? I'd like to make a new release of Perseus fairly soon to field test the removal of |
Sorry for taking so long to get to this. I'm planning to do a refactor of the router API for the final 0.8 release but I'll merge this in for now to unblock you. |
Released v0.8.0-beta.7! |
This solves a problem I had with Sycamore last year: that
Route
can only be anenum
, meaning additional custom information can't be easily attached to the router system. Perseus required this, and did a very hacky workaround that both reduced routing performance there and made for some really weird semantics. With framesurge/perseus#151 though, that workaround it no longer feasible, so this makesRoute
be able to be astruct
, andmatch_route
now takes&self
.To achieve this, I've broken out the
Router
into aRouter
and aRouterBase
, with the former being a wrapper around the latter that simply calls it withR::default()
, which is now derived automatically inenum
s as the#[not_found]
route. All tests pass, and I'm pretty sure I've covered everything, but a review to make sure I haven't missed something would be greatly appreciated!I haven't done anything with
StaticRouter
, which already takes a specificRoute
instance.RouterBase
now mimics that, andRouter
just abstracts over it (meaning this isn't a breaking change).Closes #244.