extern crate chrono;
use chrono::prelude::*;
#[derive(Debug)]
pub struct Learned {
pub description: String,
pub date: Date<Local>,
}
impl Learned {
pub fn new(args: Vec<String>) -> Result<Learned, &'static str> {
if args.len() < 2 {
return Err("not enough arguments");
}
let description = args.clone().split_off(1).join(" ");
let date = Local::today();
Ok(Learned { description, date })
}
}