pub fn edit_item<B: BoardAccess>(
    key: String,
    board: &mut B,
    editor: &mut dyn Editor,
    writer: &mut dyn Write
) {
    let task_result = board.get(&key);

    if task_result.is_none() {
        write!(writer, "No item named '{}' found.\n", &key).unwrap();
        return;
    }

    let mut task = task_result.unwrap();
    if task.description.is_some() {
        let description = task.description.unwrap();
        if description.trim() != "".to_string() {
            editor.open(&description);
            return;
        }
    }

    let result = editor.create(&key);
    task.description = Some(result.unwrap().clone());
    board.update(&key, task);
}
// if task has an associated file, open that
// otherwise create one and open it
if task has an associated file, open that
otherwise create one and open it
if task has an associated file open that otherwise create one and open it
pub fn edit_item<B: BoardAccess>(
    key: String,
    board: &mut B,
    editor: &mut dyn Editor,
    writer: &mut dyn Write
) {
    let task_result = board.get(&key);
    if task_result.is_none() {
        write!(writer, "No item named '{}' found.\n", &key).unwrap();
        return;
    }
    let mut task = task_result.unwrap();
    if task.description.is_some() {
        let description = task.description.unwrap();
        if description.trim() != "".to_string() {
            editor.open(&description);
            return;
        }
    }
    let result = editor.create(&key);
    task.description = Some(result.unwrap().clone());
    board.update(&key, task);
}
pub fn edit_item < B : BoardAccess > ( key : String , board : & mut B , editor : & mut dyn Editor , writer : & mut dyn Write ) { let task_result = board . get ( & key ) ; if task_result . is_none ( ) { write ! ( writer " \n " key ) . unwrap ( ) ; return ; } let mut task = task_result . unwrap ( ) ; if task . description . is_some ( ) { let description = task . description . unwrap ( ) ; if description . trim ( ) != " " . to_string ( ) { editor . open ( & description ) ; return ; } } let result = editor . create ( & key ) ; task . description = Some ( result . unwrap ( ) . clone ( ) ) ; board . update ( & key , task ) ; }
if task has an associated file, open that
otherwise create one and open it
if task has an associated file open that otherwise create one and open it
key
String
board
&mut B
editor
&mut dyn Editor
writer
&mut dyn Write
key
String
board
&mut B
editor
&mut dyn Editor
writer
&mut dyn Write