taskman 0.1.1

Cli for the task management.
use std::borrow::Cow;

use tabled::Tabled;

#[derive(Debug)]
pub struct Task {
    pub id: u64,
    pub name: String,
    pub description: Option<String>,
}

impl Tabled for Task {
    const LENGTH: usize = 3;

    fn fields(&self) -> Vec<Cow<'_, str>> {
        vec![Cow::Owned(self.id.to_string()), Cow::Borrowed(&self.name)]
    }

    fn headers() -> Vec<Cow<'static, str>> {
        vec![Cow::Owned("id".to_string()), Cow::Owned("name".to_string())]
    }
}

impl Task {
    pub fn new(id: u64, name: String, description: Option<String>) -> Task {
        Task {
            id,
            name,
            description,
        }
    }
}

pub struct CreateTaskRequest {
    pub id: u64,
    pub name: String,
    pub description: Option<String>,
}

impl CreateTaskRequest {
    pub fn new(id: u64, name: String, description: Option<String>) -> CreateTaskRequest {
        CreateTaskRequest {
            id,
            name,
            description,
        }
    }
}