pub fn mark_as_done(id: usize) -> Result<(), String> {
    let mut tasks = read_todo_file()?;
    let (position, task_to_complete) = locate_task(id, &tasks)?;

    if task_to_complete.to_ascii_lowercase().starts_with('x') {
        return Err(String::from("This task is already marked as done"));
    }

    tasks.insert_str(position, "x ");
    overwrite_todo_file(&tasks)
}
/// Marks a task as accomplished
///
/// A cross ('x') is inserted at the beginning of the task entry to mark it as done.
///
/// # Errors
///
/// - couldn't find task with given ID
/// - task is already marked as done
Marks a task as accomplished
A cross ('x') is inserted at the beginning of the task entry to mark it as done.
Marks a task as accomplished A cross ( ' x ' ) is inserted at the beginning of the task entry to mark it as done .
pub fn mark_as_done(id: usize) -> Result<(), String> {
    let mut tasks = read_todo_file()?;
    let (position, task_to_complete) = locate_task(id, &tasks)?;
    if task_to_complete.to_ascii_lowercase().starts_with('x') {
        return Err(String::from("This task is already marked as done"));
    }
    tasks.insert_str(position, "x ");
    overwrite_todo_file(&tasks)
}
pub fn mark_as_done ( id : usize ) -> Result < ( ) , String > { let mut tasks = read_todo_file ( ) ? ; let ( position , task_to_complete ) = locate_task ( id , & tasks ) ? ; if task_to_complete . to_ascii_lowercase ( ) . starts_with ( 'x' ) { return Err ( String :: from ( " " ) ) ; } tasks . insert_str ( position , " " ) ; overwrite_todo_file ( & tasks ) }
Marks a task as accomplished
A cross ('x') is inserted at the beginning of the task entry to mark it as done.
Marks a task as accomplished A cross ( ' x ' ) is inserted at the beginning of the task entry to mark it as done .
id
usize
id
usize
errors
couldn't find task with given ID
task is already marked as done
couldn ' t find task with given ID task is already marked as done