Modified elements to take static str (will change to &str)

This commit is contained in:
2025-10-06 16:45:07 +02:00
parent cba44c144d
commit 94b68982f6
2 changed files with 19 additions and 19 deletions

View File

@@ -36,8 +36,8 @@ impl h2 {
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
pub(crate) struct link { pub(crate) struct link {
rel: String, rel: &'static str,
href: String, href: &'static str,
} }
impl Render for link { impl Render for link {
@@ -47,15 +47,15 @@ impl Render for link {
} }
impl link { impl link {
pub(crate) fn new(rel: String, href: String) -> Self { pub(crate) fn new(rel: &'static str, href: &'static str) -> Self {
Self { rel, href } Self { rel, href }
} }
} }
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
pub(crate) struct div { pub(crate) struct div {
id: String, id: &'static str,
classes: Vec<String>, classes: Vec<&'static str>,
content: Vec<Box<dyn Render>>, content: Vec<Box<dyn Render>>,
} }
@@ -72,7 +72,7 @@ impl Render for div {
} }
impl div { impl div {
pub(crate) fn new(id: String, classes: Vec<String>) -> Self { pub(crate) fn new(id: &'static str, classes: Vec<&'static str>) -> Self {
Self { Self {
id, id,
classes, classes,
@@ -87,8 +87,8 @@ impl div {
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
pub(crate) struct p { pub(crate) struct p {
id: String, id: &'static str,
classes: Vec<String>, classes: Vec<&'static str>,
text: String text: String
} }
@@ -100,7 +100,7 @@ impl Render for p {
} }
impl p { impl p {
pub(crate) fn new(id: String, classes: Vec<String>, text: String) -> Self { pub(crate) fn new(id: &'static str, classes: Vec<&'static str>, text: String) -> Self {
Self { Self {
id, id,
classes, classes,
@@ -111,9 +111,9 @@ impl p {
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
pub(crate) struct img { pub(crate) struct img {
id: String, id: &'static str,
classes: Vec<String>, classes: Vec<&'static str>,
src: String, src: &'static str,
} }
impl Render for img { impl Render for img {
@@ -124,16 +124,16 @@ impl Render for img {
} }
impl img { impl img {
pub(crate) fn new(id: String, classes: Vec<String>, src: String) -> Self { pub(crate) fn new(id: &'static str, classes: Vec<&'static str>, src: &'static str) -> Self {
Self { id, classes, src } Self { id, classes, src }
} }
} }
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
pub(crate) struct a { pub(crate) struct a {
id: String, id: &'static str,
classes: Vec<String>, classes: Vec<&'static str>,
href: String, href: &'static str,
text: String, text: String,
} }
@@ -145,7 +145,7 @@ impl Render for a {
} }
impl a { impl a {
pub(crate) fn new(id: String, classes: Vec<String>, href: String, text: String) -> Self { pub(crate) fn new(id: &'static str, classes: Vec<&'static str>, href: &'static str, text: String) -> Self {
Self { id, classes, href, text } Self { id, classes, href, text }
} }
} }

View File

@@ -5,7 +5,7 @@ pub(crate) trait Render {
} }
pub(crate) struct Page { pub(crate) struct Page {
title: String, title: &'static str,
head: Vec<Box<dyn Render>>, head: Vec<Box<dyn Render>>,
body: Vec<Box<dyn Render>>, body: Vec<Box<dyn Render>>,
} }
@@ -45,7 +45,7 @@ impl Render for Page {
} }
impl Page { impl Page {
pub(crate) fn new(title: String) -> Self { pub(crate) fn new(title: &'static str) -> Self {
Page { Page {
title, title,
head: vec![], head: vec![],