Closed
Description
Would rust be willing to take a pull request that implements BitAnd on integer types for all smaller versions of the int?
For example:
impl BitAnd<u64> for u128 { type Output = u64 }
impl BitAnd<u32> for u128 { type Output = u32 }
impl BitAnd<u16> for u128 { type Output = u16 }
impl BitAnd<u8> for u128 { type Output = u8 }
impl BitAnd<u32> for u64 { type Output = u32 }
impl BitAnd<u16> for u64 { type Output = u16 }
impl BitAnd<u8> for u64 { type Output = u8 }
impl BitAnd<u16> for u32 { type Output = u16 }
impl BitAnd<u8> for u32 { type Output = u8 }
impl BitAnd<u8> for u16 { type Output = u8 }
This would enable effortless, correct and infallible truncation in generic contexts. Is this problem sophisticated enough to warrant an RFC?