summaryrefslogtreecommitdiff
path: root/src/policies/policy_result.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/policies/policy_result.rs')
-rw-r--r--src/policies/policy_result.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/policies/policy_result.rs b/src/policies/policy_result.rs
index e12ff42..852c705 100644
--- a/src/policies/policy_result.rs
+++ b/src/policies/policy_result.rs
@@ -1,4 +1,5 @@
use git2::Oid;
+use std::error::Error;
use std::fmt;
use std::iter;
@@ -22,6 +23,15 @@ impl PolicyResult {
x => x,
}
}
+ pub fn and_then(
+ self,
+ mut next: impl FnMut() -> Result<PolicyResult, Box<dyn Error>>,
+ ) -> Result<PolicyResult, Box<dyn Error>> {
+ match self {
+ PolicyResult::Ok => next(),
+ x => Ok(x),
+ }
+ }
pub fn is_ok(&self) -> bool {
match self {
PolicyResult::Ok => true,