Advertisement
Guest User

Untitled

a guest
Jun 27th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.21 KB | None | 0 0
  1. trait GettableHighByte {
  2. fn get_high_byte(&self) -> u8;
  3. }
  4. impl GettableHighByte for u16 {
  5. fn get_high_byte(&self) -> u8 {
  6. (self >> 8) as u8
  7. }
  8. }
  9. fn main() {
  10. dbg!(1024u16.get_high_byte());
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement