Ning Sun

Results 223 comments of Ning Sun

For helper returning `Result` I would recommend to use `impl HelperDef ` and implement `call_inner` directly: https://docs.rs/handlebars/latest/handlebars/trait.HelperDef.html#method.call_inner I will add an example for this use case.

You can still reuse this as an example of defining helper with API that exposes the `Result`: https://github.com/sunng87/handlebars-rust/blob/master/examples/error.rs#L20

changes to adopt Valuable: - [ ] Update `Context` API to hold a borrowed reference of any `T: Valuable`, currently it owns a converted `serde_json::Value` - [ ] Update `Registry`...

Can you use an `Arc` for this?

I'm afraid generic parameters may not work for this. Handlebars-rust uses a lot of dynamic dispatch in render and helper API, which makes `helpers` field not clone-able. I will think...

By the way, I have made `Registry` clone-able in #395

hi @flxo , this looks like a good and convenient way for accessing json value, with type-safe guarantee. But it has a `clone` which I hope we can avoid in...

By the way, how about adding a helper function to `ContextJson` that returns deserialized typed data? We can avoid the clone in this way. And I think it actually helps.

May I know your use case for this? Since `@partial-block` is an internal mechanism in handlebars. Exposing these API may allow developers to change its meaning of it

@mkantor Thanks for your clarification. How about using `set_partial` from `RenderContext` to register the template as a partial in your helper? The only drawback I think is you cannot use...