Multiple lifetimes

Both of these are acceptable to define multiple lifetimes within a function:

fn mylifetime<'a>(life: &'a i32, universe: &'a i32) -> &'a i32 
{ 
     // do something, return an i32 value 
} 

We have two parameters of the lifetime of 'a cast as an i32 value and return an i32 value.

We can also have multiple lifetimes passed in, as follows:

fn mymultilife<'a, 'b>(foo: &'a f32, bar: &'b i32) 
{ 
    // do something 
} 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset