diff options
Diffstat (limited to 'candle-core/src/error.rs')
-rw-r--r-- | candle-core/src/error.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/candle-core/src/error.rs b/candle-core/src/error.rs index 30d06239..35a33032 100644 --- a/candle-core/src/error.rs +++ b/candle-core/src/error.rs @@ -228,3 +228,11 @@ macro_rules! bail { return Err($crate::Error::Msg(format!($fmt, $($arg)*).into()).bt()) }; } + +pub fn zip<T, U>(r1: Result<T>, r2: Result<U>) -> Result<(T, U)> { + match (r1, r2) { + (Ok(r1), Ok(r2)) => Ok((r1, r2)), + (Err(e), _) => Err(e), + (_, Err(e)) => Err(e), + } +} |