Trait aragog::Update

source ·
pub trait Update<T> {
    // Required method
    fn update(&mut self, form: &T) -> Result<(), Error>;

    // Provided method
    fn update_field_from_option<U>(value: &mut U, new_value: &Option<U>)
       where U: Clone { ... }
}
Expand description

The Update trait of the Aragog library. This trait provides the possibility to update a Type from an other one. Its main use it to apply modifications from a Http form on a Record model instance.

Required Methods§

source

fn update(&mut self, form: &T) -> Result<(), Error>

Update the Self field values T. The object takes a mutable reference of itself and is directly updated.

Errors

Can fail and return an error, the error is in most of the cases an Error::ValidationError on fields validation failure

Provided Methods§

source

fn update_field_from_option<U>(value: &mut U, new_value: &Option<U>)where U: Clone,

Can update a mutable value with a new one if the new_value is defined (Some). if the new_value is None the value stays unchanged

Object Safety§

This trait is not object safe.

Implementors§