Hi. I’m trying to implement
join filter in templating library called askama. The library compiles templates into Rust code during compile-time, so there are bits of codegen with
syn involved. Given that, the function that represents
join filter should be able to accept different types of iterables and references to them. The problem I’m having can be seen by running this gist in playground. Because of codegen we can’t avoid double ref (
&&slice). Is there a way to get around this while keeping the code on 27th line as much unchanged as possible?
P.S someone on IRC suggested this, but it doesn’t play well with type inference, has Copy it in (that can probably be avoided?) and therefore doesn’t suit our needs.