Compare commits

...

2 Commits

2 changed files with 28 additions and 0 deletions

View File

@@ -9,6 +9,8 @@ RestartSec=1
# Change with proper user to run the service
User=web
# Change with the installation location of the executable
# It is possible to use a custom config file location
# by adding '--config /path/to/config.toml' to the command bellow
ExecStart=/usr/share/bin/aindustries-be
[Install]

View File

@@ -10,6 +10,28 @@ pub(crate) struct Page {
body: Vec<Box<dyn Render>>,
}
pub(crate) struct PageBuilder {
title: Option<String>,
head: Option<Vec<Box<dyn Render>>>
body: Option<Vec<Box<dyn Render>>>
}
impl PageBuilder {
pub(crate) fn new() -> Self {
Self {
title: None,
head: None,
body: None,
}
}
pub(crate) fn title<T>(mut self, title: T)
where T: Into<String>
{
self.title = Some(title.into());
}
}
impl Render for Vec<Box<dyn Render>> {
fn render(&self) -> String {
let mut result = String::new();
@@ -45,6 +67,10 @@ impl Render for Page {
}
impl Page {
pub(crate) fn builder() -> PageBuilder {
PageBuilder::new()
}
pub(crate) fn new<T>(title: T) -> Self
where
T: Into<String>,