summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--mullvad-types/src/relay_constraints.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/mullvad-types/src/relay_constraints.rs b/mullvad-types/src/relay_constraints.rs
index f8907cba9c..b983c30657 100644
--- a/mullvad-types/src/relay_constraints.rs
+++ b/mullvad-types/src/relay_constraints.rs
@@ -42,6 +42,15 @@ impl<T: fmt::Debug + Clone + Eq + PartialEq> Constraint<T> {
}
}
+ pub fn map<U: fmt::Debug + Clone + Eq + PartialEq, F: FnOnce(T) -> U>(
+ self, f: F
+ ) -> Constraint<U> {
+ match self {
+ Constraint::Any => Constraint::Any,
+ Constraint::Only(value) => Constraint::Only(f(value)),
+ }
+ }
+
pub fn is_any(&self) -> bool {
match self {
Constraint::Any => true,