Skip to content

Commit f156781

Browse files
committed
Add intersection()/intersect_with()
1 parent 6c286e4 commit f156781

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/lib.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,20 @@ impl ScriptExtension {
4545
///
4646
/// "Common" (`Zyyy`) and "Inherited" (`Zinh`) are considered as intersecting
4747
/// everything.
48-
pub fn intersect(self, other: Self) -> Self {
48+
pub fn intersection(&mut self, other: Self) -> Self {
4949
self.inner_intersect(other)
5050
}
5151

52+
/// Intersect this ScriptExtension with another ScriptExtension. Produces Unknown if things
53+
/// do not intersect. This is equivalent to [`ScriptExtension::intersection`] but it stores the result
54+
/// in `self`
55+
///
56+
/// "Common" (`Zyyy`) and "Inherited" (`Zinh`) are considered as intersecting
57+
/// everything.
58+
pub fn intersect_with(&mut self, other: Self) {
59+
*self = self.inner_intersect(other)
60+
}
61+
5262
/// Checks if the script extension is empty (unknown)
5363
pub fn is_empty(self) -> bool {
5464
self == ScriptExtension::Single(Script::Unknown)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy