Open
Description
What problem does this solve or what need does it fill?
This is a generalization of APIs I've already written for bevy-convars, https://docs.rs/bevy-convars/0.2.0/bevy_convars/defaults/trait.IsDefault.html and https://docs.rs/bevy-convars/0.2.0/bevy_convars/defaults/trait.IsDefaultMut.html, where the functionality is used to track whether or not a CVar resource is still its initial (default) value.
What solution would you like?
These APIs are equivalent to checking if some ref is its initial value, and removing and reinserting that value so that added == changed
and it appears to be its initial value again.
Erasing change history additionally triggers change detection in a way that makes the value appear to have been inserted for the first time.
This would involve two new APIs on Ref<>
-like types:
/// Returns whether or not the reference has ever been modified.
fn has_ever_changed(&self) -> bool
/// Erases the change history of the reference, effectively removing and re-inserting it without doing any work.
fn erase_change_history(&mut self)