Convert from a bits value. This method will return `None` if any unknown bits are set.
(bits: Self::Bits)
| 188 | /// |
| 189 | /// This method will return `None` if any unknown bits are set. |
| 190 | fn from_bits(bits: Self::Bits) -> Option<Self> { |
| 191 | let truncated = Self::from_bits_truncate(bits); |
| 192 | |
| 193 | if truncated.bits() == bits { |
| 194 | Some(truncated) |
| 195 | } else { |
| 196 | None |
| 197 | } |
| 198 | } |
| 199 | |
| 200 | /// Convert from a bits value, unsetting any unknown bits. |
| 201 | fn from_bits_truncate(bits: Self::Bits) -> Self { |