summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--mullvad-types/src/constraints/constraint.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/mullvad-types/src/constraints/constraint.rs b/mullvad-types/src/constraints/constraint.rs
index eae5102638..2554a97d25 100644
--- a/mullvad-types/src/constraints/constraint.rs
+++ b/mullvad-types/src/constraints/constraint.rs
@@ -70,6 +70,13 @@ impl<T> Constraint<T> {
}
}
+ pub fn and_then<U, F: FnOnce(T) -> Constraint<U>>(self, f: F) -> Constraint<U> {
+ match self {
+ Constraint::Any => Constraint::Any,
+ Constraint::Only(value) => f(value),
+ }
+ }
+
pub const fn is_any(&self) -> bool {
match self {
Constraint::Any => true,