Attempts to convert this set into the corresponding [`EnumSet`]. If any unknown bits are present in the set, this method will return `None`.
(&self)
| 269 | /// |
| 270 | /// If any unknown bits are present in the set, this method will return `None`. |
| 271 | pub fn try_as_enumset(&self) -> Option<EnumSet<T>> { |
| 272 | if self.has_unknown_bits() { |
| 273 | None |
| 274 | } else { |
| 275 | Some(EnumSet { repr: self.repr }) |
| 276 | } |
| 277 | } |
| 278 | |
| 279 | /// Converts this set into the corresponding [`EnumSet`], ignoring bits that do not correspond |
| 280 | /// to a variant. |
no test coverage detected