fix: improve parity statediff (#5037)

This commit is contained in:
Matthias Seitz
2023-10-16 15:19:11 +02:00
committed by GitHub
parent 1468563f2f
commit 931065d71c
4 changed files with 64 additions and 122 deletions

View File

@@ -85,6 +85,11 @@ pub enum Delta<T> {
// === impl Delta ===
impl<T> Delta<T> {
/// Creates a new [Delta::Changed] variant
pub fn changed(from: T, to: T) -> Self {
Self::Changed(ChangedType { from, to })
}
/// Returns true if the value is unchanged
pub fn is_unchanged(&self) -> bool {
matches!(self, Delta::Unchanged)