From b78d026c242e8d95e611e050afd5b72eb562d56d Mon Sep 17 00:00:00 2001 From: cel 🌸 Date: Wed, 31 Jan 2024 17:54:14 +0000 Subject: genericise articles --- src/poetry.rs | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 src/poetry.rs (limited to 'src/poetry.rs') diff --git a/src/poetry.rs b/src/poetry.rs new file mode 100644 index 0000000..f5f194c --- /dev/null +++ b/src/poetry.rs @@ -0,0 +1,48 @@ +use chrono::{DateTime, Utc}; + +use crate::posts::Post; + +pub struct Poem { + file_name: String, + title: Option, + created_at: DateTime, + published_at: DateTime, + updated_at: Option>, + content: String, + // TODO: localisation (get lang from file names) + lang: String, +} + +impl Post for Poem { + fn id(&self) -> &str { + &self.file_name + } + + fn subject(&self) -> Option<&str> { + self.title.as_deref() + } + + fn published_at(&self) -> &DateTime { + &self.published_at + } + + fn updated_at(&self) -> Option<&DateTime> { + self.updated_at.as_ref() + } + + fn tags(&self) -> &Vec { + todo!() + } + + fn lang(&self) -> &str { + "en" + } + + fn post_type(&self) -> crate::posts::PostType { + todo!() + } + + fn content(&self) -> &str { + todo!() + } +} -- cgit