Guest User

Untitled

a guest
Jul 16th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. struct Bar<'a, 'b>{
  2. a: &'a mut f64,
  3. b: &'b mut String,
  4. }
  5.  
  6. impl<'a,'b> Bar<'a,'b>{
  7. pub fn new(a: &'a mut f64, b: &'b mut String) -> Self{
  8. Bar{
  9. a,
  10. b,
  11. }
  12. }
  13. }
  14.  
  15. struct Foo<'ba, 'bb>{
  16. a: usize,
  17. b: f64,
  18. c: String,
  19. d: Bar<'ba, 'bb>
  20. }
  21.  
  22. impl<'ba, 'bb> Foo<'ba, 'bb>{
  23. pub fn new() -> Foo<'ba, 'bb>{
  24. let a: usize = 0;
  25. let b: f64 = 0.0;
  26. let c: String = "Foobar".to_string();
  27. Foo{
  28. a,
  29. b,
  30. c,
  31. d: Bar::new(&mut b, &mut c)
  32. }
  33. }
  34. }
  35.  
  36. fn main() {}
Add Comment
Please, Sign In to add comment