aboutsummaryrefslogtreecommitdiffstats
path: root/src/poetry.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/poetry.rs')
-rw-r--r--src/poetry.rs48
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!()
+ }
+}