There's one thing that I often have to deal in embedded code — doing match on a few bits from an I/O register, which is commonly u32:
let val : u32 = ...; match (val & 0b11) >> 6 { 0b00 => ..., 0b01 => ..., 0b10 => ..., _ => {} } You can clearly see two problems here: I need to provide a catch-all match, even if the code guarantees a limited set of values; also I lost 0b11, and there's no warning due to catch all. Is it possible to make rustc aware of such cases? What would be totally awesome is some kind of [] operator for ints, that would extract bits, like that: match val[6..7] { ... } Is that something of interest to community? I would be willing to write an RFC for that, and possibly extend the compiler. -- Sincerely, Vladimir "Farcaller" Pouzanov http://farcaller.net/
_______________________________________________ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev