summaryrefslogtreecommitdiffstats
path: root/mfbt/Result.h
diff options
context:
space:
mode:
Diffstat (limited to 'mfbt/Result.h')
-rw-r--r--mfbt/Result.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/mfbt/Result.h b/mfbt/Result.h
index 052920fdbf..fba5db25b9 100644
--- a/mfbt/Result.h
+++ b/mfbt/Result.h
@@ -834,6 +834,15 @@ class [[nodiscard]] Result final {
constexpr auto andThen(F f) -> std::invoke_result_t<F, V&&> {
return MOZ_LIKELY(isOk()) ? f(unwrap()) : propagateErr();
}
+
+ bool operator==(const Result<V, E>& aOther) const {
+ return (isOk() && aOther.isOk() && inspect() == aOther.inspect()) ||
+ (isErr() && aOther.isErr() && inspectErr() == aOther.inspectErr());
+ }
+
+ bool operator!=(const Result<V, E>& aOther) const {
+ return !(*this == aOther);
+ }
};
/**