From c4379d4c195c20dfaf46b7296b83fe465e370f74 Mon Sep 17 00:00:00 2001 From: Slatian Date: Tue, 21 Feb 2023 08:55:29 +0100 Subject: [PATCH] Messages now have a title and a message --- src/main.rs | 5 ++++- src/templating_engine.rs | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index 3158fd7..0219b2c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -264,7 +264,10 @@ async fn hello_world_handler( state.templating_engine.render_view( &settings, - &View::Message("Hello! There, You, Awesome Creature!".to_string()) + &View::Message{ + title: "Hey There!".to_string(), + message: "You,You are an awesome Creature!".to_string() + }, ).await } diff --git a/src/templating_engine.rs b/src/templating_engine.rs index ab7cf1f..51f9fa5 100644 --- a/src/templating_engine.rs +++ b/src/templating_engine.rs @@ -56,7 +56,7 @@ pub enum View { Dig { query: DigQuery, result: simple_dns::DnsLookupResult }, Index { query: IpQuery, result: IpResult }, Ip { query: IpQuery, result: IpResult }, - Message(String), + Message{ title: String, message: String }, #[serde(rename="404")] NotFound, } @@ -67,7 +67,7 @@ impl View { View::Dig{..} => "dig", View::Index{..} => "index", View::Ip{..} => "ip", - View::Message(..) => "message", + View::Message{..} => "message", View::NotFound => "404", }.to_string() }