pub struct Foo<S>(S);
impl<S: AsRef<S>> Foo<S> {
fn as_str(&self) -> &str { s.as_ref() }
}
なんだけど、これ Foo<&'a str> からでも &'b str (where Foo: 'b, 'a: 'b) しか返せなくて、そこは &'a str を返してあげたいよねというのが問題の本質
pub struct Foo<S>(S);
impl<S: AsRef<S>> Foo<S> {
fn as_str(&self) -> &str { s.as_ref() }
}
なんだけど、これ Foo<&'a str> からでも &'b str (where Foo: 'b, 'a: 'b) しか返せなくて、そこは &'a str を返してあげたいよねというのが問題の本質
GNU social JP is a social network, courtesy of GNU social JP管理人. It runs on GNU social, version 2.0.2-dev, available under the GNU Affero General Public License.
All GNU social JP content and data are available under the Creative Commons Attribution 3.0 license.