有没有办法返回一个函数并采取没有生命周期的关闭?

时间:2018-07-16 10:35:51

标签: rust

我有这个:

fn with_name<P>(name: &'static str) -> impl Fn(P) -> String
where
    P: Fn(&str) -> Markup,
{
    move |t| render(t(name))
}

我正在寻找使用我的API的方法:

with_name("hi")(|title: &str| html! { ... })

这有效,但是wasm_bindgen无法执行生存期/类型参数。这是过度设计的吗?有更好的方法吗?

0 个答案:

没有答案
相关问题