Skip to content
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

Proposal: Conversion of VirtualKeyCode to string #1074

Closed
ekse opened this issue Oct 24, 2018 · 2 comments
Closed

Proposal: Conversion of VirtualKeyCode to string #1074

ekse opened this issue Oct 24, 2018 · 2 comments

Comments

@ekse
Copy link

ekse commented Oct 24, 2018

Hi,

I would like to add conversions between VirtualKeyCode and &str. This is something we added to our project [1] to be able to serialize them to a file and that you previously suggested in issue #842. I decided to open an issue so we can agree on an implementation before I start working on it.

I would implement the Default (which automatically provides ToString) and FromStr traits on VirtualKeyCode. This can be done trivially using the strum crate (https://crates.io/crates/strum). Alternatively we can write the conversion manually for each variant at the cost of more boilerplate code.

[1] https://gitlab.com/veloren/game/blob/master/voxygen/src/keybinds.rs#L82

Thanks,

Sébastien

@francesca64
Copy link
Member

It's been a while since #842, and now this issue is relevant to winit instead of glutin. so should be discussed there instead.

I encourage you to weigh in on the discussion in rust-windowing/winit#652. rust-windowing/winit#304 is also relevant, though you'll likely get less attention there.

@ekse
Copy link
Author

ekse commented Nov 11, 2018

Closing as this is now implemented in winit.

@ekse ekse closed this as completed Nov 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants