Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct Bar<'a, 'b>{
- a: &'a mut f64,
- b: &'b mut String,
- }
- impl<'a,'b> Bar<'a,'b>{
- pub fn new(a: &'a mut f64, b: &'b mut String) -> Self{
- Bar{
- a,
- b,
- }
- }
- }
- struct Foo<'ba, 'bb>{
- a: usize,
- b: f64,
- c: String,
- d: Bar<'ba, 'bb>
- }
- impl<'ba, 'bb> Foo<'ba, 'bb>{
- pub fn new() -> Foo<'ba, 'bb>{
- let a: usize = 0;
- let b: f64 = 0.0;
- let c: String = "Foobar".to_string();
- Foo{
- a,
- b,
- c,
- d: Bar::new(&mut b, &mut c)
- }
- }
- }
- fn main() {}
Add Comment
Please, Sign In to add comment