[][src]Trait aragog::Update

pub trait Update<T> {
    fn update(&mut self, form: &T) -> Result<(), ServiceError>;

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

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

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

Update the Self field values T. The object takes a mutable reference of itself and is directly updated. Can fail and return an error, the error is in most of the cases a ServiceError::ValidationError on fields validation failure

Loading content...

Provided methods

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

Loading content...

Implementors

Loading content...