add missing traits to RocResult

This commit is contained in:
Brendan Hansknecht 2023-11-14 18:16:04 -08:00
parent 7b1f2d2ac1
commit d01fc9156c
No known key found for this signature in database
GPG key ID: 0EA784685083E75B

View file

@ -101,6 +101,13 @@ where
}
}
impl<T, E> Eq for RocResult<T, E>
where
T: Eq,
E: Eq,
{
}
impl<T, E> PartialEq for RocResult<T, E>
where
T: PartialEq,
@ -111,6 +118,37 @@ where
}
}
impl<T, E> Ord for RocResult<T, E>
where
T: Ord,
E: Ord,
{
fn cmp(&self, other: &Self) -> Ordering {
self.as_result_of_refs().cmp(&other.as_result_of_refs())
}
}
impl<T, E> PartialOrd for RocResult<T, E>
where
T: PartialOrd,
E: PartialOrd,
{
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
self.as_result_of_refs()
.partial_cmp(&other.as_result_of_refs())
}
}
impl<T, E> Hash for RocResult<T, E>
where
T: Hash,
E: Hash,
{
fn hash<H: Hasher>(&self, state: &mut H) {
self.as_result_of_refs().hash(state)
}
}
impl<T, E> Clone for RocResult<T, E>
where
T: Clone,