fn add_content(mut file: File, content: String, tag: Option<String>) -> Result<(), DiaryError> {
    if content.is_empty() {
        return Err(DiaryError::NoContent);
    }

    if let Some(tag) = tag {
        file.write_all(tag.as_bytes())?;
    }
    editing::add_user_content_to_file(&mut file, content)?;
    Ok(())
}
/// Adds the given content to a file.
///
/// # Arguments
///
/// * `file` The file to add the content to.
/// * `content` The content to add to the file above.
/// * `tag` The optional tag to place above the content.
///
/// # Errors
///
/// * If the content provided is empty.
Adds the given content to a file.
Adds the given content to a file .
fn add_content(mut file: File, content: String, tag: Option<String>) -> Result<(), DiaryError> {
    if content.is_empty() {
        return Err(DiaryError::NoContent);
    }
    if let Some(tag) = tag {
        file.write_all(tag.as_bytes())?;
    }
    editing::add_user_content_to_file(&mut file, content)?;
    Ok(())
}
fn add_content ( mut file : File , content : String , tag : Option < String > ) -> Result < ( ) , DiaryError > { if content . is_empty ( ) { return Err ( DiaryError :: NoContent ) ; } if let Some ( tag ) = tag { file . write_all ( tag . as_bytes ( ) ) ? ; } editing :: add_user_content_to_file ( & mut file , content ) ? ; Ok ( ( ) ) }
Adds the given content to a file.
Adds the given content to a file .
file
File
content
String
tag
Option<String>
file
File
content
String
tag
Option<String>
errors
If the content provided is empty.
If the content provided is empty .