Prefer clone_from over assign
This commit is contained in:
@@ -7,16 +7,22 @@ use sbp::Float;
|
||||
#[cfg(feature = "sparse")]
|
||||
pub mod sparse;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
#[derive(Debug)]
|
||||
pub struct Field(pub(crate) Array3<Float>);
|
||||
|
||||
impl Clone for Field {
|
||||
fn clone(&self) -> Self {
|
||||
Self(self.0.clone())
|
||||
}
|
||||
fn clone_from(&mut self, source: &Self) {
|
||||
self.0.clone_from(&source.0)
|
||||
}
|
||||
}
|
||||
|
||||
impl integrate::Integrable for Field {
|
||||
type State = Field;
|
||||
type Diff = Field;
|
||||
|
||||
fn assign(s: &mut Self::State, o: &Self::State) {
|
||||
s.0.assign(&o.0);
|
||||
}
|
||||
fn scaled_add(s: &mut Self::State, o: &Self::Diff, scale: Float) {
|
||||
s.0.scaled_add(scale, &o.0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user