use std::sync::LazyLock; use serde::{Deserialize, Serialize}; static REMARKS: LazyLock> = LazyLock::new(|| { serde_json::from_str(include_str!("../../content/json/remarks.json")).unwrap() }); #[derive(Serialize, Deserialize)] struct Remark { #[allow(clippy::struct_field_names)] remark: String, created: String, edited: Option, } pub fn module(router: &mut windmark::router::Router) { crate::route::track_mount( router, "/remarks", "Fuwn's thoughts which are too short to be their own blog; but just long \ enough to be a remark.", |context| { crate::response::success( &format!( "# Remarks\n\nFuwn's thoughts which are too short to be their own \ blog; but just long enough to be a remark.\n\n{}", REMARKS .iter() .map(|r| { format!( "* \"{}\" {}{}", r.remark, r.created, r.edited.as_ref().map_or_else(String::new, |edited| { format!(" Edited {edited}") }) ) }) .collect::>() .join("\n") ), &context, ) }, ); }