I'm wondering if there is a way to name the type (ideally) or somehow reduce the repetition here, specifically the closure arguments to page. The other places are not important.
I found the unstable trait_alias feature, which maybe does more than I need. I need something on stable though, so I'm wondering if there's a way to achieve that for my use case.
Also, this isn't necessarily related to the problem, but unless you're writing macro code it's often easier to use std::io::{Write, Result} at the top of the file instead of using their fully-qualified paths.
Usually it's pretty obvious that anything involving a Write trait will be using things from std::io, so you can improve readability by removing the leading ::std::io::'s.
If you're using macros to generate the various textual elements you might consider (possibly zero-sized) creating structs which implement Render.
That way users can see what elements are available by viewing API docs, although that's probably not necessary if the closures are temporaries and the main way you generate the writes is by invoking the macro directly.
Thanks for the suggestion -- though if I understand correctly it won't apply to my use case (I need to optionally capture local environment). It's just an experiment so far, but it's open source if you're curious: qtpl - Rust!