rust-embedded-community / pc-keyboard

PS/2 Keyboard Decoder in Rust
Apache License 2.0
99 stars 28 forks source link

Make Keyboard::new const fn #15

Closed CharlyCst closed 2 years ago

CharlyCst commented 2 years ago

Keyboard::new can't be const because it's not const to drop generic values, but we can work around this limitation by simply not running destructors on the set and layout. The drawback is that in the (unlikely) case where the user passes a type that needs to be dropped we might leak resources, maybe this is worth documenting?

thejpster commented 2 years ago

Thank you for these changes. They were merged as part of #19