Modified elements to take static str (will change to &str)
This commit is contained in:
@@ -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 }
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ pub(crate) trait Render {
|
||||
}
|
||||
|
||||
pub(crate) struct Page {
|
||||
title: String,
|
||||
title: &'static str,
|
||||
head: Vec<Box<dyn Render>>,
|
||||
body: Vec<Box<dyn Render>>,
|
||||
}
|
||||
@@ -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![],
|
||||
|
||||
Reference in New Issue
Block a user