rust-osdev / x86_64

Library to program x86_64 hardware.
https://docs.rs/x86_64
Apache License 2.0
797 stars 132 forks source link

Derive common traits for number, range and enum types #315

Closed Freax13 closed 3 years ago

Freax13 commented 3 years ago

Rust's api guidelines recommend eagerly implementing common traits. There has already been some discussion #43 whether implementing all traits is always the best idea.

This pr add derives for Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash to some number and range types. These types are newtypes around integers and don't have any implementation details to hide, so adding these derives should be unobjectionable. This pr also adds the same derives to some enum types.

Initially I only wanted to add theses derives to Pcid, but I noticed that other types were also missing some of them and decided to add them as well.