refactoring

This commit is contained in:
vcoppe committed 2026-10-03 13:56:16 +02:00
1 parent 17533586ef
commit 888f41e979
49 files changed
+120 -66

No files matched your search

@@ -0,0 +1,13 @@
use std::ops::Add;
pub fn sum_options<T>(a: Option<T>, b: Option<T>) -> Option<T>
where
T: Add<Output = T>,
{
match (a, b) {
(Some(a), Some(b)) => Some(a + b),
(Some(a), None) => Some(a),
(None, Some(b)) => Some(b),
(None, None) => None,
}
}