My Desire

Small demonstration of generic type & injection safe interpolation without variadic generics.

TL;DR

```rust pub use mydesiremacros::interpol;

pub trait TemplateString {

fn accept(self) -> V::Output;

}

pub trait TemplateVisitor { type Output; fn new() -> Self; fn visit_str(&mut self, s: &'static str); fn finish(self) -> Self::Output; }

pub trait TemplateVisit { fn visit(&mut self, value: &T); }

let affect = "frustrated"

let s = interpol!("I'm a {} man" as S); // macro => let s = { // need to generate a unique per-invocation type, but doesn't need to be variadic. struct TS<'a, T0>((&'static str, &'static str), (&'a T0,)); impl<'a, T0, V: mydesire::TemplateVisitor + mydesire::TemplateVisit> mydesire::TemplateString for TS<'a, T0> { fn accept(self) -> V::Output { let mut v = V::new(); v.visitstr(self.0 .0); v.visit(self.1 .0); v.visitstr(self.0 .1); v.finish() } } mydesire::TemplateString::::accept(TS(("I'm a ", " man"), (&affect,))) };

```