pub struct FeatureSet { /* private fields */ }Expand description
A set of features.
Implementations§
Source§impl FeatureSet
impl FeatureSet
Sourcepub const fn empty() -> Self
pub const fn empty() -> Self
No features. A value that needs nothing is one every revision can express.
Sourcepub const fn union(self, other: Self) -> Self
pub const fn union(self, other: Self) -> Self
The union of two sets.
This is the workhorse: a result with five content blocks needs the union
of what each block needs, and a result with a content array plus
structuredContent needs the union of both.
Sourcepub fn union_of(features: impl IntoIterator<Item = Feature>) -> Self
pub fn union_of(features: impl IntoIterator<Item = Feature>) -> Self
The union of everything in features.
Sourcepub const fn difference(self, other: Self) -> Self
pub const fn difference(self, other: Self) -> Self
The features in self that are not in other.
Sourcepub const fn from_bits(bits: u128) -> Self
pub const fn from_bits(bits: u128) -> Self
A set from the raw bit encoding.
The encoding is shared with FeatureProfile,
which is what lets required.is_subset_of(&profile.as_set()) be one
mask test. This constructor is the only way to build a set from those
bits, and it exists so that sharing has exactly one door: a caller that
wanted a set from somewhere else would have to hand-assemble the same
u128, and the type would no longer be trustworthy as a mirror of a
profile.
Sourcepub const fn bits(self) -> u128
pub const fn bits(self) -> u128
The raw bit encoding, shared with FeatureProfile.
Sourcepub const fn is_subset_of(self, other: Self) -> bool
pub const fn is_subset_of(self, other: Self) -> bool
Whether every feature in self is also in other.
This is the lowering gate: “can the session express this value”.