pub struct ParamDiff {
pub d_height: f32,
pub d_weight: f32,
pub d_muscle: f32,
pub d_age: f32,
pub extra_changes: Vec<(String, f32, f32)>,
pub extra_added: Vec<(String, f32)>,
pub extra_removed: Vec<(String, f32)>,
}Expand description
The difference between two ParamState values.
Fields§
§d_height: f32§d_weight: f32§d_muscle: f32§d_age: f32§extra_changes: Vec<(String, f32, f32)>Extra keys that changed: (key, old_value, new_value).
extra_added: Vec<(String, f32)>Extra keys added in b (not present in a).
extra_removed: Vec<(String, f32)>Extra keys removed in b (present in a but not b).
Implementations§
Source§impl ParamDiff
impl ParamDiff
Sourcepub fn compute(a: &ParamState, b: &ParamState) -> Self
pub fn compute(a: &ParamState, b: &ParamState) -> Self
Compute the diff: b - a for each field.
Sourcepub fn apply(&self, a: &ParamState) -> ParamState
pub fn apply(&self, a: &ParamState) -> ParamState
Apply the diff to a ParamState: a + diff = b.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ParamDiff
impl<'de> Deserialize<'de> for ParamDiff
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ParamDiff
impl RefUnwindSafe for ParamDiff
impl Send for ParamDiff
impl Sync for ParamDiff
impl Unpin for ParamDiff
impl UnsafeUnpin for ParamDiff
impl UnwindSafe for ParamDiff
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more