Add JSON support.
This commit is contained in:
@ -17,10 +17,12 @@
|
||||
*/
|
||||
|
||||
use uuid::Uuid;
|
||||
use serde::{Serialize, Deserialize};
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct Habit
|
||||
{
|
||||
uid:Uuid,
|
||||
uid:String,
|
||||
name:String,
|
||||
bad:bool,
|
||||
weight:u8,
|
||||
@ -32,14 +34,14 @@ impl Habit
|
||||
{
|
||||
Self
|
||||
{
|
||||
uid: Uuid::new_v4(),
|
||||
uid: Uuid::new_v4().hyphenated().to_string(),
|
||||
name,
|
||||
bad,
|
||||
weight,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_uid(&self) -> String { self.uid.to_string() }
|
||||
pub fn get_uid(&self) -> &String { &self.uid }
|
||||
pub fn get_name(&self) -> &String { &self.name }
|
||||
pub fn get_bad(&self) -> bool { self.bad }
|
||||
pub fn get_weight(&self) -> u8 { self.weight }
|
||||
|
@ -21,7 +21,6 @@ use structopt::clap::AppSettings;
|
||||
use std::env;
|
||||
use std::path::PathBuf;
|
||||
use std::fs;
|
||||
//use std::result::Result;
|
||||
|
||||
mod habit;
|
||||
mod habitmgr;
|
||||
|
Reference in New Issue
Block a user