Debian Codegraph @

examples/quick.rs

raw symbols SCIP
1 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#;
2
3 use handlebarsrust-analyzer cargo handlebars 5.1.2 crate/::Handlebarsrust-analyzer cargo handlebars 5.1.2 registry/Registry#;
4 use serde_jsonrust-analyzer cargo serde_json 1.0.114 crate/::jsonrust-analyzer cargo serde_json 1.0.114 macros/json!;
5
6 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#>> {
7 let mut reg = Handlebarsrust-analyzer cargo handlebars 5.1.2 registry/Registry#::newrust-analyzer cargo handlebars 5.1.2 registry/impl#[`Registry<'reg>`]new().();
8 // render without register
9 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!(
10 "{}",
11 reg.render_templaterust-analyzer cargo handlebars 5.1.2 registry/impl#[`Registry<'reg>`]render_template().("Hello {{name}}", &jsonrust-analyzer cargo serde_json 1.0.114 macros/json!!({"name": "foo"}))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().
12 );
13
14 // register template using given name
15 reg.register_template_stringrust-analyzer cargo handlebars 5.1.2 registry/impl#[`Registry<'reg>`]register_template_string().("tpl_1", "Good afternoon, {{name}}")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
16 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{}", reg.renderrust-analyzer cargo handlebars 5.1.2 registry/impl#[`Registry<'reg>`]render().("tpl_1", &jsonrust-analyzer cargo serde_json 1.0.114 macros/json!!({"name": "foo"}))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().);
17 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
18 }