diff options
author | cel 🌸 <cel@blos.sm> | 2024-01-31 17:54:14 +0000 |
---|---|---|
committer | cel 🌸 <cel@blos.sm> | 2024-01-31 17:54:14 +0000 |
commit | b78d026c242e8d95e611e050afd5b72eb562d56d (patch) | |
tree | 00bf948afb9d4563b5ea506a8983b57a9293c7d5 /src/poetry.rs | |
parent | bea1a0e0c81e78133bb534c744ee858b6b1ad200 (diff) | |
download | blossom-b78d026c242e8d95e611e050afd5b72eb562d56d.tar.gz blossom-b78d026c242e8d95e611e050afd5b72eb562d56d.tar.bz2 blossom-b78d026c242e8d95e611e050afd5b72eb562d56d.zip |
genericise articles
Diffstat (limited to 'src/poetry.rs')
-rw-r--r-- | src/poetry.rs | 48 |
1 files changed, 48 insertions, 0 deletions
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<String>, + created_at: DateTime<Utc>, + published_at: DateTime<Utc>, + updated_at: Option<DateTime<Utc>>, + 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<Utc> { + &self.published_at + } + + fn updated_at(&self) -> Option<&DateTime<Utc>> { + self.updated_at.as_ref() + } + + fn tags(&self) -> &Vec<String> { + todo!() + } + + fn lang(&self) -> &str { + "en" + } + + fn post_type(&self) -> crate::posts::PostType { + todo!() + } + + fn content(&self) -> &str { + todo!() + } +} |