Attempts to construct a bitset from a `[u64; O]`. If a bit that doesn't correspond to an enum variant is set, this method will return `None`.
(bits: [u64; O])
| 465 | /// |
| 466 | /// If a bit that doesn't correspond to an enum variant is set, this method will return `None`. |
| 467 | pub fn try_from_array<const O: usize>(bits: [u64; O]) -> Option<Self> { |
| 468 | let bits = T::Repr::try_from_u64_array::<O>(bits); |
| 469 | let mask = T::ALL_BITS; |
| 470 | bits.and_then(|bits| { |
| 471 | if bits.and_not(mask).is_empty() { |
| 472 | Some(EnumSet { repr: bits }) |
| 473 | } else { |
| 474 | None |
| 475 | } |
| 476 | }) |
| 477 | } |
| 478 | |
| 479 | /// Constructs a bitset from a `[u64; O]`, ignoring bits that do not correspond to a variant. |
| 480 | pub fn from_array_truncated<const O: usize>(bits: [u64; O]) -> Self { |