pub fn open(
    opts: &OpenFileOptions,
    diary: &Diary,
    user_input: UserInput,
) -> Result<(), DiaryError> {
    let entry_path = diary.get_entry_path(&opts.entry_date);

    if !entry_path.exists() {
        return Err(DiaryError::NoEntry { source: None });
    }

    match user_input(entry_path) {
        Err(e) => Err(DiaryError::IOError(e)), // uncovered.
        _ => Ok(()),
    }
}
/// Opens a specific diary entry for editing.
///
/// # Arguments
///
/// * `opts` - The options passed by the user at runtime.
/// * `diary` - Struct representing the diary.
/// * `user_input` - A function of type UserInput. A function that takes a file
/// and adds content to it.
Opens a specific diary entry for editing.
Opens a specific diary entry for editing .
pub fn open(
    opts: &OpenFileOptions,
    diary: &Diary,
    user_input: UserInput,
) -> Result<(), DiaryError> {
    let entry_path = diary.get_entry_path(&opts.entry_date);
    if !entry_path.exists() {
        return Err(DiaryError::NoEntry { source: None });
    }
    match user_input(entry_path) {
        Err(e) => Err(DiaryError::IOError(e)), // uncovered.
        _ => Ok(()),
    }
}
pub fn open ( opts : & OpenFileOptions , diary : & Diary , user_input : UserInput , ) -> Result < ( ) , DiaryError > { let entry_path = diary . get_entry_path ( & opts . entry_date ) ; if ! entry_path . exists ( ) { return Err ( DiaryError :: NoEntry { source : None } ) ; } match user_input ( entry_path ) { Err ( e ) => Err ( DiaryError :: IOError ( e ) ) , // uncovered. _ => Ok ( ( ) ) , } }
Opens a specific diary entry for editing.
Opens a specific diary entry for editing .
opts
&OpenFileOptions
diary
&Diary
user_input
UserInput
opts
&OpenFileOptions
diary
&Diary
user_input
UserInput