// This file is part of Locus . // Copyright (C) 2022-2022 Fuwn // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, version 3. // // This program is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see . // // Copyright (C) 2022-2022 Fuwn // SPDX-License-Identifier: GPL-3.0-only use std::collections::HashMap; use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, Clone, Default)] pub struct Entry { description: Option, author: Option, created: Option, last_modified: Option, name: Option, } impl Entry { pub const fn description(&self) -> &Option { &self.description } pub const fn author(&self) -> &Option { &self.author } pub const fn name(&self) -> &Option { &self.name } pub const fn created(&self) -> &Option { &self.created } pub const fn last_modified(&self) -> &Option { &self.last_modified } } #[derive(Serialize, Deserialize, Clone, Default)] pub struct Blog { name: Option, description: Option, posts: Option>, } impl Blog { pub const fn description(&self) -> &Option { &self.description } pub const fn name(&self) -> &Option { &self.name } pub const fn posts(&self) -> &Option> { &self.posts } pub fn from_string(string: &str) -> serde_json::Result { serde_json::from_str(string) } }