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