Is it possible to specialize on a static lifetime?
问题 I want to specialize &'static str from &'a str . Something like this: use std::borrow::Cow; struct MyString { inner: Cow<'static, str>, } impl From<&'static str> for MyString { fn from(x: &'static str) -> Self { MyString { inner: Cow::Borrowed(x), } } } impl<T: Into<String>> From<T> for MyString { fn from(x: T) -> Self { MyString { inner: Cow::Owned(x.into()), } } } fn main() { match MyString::from("foo").inner { Cow::Borrowed(..) => (), _ => { panic!(); } } let s = String::from("bar"); match