We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
ScriptExtension::len
1 parent 4a8cb11 commit 716c18eCopy full SHA for 716c18e
src/lib.rs
@@ -193,6 +193,15 @@ impl ScriptExtension {
193
(self.first == 0) & (self.second == 0) & (self.third == 0)
194
}
195
196
+ /// Returns the number of scripts in the script extension
197
+ pub fn len(self) -> usize {
198
+ if self.is_common_or_inherited() {
199
+ 1
200
+ } else {
201
+ (self.first.count_ones() + self.second.count_ones() + self.third.count_ones()) as usize
202
+ }
203
204
+
205
/// Intersect this `ScriptExtension` with another `ScriptExtension`. Produces `Unknown` if things
206
/// do not intersect. This is equivalent to [`ScriptExtension::intersection`] but it stores the result
207
/// in `self`
0 commit comments