Skip to content

Commit c9ddd57

Browse files
committed
derive PartialEq for all types
1 parent 70f93de commit c9ddd57

File tree

7 files changed

+12
-12
lines changed

7 files changed

+12
-12
lines changed

src/data.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ pub use crate::one::{InterpData1D, InterpData1DOwned, InterpData1DViewed};
55
pub use crate::three::{InterpData3D, InterpData3DOwned, InterpData3DViewed};
66
pub use crate::two::{InterpData2D, InterpData2DOwned, InterpData2DViewed};
77

8-
#[derive(Debug, Clone)]
8+
#[derive(Debug, Clone, PartialEq)]
99
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
1010
#[cfg_attr(
1111
feature = "serde",

src/error.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use thiserror::Error;
44

55
/// Error in interpolator data validation
6-
#[derive(Error, Debug, Clone)]
6+
#[derive(Error, Debug, Clone, PartialEq)]
77
pub enum ValidateError {
88
#[error("selected `Strategy` ({0}) is unimplemented/inapplicable for interpolator")]
99
StrategySelection(&'static str),
@@ -20,7 +20,7 @@ pub enum ValidateError {
2020
}
2121

2222
/// Error in interpolation call
23-
#[derive(Error, Debug, Clone)]
23+
#[derive(Error, Debug, Clone, PartialEq)]
2424
pub enum InterpolateError {
2525
#[error("attempted to interpolate at point beyond grid data: {0}")]
2626
ExtrapolateError(String),

src/n/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use ndarray::prelude::*;
66

77
mod strategies;
88
/// Interpolator data where N is determined at runtime
9-
#[derive(Debug, Clone)]
9+
#[derive(Debug, Clone, PartialEq)]
1010
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
1111
#[cfg_attr(
1212
feature = "serde",
@@ -81,7 +81,7 @@ where
8181
}
8282

8383
/// N-D interpolator
84-
#[derive(Debug, Clone)]
84+
#[derive(Debug, Clone, PartialEq)]
8585
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
8686
#[cfg_attr(
8787
feature = "serde",

src/one/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ where
2828
}
2929

3030
/// 1-D interpolator
31-
#[derive(Debug, Clone)]
31+
#[derive(Debug, Clone, PartialEq)]
3232
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
3333
#[cfg_attr(
3434
feature = "serde",

src/strategy.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -163,24 +163,24 @@ pub fn find_nearest_index<T: PartialOrd>(arr: ArrayView1<T>, target: T) -> usize
163163
}
164164

165165
/// Linear interpolation: <https://en.wikipedia.org/wiki/Linear_interpolation>
166-
#[derive(Debug, Clone)]
166+
#[derive(Debug, Clone, PartialEq)]
167167
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
168168
pub struct Linear;
169169

170170
/// Nearest value interpolation: <https://en.wikipedia.org/wiki/Nearest-neighbor_interpolation>
171171
///
172172
/// # Note
173173
/// Float imprecision may affect the value returned near midpoints.
174-
#[derive(Debug, Clone)]
174+
#[derive(Debug, Clone, PartialEq)]
175175
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
176176
pub struct Nearest;
177177

178178
/// Left-nearest (previous value) interpolation: <https://en.wikipedia.org/wiki/Nearest-neighbor_interpolation>
179-
#[derive(Debug, Clone)]
179+
#[derive(Debug, Clone, PartialEq)]
180180
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
181181
pub struct LeftNearest;
182182

183183
/// Right-nearest (next value) interpolation: <https://en.wikipedia.org/wiki/Nearest-neighbor_interpolation>
184-
#[derive(Debug, Clone)]
184+
#[derive(Debug, Clone, PartialEq)]
185185
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
186186
pub struct RightNearest;

src/three/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ where
3333
}
3434

3535
/// 3-D interpolator
36-
#[derive(Debug, Clone)]
36+
#[derive(Debug, Clone, PartialEq)]
3737
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
3838
#[cfg_attr(
3939
feature = "serde",

src/two/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ where
3232
}
3333

3434
/// 2-D interpolator
35-
#[derive(Debug, Clone)]
35+
#[derive(Debug, Clone, PartialEq)]
3636
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
3737
#[cfg_attr(
3838
feature = "serde",

0 commit comments

Comments
 (0)