pub struct Html<'a> { /* private fields */ }
Implementations§
source§impl<'a> Html<'a>
impl<'a> Html<'a>
sourcepub fn new() -> Html<'a>
pub fn new() -> Html<'a>
Examples found in repository?
examples/getting_started.rs (line 34)
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
fn main() {
let title = HtmlHeadItem::new("<title>It works!</title>");
let style = HtmlStyle::new("body { color: #000000; }");
let script1 = HtmlScript::new(
format!(
r#"console.log("Hello from file {} at line {}")"#,
file!(),
line!(),
)
.as_str(),
);
let div = Div::builder().attr("class", "light-theme").append_child(
P::builder()
.attr("class", "light-theme")
.append_child(TextContent::text("It Works!")),
);
let body = HtmlBody::new().script(script1).append_child(div);
let script2 = HtmlScript::new(
format!(
r#"console.log("Hello from file {} at line {}")"#,
file!(),
line!(),
)
.as_str(),
);
let html = Html::new()
.head(title)
.add_style(style)
.add_script(script2)
.body(body);
#[cfg(feature = "debug")]
dbg!(&html);
println!("{html}");
}
sourcepub fn head(self, head: HtmlHeadItem<'a>) -> Html<'a>
pub fn head(self, head: HtmlHeadItem<'a>) -> Html<'a>
Examples found in repository?
examples/getting_started.rs (line 35)
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
fn main() {
let title = HtmlHeadItem::new("<title>It works!</title>");
let style = HtmlStyle::new("body { color: #000000; }");
let script1 = HtmlScript::new(
format!(
r#"console.log("Hello from file {} at line {}")"#,
file!(),
line!(),
)
.as_str(),
);
let div = Div::builder().attr("class", "light-theme").append_child(
P::builder()
.attr("class", "light-theme")
.append_child(TextContent::text("It Works!")),
);
let body = HtmlBody::new().script(script1).append_child(div);
let script2 = HtmlScript::new(
format!(
r#"console.log("Hello from file {} at line {}")"#,
file!(),
line!(),
)
.as_str(),
);
let html = Html::new()
.head(title)
.add_style(style)
.add_script(script2)
.body(body);
#[cfg(feature = "debug")]
dbg!(&html);
println!("{html}");
}
sourcepub fn add_style(self, style: HtmlStyle<'a>) -> Html<'a>
pub fn add_style(self, style: HtmlStyle<'a>) -> Html<'a>
Examples found in repository?
examples/getting_started.rs (line 36)
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
fn main() {
let title = HtmlHeadItem::new("<title>It works!</title>");
let style = HtmlStyle::new("body { color: #000000; }");
let script1 = HtmlScript::new(
format!(
r#"console.log("Hello from file {} at line {}")"#,
file!(),
line!(),
)
.as_str(),
);
let div = Div::builder().attr("class", "light-theme").append_child(
P::builder()
.attr("class", "light-theme")
.append_child(TextContent::text("It Works!")),
);
let body = HtmlBody::new().script(script1).append_child(div);
let script2 = HtmlScript::new(
format!(
r#"console.log("Hello from file {} at line {}")"#,
file!(),
line!(),
)
.as_str(),
);
let html = Html::new()
.head(title)
.add_style(style)
.add_script(script2)
.body(body);
#[cfg(feature = "debug")]
dbg!(&html);
println!("{html}");
}
sourcepub fn add_script(self, script: HtmlScript<'a>) -> Html<'a>
pub fn add_script(self, script: HtmlScript<'a>) -> Html<'a>
Examples found in repository?
examples/getting_started.rs (line 37)
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
fn main() {
let title = HtmlHeadItem::new("<title>It works!</title>");
let style = HtmlStyle::new("body { color: #000000; }");
let script1 = HtmlScript::new(
format!(
r#"console.log("Hello from file {} at line {}")"#,
file!(),
line!(),
)
.as_str(),
);
let div = Div::builder().attr("class", "light-theme").append_child(
P::builder()
.attr("class", "light-theme")
.append_child(TextContent::text("It Works!")),
);
let body = HtmlBody::new().script(script1).append_child(div);
let script2 = HtmlScript::new(
format!(
r#"console.log("Hello from file {} at line {}")"#,
file!(),
line!(),
)
.as_str(),
);
let html = Html::new()
.head(title)
.add_style(style)
.add_script(script2)
.body(body);
#[cfg(feature = "debug")]
dbg!(&html);
println!("{html}");
}
sourcepub fn body(self, body: HtmlBody<'a>) -> Html<'a>
pub fn body(self, body: HtmlBody<'a>) -> Html<'a>
Examples found in repository?
examples/getting_started.rs (line 38)
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
fn main() {
let title = HtmlHeadItem::new("<title>It works!</title>");
let style = HtmlStyle::new("body { color: #000000; }");
let script1 = HtmlScript::new(
format!(
r#"console.log("Hello from file {} at line {}")"#,
file!(),
line!(),
)
.as_str(),
);
let div = Div::builder().attr("class", "light-theme").append_child(
P::builder()
.attr("class", "light-theme")
.append_child(TextContent::text("It Works!")),
);
let body = HtmlBody::new().script(script1).append_child(div);
let script2 = HtmlScript::new(
format!(
r#"console.log("Hello from file {} at line {}")"#,
file!(),
line!(),
)
.as_str(),
);
let html = Html::new()
.head(title)
.add_style(style)
.add_script(script2)
.body(body);
#[cfg(feature = "debug")]
dbg!(&html);
println!("{html}");
}
pub fn is_complete(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Html<'a>
impl<'a> !RefUnwindSafe for Html<'a>
impl<'a> !Send for Html<'a>
impl<'a> !Sync for Html<'a>
impl<'a> Unpin for Html<'a>
impl<'a> !UnwindSafe for Html<'a>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more