diff --git a/src/html/elements.rs b/src/html/elements.rs index e2ece82..2de304c 100644 --- a/src/html/elements.rs +++ b/src/html/elements.rs @@ -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, + id: &'static str, + classes: Vec<&'static str>, content: Vec>, } @@ -72,7 +72,7 @@ impl Render for div { } impl div { - pub(crate) fn new(id: String, classes: Vec) -> 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, + 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, 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, - 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, 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, - 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, 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 } } } \ No newline at end of file diff --git a/src/html/mod.rs b/src/html/mod.rs index 80260ae..1c8a963 100644 --- a/src/html/mod.rs +++ b/src/html/mod.rs @@ -5,7 +5,7 @@ pub(crate) trait Render { } pub(crate) struct Page { - title: String, + title: &'static str, head: Vec>, body: Vec>, } @@ -45,7 +45,7 @@ impl Render for Page { } impl Page { - pub(crate) fn new(title: String) -> Self { + pub(crate) fn new(title: &'static str) -> Self { Page { title, head: vec![],