Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct Foo<'a> {
- r:&'a str,
- }
- impl<'a> Foo<'a> {
- fn new(s: &'a str) -> Foo<'a> {
- Foo {
- r:s
- }
- }
- }
- #[derive(Default)]
- struct Foos<'s> {
- r: Vec<&'s str>
- }
- impl<'s> Foos<'s> {
- fn add<'a : 's>(&mut self, f: Foo<'a>) {
- self.r.push(f.r);
- }
- }
- fn main() {
- let mut foos = Foos::<'static>::default();
- foos.add(Foo::new("foo"));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement