Trait DynWithDefault

Source
pub trait DynWithDefault: AsAny {
    // Required method
    fn with_default_mut(
        &mut self,
        f: &mut dyn FnMut(&mut dyn DynWithDefault, &mut dyn Any),
    );

    // Provided methods
    fn clear_and_inspect_old(
        &mut self,
        f: &mut dyn FnMut(&mut dyn DynWithDefault, &mut dyn Any),
    ) { ... }
    fn clear(&mut self) { ... }
}

Required Methods§

Source

fn with_default_mut( &mut self, f: &mut dyn FnMut(&mut dyn DynWithDefault, &mut dyn Any), )

Create a temporary default value of the current type and provide it in a closure. The callback’s first argument is self and the second argument is the new temporary default value. The callback can then modify the value as needed.

Provided Methods§

Source

fn clear_and_inspect_old( &mut self, f: &mut dyn FnMut(&mut dyn DynWithDefault, &mut dyn Any), )

Set self to a new default value and inspect the previous value as the second argument to the callback.

Source

fn clear(&mut self)

Implementors§

Source§

impl<T> DynWithDefault for T
where T: Default + AsAny + 'static,