haar_lib/algebra/
option.rs1pub use crate::algebra::traits::*;
4
5impl<T> Set for Option<T> {}
6impl<T: BinaryOp> BinaryOp for Option<T> {
7 fn op(self, other: Self) -> Self {
8 match (self, other) {
9 (Some(a), Some(b)) => Some(a.op(b)),
10 (a, None) => a,
11 (None, b) => b,
12 }
13 }
14}
15impl<T> Identity for Option<T> {
16 fn id() -> Self {
17 None
18 }
19}
20impl<T: Associative> Associative for Option<T> {}
21impl<T: Commutative> Commutative for Option<T> {}
22impl<T: Idempotence> Idempotence for Option<T> {}