live_entity/
updatable.rs

1/// `Updatable` types can be upgraded in place based on data given by `U` values.
2pub trait Updatable<U> {
3    /// Update this value with data from `with`.
4    fn update(&mut self, with: &U);
5}
6
7impl<U: Clone> Updatable<Option<U>> for U {
8    fn update(&mut self, with: &Option<U>) {
9        if let Some(update) = with.as_ref() {
10            self.clone_from(update)
11        }
12    }
13}