summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorveradec <glitchmill.dyj3d@simplelogin.co>2026-10-27 23:28:49 +0530
committerveradec <glitchmill.dyj3d@simplelogin.co>2026-10-27 23:28:49 +0530
commitc8a959a65e6fe5d3d33dd0befe91438841cddbf4 (patch)
tree4a4db306096eabd40cbf5c99b24d32cd1ba8f9a1 /src/main.rs
parentd2ff12e9ce254cccf34a195485f13ca458dac3f2 (diff)
Move Strings from Option<String>
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/main.rs b/src/main.rs
index d5f6fea..448e704 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -7,9 +7,9 @@ use std::path::PathBuf;
struct File {
file_name: String,
parent_directory: String,
- date: Option<String>,
- title: Option<String>,
- description: Option<String>,
+ date: String,
+ title: String,
+ description: String,
content: String,
}
@@ -47,11 +47,11 @@ fn markdown_to_html(path: String, content: String) -> File {
let end = end_wrapped.unwrap();
let meta_data = &content[3..end + 2];
- let date: String;
- let title: String;
- let description: String;
+ let mut date: String;
+ let mut title: String;
+ let mut description: String;
- meta_data_extractor(meta_data);
+ (date, title, description) = meta_data_extractor(meta_data);
// println!("{meta_data}\n\n");
let html = markdown::to_html(&content[end + 7..]);
@@ -59,9 +59,9 @@ fn markdown_to_html(path: String, content: String) -> File {
return File {
file_name: file_name.to_str().unwrap().to_string(),
parent_directory: path,
- date: None,
- title: None,
- description: None,
+ date: date,
+ title: title,
+ description: description,
content: html,
};
}
@@ -77,8 +77,8 @@ fn main() {
let contents_read = fs::read_to_string(path).unwrap();
let f: File = markdown_to_html(path.to_string(), contents_read);
- // println!(
- // "file_name: {}\npath:{}\ncontent:\n{}",
- // f.file_name, f.parent_directory, f.content
- // );
+ println!(
+ "file_name: {}\npath:{}\ncontent:\n{}\n",
+ f.file_name, f.parent_directory, f.content
+ );
}