-
Notifications
You must be signed in to change notification settings - Fork 133
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
Implement typed routes for ROUTER
#365
Conversation
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
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.
This is a great usability improvement! Thanks.
Agreed! Unfortunately, |
Perhaps a |
Hmm, perhaps I should have implemented the callback to receive a I'll make a follow-up PR once we have decided whether to mark |
Agreed that deprecated feels more appropriate here than unsafe. If there isn't a way to trigger memory unsafety, unsafe would be overkill. |
I guess since serializable types cannot contain pointers, it is not possible to create memory unsafety with this issue. 🤔 |
Implements
ROUTER::add_typed_route
, which (unlikeROUTER::add_route
) knows about the type expected by the callback and makes it impossible to mismatch types between the receiver and the callback.This method can be used pretty much exactly like
ROUTER::add_route
, I added a small test case that demonstrates this.Closes #242