Skip to main content

conspire/math/assert/eq/owned/
containers.rs

1use super::super::{AssertEq, eq_impl, eq_within_tols_impl};
2use crate::math::assert::{Assert, AssertionError};
3use crate::math::{Tensor, TensorList, TensorTuple, TensorVector};
4use std::fmt::Display;
5
6impl<T, const N: usize> AssertEq<TensorList<T, N>> for TensorList<T, N>
7where
8    T: Display + PartialEq + Tensor,
9{
10    fn eq(a: Self, b: TensorList<T, N>) -> Result<(), AssertionError> {
11        eq_impl(&a, &b)
12    }
13    fn eq_within_tols(tols: &Assert, a: Self, b: TensorList<T, N>) -> Result<(), AssertionError> {
14        eq_within_tols_impl(tols, &a, &b)
15    }
16}
17
18impl<T> AssertEq<TensorVector<T>> for TensorVector<T>
19where
20    T: Display + PartialEq + Tensor,
21{
22    fn eq(a: Self, b: TensorVector<T>) -> Result<(), AssertionError> {
23        eq_impl(&a, &b)
24    }
25    fn eq_within_tols(tols: &Assert, a: Self, b: TensorVector<T>) -> Result<(), AssertionError> {
26        eq_within_tols_impl(tols, &a, &b)
27    }
28}
29
30impl<T1, T2> AssertEq<TensorTuple<T1, T2>> for TensorTuple<T1, T2>
31where
32    T1: Display + PartialEq + Tensor,
33    T2: Display + PartialEq + Tensor,
34{
35    fn eq(a: Self, b: TensorTuple<T1, T2>) -> Result<(), AssertionError> {
36        eq_impl(&a, &b)
37    }
38    fn eq_within_tols(
39        tols: &Assert,
40        a: Self,
41        b: TensorTuple<T1, T2>,
42    ) -> Result<(), AssertionError> {
43        eq_within_tols_impl(tols, &a, &b)
44    }
45}