···12 match DirBuilder::new()
13 .recursive(true)
14 .create(output_path) {
15+ Ok(()) => (),
16+ Err(err) => if err.kind() == std::io::ErrorKind::AlreadyExists {
17+ () // if folder already exists we can continue
18+ } else {
19+ panic!("Error detected: {err}")
20+ }
21 }
2223 match copy_dir_all("assets", format!("{output_path}/assets")) {
24+ Ok(()) => (),
25 Err(err) => println!("Couldnt copy assets directory, err: {err}"),
26 }
270028 write(format!("{output_path}/index.html"), handlers::index().as_bytes()).expect("Couldnt write index file");
29 write(format!("{output_path}/about.html"), handlers::about().as_bytes()).expect("Couldnt write about file");
30 write(format!("{output_path}/404.html"), handlers::not_found().as_bytes()).expect("Couldnt write 404 file");
3132 match DirBuilder::new()
33 .create(format!("{output_path}/blog")) {
34+ Ok(()) => (),
35+ Err(err) => if err.kind() == std::io::ErrorKind::AlreadyExists {
36+ () // if folder already exists we can continue
37+ } else {
38+ panic!("Error detected: {err}")
39+ }
40 }
4142
+5
src/rand_quote.rs
···1use rand::Rng;
203pub fn get_quote() -> &'static str {
00004 let vs = vec![
5"Silliness and tomfooler are afoot, and who am I to stop it.",
6"Low entropy self replicating phenomenon that generates a binding force called compassion.",
···1use rand::Rng;
23+/// Generates a random quote from a vec of &str present in the function body.
4pub fn get_quote() -> &'static str {
5+ // originally while dynamically server it would generate a new quote every time index would be
6+ // reloaded, but with static serve nature a new quote is written every new build.
7+ // Maybe not worth it.
8+ // feel free to remove
9 let vs = vec![
10"Silliness and tomfooler are afoot, and who am I to stop it.",
11"Low entropy self replicating phenomenon that generates a binding force called compassion.",