Skip to content

Commit c765cb4

Browse files
committed
validate is mut, so init can mutate strategy data
1 parent 31c179e commit c765cb4

File tree

7 files changed

+15
-15
lines changed

7 files changed

+15
-15
lines changed

src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ pub trait Interpolator<T>: DynClone {
184184
/// Interpolator dimensionality.
185185
fn ndim(&self) -> usize;
186186
/// Validate interpolator data.
187-
fn validate(&self) -> Result<(), ValidateError>;
187+
fn validate(&mut self) -> Result<(), ValidateError>;
188188
/// Interpolate at supplied point.
189189
fn interpolate(&self, point: &[T]) -> Result<T, InterpolateError>;
190190
}
@@ -195,7 +195,7 @@ impl<T> Interpolator<T> for Box<dyn Interpolator<T>> {
195195
fn ndim(&self) -> usize {
196196
(**self).ndim()
197197
}
198-
fn validate(&self) -> Result<(), ValidateError> {
198+
fn validate(&mut self) -> Result<(), ValidateError> {
199199
(**self).validate()
200200
}
201201
fn interpolate(&self, point: &[T]) -> Result<T, InterpolateError> {

src/n/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ where
187187
self.data.ndim()
188188
}
189189

190-
fn validate(&self) -> Result<(), ValidateError> {
190+
fn validate(&mut self) -> Result<(), ValidateError> {
191191
self.check_extrapolate(&self.extrapolate)?;
192192
self.data.validate()?;
193193
self.strategy.init(&self.data)?;

src/one/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ where
123123
N
124124
}
125125

126-
fn validate(&self) -> Result<(), ValidateError> {
126+
fn validate(&mut self) -> Result<(), ValidateError> {
127127
self.check_extrapolate(&self.extrapolate)?;
128128
self.data.validate()?;
129129
self.strategy.init(&self.data)?;

src/strategy.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ where
77
D: Data + RawDataClone + Clone,
88
D::Elem: PartialEq + Debug,
99
{
10-
fn init(&self, _data: &InterpData1D<D>) -> Result<(), ValidateError> {
10+
fn init(&mut self, _data: &InterpData1D<D>) -> Result<(), ValidateError> {
1111
Ok(())
1212
}
1313

@@ -28,7 +28,7 @@ where
2828
D: Data + RawDataClone + Clone,
2929
D::Elem: PartialEq + Debug,
3030
{
31-
fn init(&self, data: &InterpData1D<D>) -> Result<(), ValidateError> {
31+
fn init(&mut self, data: &InterpData1D<D>) -> Result<(), ValidateError> {
3232
(**self).init(data)
3333
}
3434

@@ -50,7 +50,7 @@ where
5050
D: Data + RawDataClone + Clone,
5151
D::Elem: PartialEq + Debug,
5252
{
53-
fn init(&self, _data: &InterpData2D<D>) -> Result<(), ValidateError> {
53+
fn init(&mut self, _data: &InterpData2D<D>) -> Result<(), ValidateError> {
5454
Ok(())
5555
}
5656

@@ -71,7 +71,7 @@ where
7171
D: Data + RawDataClone + Clone,
7272
D::Elem: PartialEq + Debug,
7373
{
74-
fn init(&self, data: &InterpData2D<D>) -> Result<(), ValidateError> {
74+
fn init(&mut self, data: &InterpData2D<D>) -> Result<(), ValidateError> {
7575
(**self).init(data)
7676
}
7777

@@ -93,7 +93,7 @@ where
9393
D: Data + RawDataClone + Clone,
9494
D::Elem: PartialEq + Debug,
9595
{
96-
fn init(&self, _data: &InterpData3D<D>) -> Result<(), ValidateError> {
96+
fn init(&mut self, _data: &InterpData3D<D>) -> Result<(), ValidateError> {
9797
Ok(())
9898
}
9999

@@ -114,7 +114,7 @@ where
114114
D: Data + RawDataClone + Clone,
115115
D::Elem: PartialEq + Debug,
116116
{
117-
fn init(&self, data: &InterpData3D<D>) -> Result<(), ValidateError> {
117+
fn init(&mut self, data: &InterpData3D<D>) -> Result<(), ValidateError> {
118118
(**self).init(data)
119119
}
120120

@@ -136,7 +136,7 @@ where
136136
D: Data + RawDataClone + Clone,
137137
D::Elem: PartialEq + Debug,
138138
{
139-
fn init(&self, _data: &InterpDataND<D>) -> Result<(), ValidateError> {
139+
fn init(&mut self, _data: &InterpDataND<D>) -> Result<(), ValidateError> {
140140
Ok(())
141141
}
142142

@@ -157,7 +157,7 @@ where
157157
D: Data + RawDataClone + Clone,
158158
D::Elem: PartialEq + Debug,
159159
{
160-
fn init(&self, data: &InterpDataND<D>) -> Result<(), ValidateError> {
160+
fn init(&mut self, data: &InterpDataND<D>) -> Result<(), ValidateError> {
161161
(**self).init(data)
162162
}
163163

src/three/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ where
142142
N
143143
}
144144

145-
fn validate(&self) -> Result<(), ValidateError> {
145+
fn validate(&mut self) -> Result<(), ValidateError> {
146146
self.check_extrapolate(&self.extrapolate)?;
147147
self.data.validate()?;
148148
self.strategy.init(&self.data)?;

src/two/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ where
128128
N
129129
}
130130

131-
fn validate(&self) -> Result<(), ValidateError> {
131+
fn validate(&mut self) -> Result<(), ValidateError> {
132132
self.check_extrapolate(&self.extrapolate)?;
133133
self.data.validate()?;
134134
self.strategy.init(&self.data)?;

src/zero/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ where
3838
}
3939

4040
/// Returns `Ok(())`.
41-
fn validate(&self) -> Result<(), ValidateError> {
41+
fn validate(&mut self) -> Result<(), ValidateError> {
4242
Ok(())
4343
}
4444

0 commit comments

Comments
 (0)