use super::funejson::Value; use super::todo_item::Todo; use super::todo_item_validate_todo::todos_from_value; /// What toggle_all would do: "complete" while any todo is open, "reopen" /// once none is, "none" for an empty list. pub fn toggle_all_mode(todos: &[Todo]) -> String { if todos.is_empty() { return "none".to_string(); } if todos.iter().any(|t| !t.done) { "complete".to_string() } else { "reopen".to_string() } } pub fn fune_vector(args: &[Value]) -> Value { Value::str(&toggle_all_mode(&todos_from_value(&args[0]))) }