[dependencies]
colored = "0.2.0"
use std::collections::HashMap;
use std::io::{self, Write};
use std::collections::HashMap;
use std::io::{self, Write};
[Signature]
#[derive(Debug, PartialEq)] // With this, you can realize the tests
pub struct User {
pub name: String,
pub pass: String,
}
[User's Methods]
pub fn new(name: String, pass: String) -> User;
pub fn change_pass(&mut self, pass: String);
[Signature]
#[derive(Debug, PartialEq)] // With this, you can realize the tests
pub struct Task {
pub id: u32,
pub description: String,
pub user: User,
pub status: bool,
}
[Task's Methods]
pub fn new(id: &mut u32, description: String, user: User, status: bool) -> Task;
pub fn belongs_to(&self, user: &User) -> bool;
[Signature]
#[derive(Debug, PartialEq)] // With this, you can realize the tests
pub struct UserList {
pub users: HashMap<String, String>
}
[UserList's Methods]
pub fn new() -> UserList;
pub fn login(&self) -> bool;
pub fn register(&mut self) -> bool;
[Signature]
#[derive(Debug, PartialEq)] // With this, you can realize the tests
pub struct TodoList {
pub tasks: Vec<Task>,
}
[TodoList's Methods]
pub fn new() -> TodoList;
pub fn from(tasks: Vec<Task>) -> TodoList;
pub fn insert(&mut self, task: Task);
pub fn show_all(&self);
pub fn find_all(&self, user: &User) -> Vec<&Task>;
pub fn find_one(&self, user: &User) -> &Task;