Change Setting::apply function signature

This commit is contained in:
Louis Dureuil 2023-12-20 17:07:18 +01:00
parent de2ca7006e
commit e249e4db7b
No known key found for this signature in database

View File

@ -78,11 +78,19 @@ impl<T> Setting<T> {
}
}
pub fn apply(&mut self, new: Self) {
/// Returns `true` if applying the new setting changed this setting
pub fn apply(&mut self, new: Self) -> bool
where
T: PartialEq + Eq,
{
if let Setting::NotSet = new {
return;
return false;
}
if self == &new {
return false;
}
*self = new;
true
}
}