pub fn err<CB, AB>(root: &mut cursive::Cursive, quit: ErrAction, action: AB, cb: CB)
where
    CB: FnOnce(&mut cursive::Cursive) -> anyhow::Result<()>,
    AB: FnOnce(Dialog) -> Dialog,
{
    match cb(root) {
        Ok(_) => (),
        Err(e) => {
            let dialog = if let Quit = quit {
                error_quit(e)
            } else {
                error(e)
            };
            let dialog = action(dialog);
            root.add_layer(dialog)
        }
    }
}
/// Run the callback `cb`, and if an error occurs display a popup describing it.
///
/// `action` can be used to provide extra buttons to the error dialog.
Run the callback `cb`, and if an error occurs display a popup describing it.
`action` can be used to provide extra buttons to the error dialog.
Run the callback ` cb ` and if an error occurs display a popup describing it . ` action ` can be used to provide extra buttons to the error dialog .
pub fn err<CB, AB>(root: &mut cursive::Cursive, quit: ErrAction, action: AB, cb: CB)
where
    CB: FnOnce(&mut cursive::Cursive) -> anyhow::Result<()>,
    AB: FnOnce(Dialog) -> Dialog,
{
    match cb(root) {
        Ok(_) => (),
        Err(e) => {
            let dialog = if let Quit = quit {
                error_quit(e)
            } else {
                error(e)
            };
            let dialog = action(dialog);
            root.add_layer(dialog)
        }
    }
}
pub fn err < CB , AB > ( root : & mut cursive :: Cursive , quit : ErrAction , action : AB , cb : CB ) where CB : FnOnce ( & mut cursive :: Cursive ) -> anyhow :: Result < ( ) > , AB : FnOnce ( Dialog ) -> Dialog , { match cb ( root ) { Ok ( _ ) => ( ) , Err ( e ) => { let dialog = if let Quit = quit { error_quit ( e ) } else { error ( e ) } ; let dialog = action ( dialog ) ; root . add_layer ( dialog ) } } }
Run the callback `cb`, and if an error occurs display a popup describing it.
Run the callback ` cb ` and if an error occurs display a popup describing it .
root
&mut cursive::Cursive
quit
ErrAction
action
AB
cb
CB
root
&mut cursive::Cursive
quit
ErrAction
action
AB
cb
CB