Added value_ref and value_mut

Fixes #51
This commit is contained in:
Armin Ronacher 2023-10-07 17:17:37 +02:00
parent de455873da
commit e85ddb0d18
2 changed files with 14 additions and 0 deletions

View file

@ -103,6 +103,16 @@ impl<T: Clone> Change<T> {
pub fn value(&self) -> T {
self.value.clone()
}
/// Returns the underlying changed value as reference.
pub fn value_ref(&self) -> &T {
&self.value
}
/// Returns the underlying changed value as mutable reference.
pub fn value_mut(&mut self) -> &mut T {
&mut self.value
}
}
/// Utility enum to capture a diff operation.