Debian Codegraph @

examples/partials.rs

raw symbols SCIP
1 extern crate env_loggerrust-analyzer cargo handlebars 5.1.2 env_logger/;
2 extern crate handlebarsrust-analyzer cargo handlebars 5.1.2 handlebars/;
3
4 use handlebarsrust-analyzer cargo handlebars 5.1.2 crate/::Handlebarsrust-analyzer cargo handlebars 5.1.2 registry/Registry#;
5 use serde_jsonrust-analyzer cargo serde_json 1.0.114 crate/::jsonrust-analyzer cargo serde_json 1.0.114 macros/json!;
6 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std error/::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error#;
7
8 fn mainrust-analyzer cargo handlebars 5.1.2 main().() -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error#>> {
9 env_loggerrust-analyzer cargo env_logger 0.11.11 crate/::initrust-analyzer cargo env_logger 0.11.11 logger/init().();
10 let mut handlebars = Handlebarsrust-analyzer cargo handlebars 5.1.2 registry/Registry#::newrust-analyzer cargo handlebars 5.1.2 registry/impl#[`Registry<'reg>`]new().();
11
12 handlebars.register_template_filerust-analyzer cargo handlebars 5.1.2 registry/impl#[`Registry<'reg>`]register_template_file().("template", "./examples/partials/template2.hbs")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
13
14 handlebars.register_template_filerust-analyzer cargo handlebars 5.1.2 registry/impl#[`Registry<'reg>`]register_template_file().("base0", "./examples/partials/base0.hbs")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
15 handlebars.register_template_filerust-analyzer cargo handlebars 5.1.2 registry/impl#[`Registry<'reg>`]register_template_file().("base1", "./examples/partials/base1.hbs")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
16
17 let data0 = jsonrust-analyzer cargo serde_json 1.0.114 macros/json!!({
18 "title": "example 0",
19 "parent": "base0"
20 });
21 let data1 = jsonrust-analyzer cargo serde_json 1.0.114 macros/json!!({
22 "title": "example 1",
23 "parent": "base1"
24 });
25
26 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("Page 0");
27 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{}", handlebars.renderrust-analyzer cargo handlebars 5.1.2 registry/impl#[`Registry<'reg>`]render().("template", &data0)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().);
28 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("=======================================================");
29
30 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("Page 1");
31 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{}", handlebars.renderrust-analyzer cargo handlebars 5.1.2 registry/impl#[`Registry<'reg>`]render().("template", &data1)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().);
32
33 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
34 }