Ah, yeah, I guess I missed that about ToOwned.
As of now though (I didn’t realize this before), Into<Cow> does actually work.
fn new<A, B, I1, I2, I3, C>(some_str1: A, some_str2: Option<B>, vec_things: C) where
A: Into<Cow<'static, str>>,
B: Into<Cow<'static, str>>,
I1: Into<Cow<'static, str>>,
I2: Into<Cow<'static, str>>,
I3: Into<Cow<'static, str>>,
C: Iterator<Item=(I1, Option<I2>, I3)> {
let string1 = some_str1.into().into_owned();
let string2 = some_str2.map(|x| x.into().into_owned());
let things = vec_things.map(|(t1, t2, t3)| (
t1.into().into_owned(),
t2.map(|x| x.into().into_owned()),
t3.into().into_owned(),
)).collect::<Vec<(String, Option<String>, String)>>();
}
new("iq", Some("jabber:client"), vec![("id", None, "bind"),
("type", Some("Something"), "set")].into_iter());
(playpen: http://is.gd/d3iwd4)
For vectors though, it’s true you would need to have them be one type, though I don’t think it’s that much of a restriction to have to have all of the strings either String or &str.