@@ -44,17 +44,34 @@ impl error::Error for NotSquareError {
44
44
}
45
45
}
46
46
47
+ #[ derive( Debug ) ]
48
+ pub struct StrideError { }
49
+
50
+ impl fmt:: Display for StrideError {
51
+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
52
+ write ! ( f, "invalid stride" )
53
+ }
54
+ }
55
+
56
+ impl error:: Error for StrideError {
57
+ fn description ( & self ) -> & str {
58
+ "invalid stride"
59
+ }
60
+ }
61
+
47
62
#[ derive( Debug ) ]
48
63
pub enum LinalgError {
49
64
NotSquare ( NotSquareError ) ,
50
65
Lapack ( LapackError ) ,
66
+ Stride ( StrideError ) ,
51
67
}
52
68
53
69
impl fmt:: Display for LinalgError {
54
70
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
55
71
match * self {
56
72
LinalgError :: NotSquare ( ref err) => err. fmt ( f) ,
57
73
LinalgError :: Lapack ( ref err) => err. fmt ( f) ,
74
+ LinalgError :: Stride ( ref err) => err. fmt ( f) ,
58
75
}
59
76
}
60
77
}
@@ -64,6 +81,7 @@ impl error::Error for LinalgError {
64
81
match * self {
65
82
LinalgError :: NotSquare ( ref err) => err. description ( ) ,
66
83
LinalgError :: Lapack ( ref err) => err. description ( ) ,
84
+ LinalgError :: Stride ( ref err) => err. description ( ) ,
67
85
}
68
86
}
69
87
}
@@ -79,3 +97,9 @@ impl From<LapackError> for LinalgError {
79
97
LinalgError :: Lapack ( err)
80
98
}
81
99
}
100
+
101
+ impl From < StrideError > for LinalgError {
102
+ fn from ( err : StrideError ) -> LinalgError {
103
+ LinalgError :: Stride ( err)
104
+ }
105
+ }
0 commit comments