-
Notifications
You must be signed in to change notification settings - Fork 66
Function to cast event types without copying #38
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
Comments
|
On second thought, this would only work when converting from |
On C this is handled by using an union. What about converting it into a Rust enum? |
With the changes in 4a0c484, you should be able to use
|
A pretty nice solution. But |
22dff4d and the changes are published :D |
Thanks! BTW I think the union RFC was approved some time ago, so we won't need this type of stuff in the future. |
I use this in my code, and I think it would be a great addition to the library:
it should be safe because the size of
XEvent
is >= the size ofT
(tested elsewhere). UsingFrom<XEvent>
does an unnecessary copy and this provides an alternative.The text was updated successfully, but these errors were encountered: