titan_html

Function render

Source
pub fn render(root: Html) -> String
Examples found in repository?
examples/testing.rs (line 41)
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
fn main() {
  let root = Html::with_head(Head::empty()).body_from_iter([
    Link::text("http://localhost:3000", "testing")
      .preload(LinkLoadType::WhenIdle)
      .styles(
        "
          color: blue;
          background-color: red;
        ",
      )
      .add_id("testing")
      .into_tag(),
    Link::text("http://localhost:3000".to_string(), "testing")
      .styles(
        "
          color: blue;
          background-color: red;
        ",
      )
      .into_tag(),
    Div::text("testing")
      .styles(css!(
        "
        background-color: green;
        color: blue;
              "
      ))
      .into_tag(),
  ]);

  println!("{}", titan_html::render(root));
}