Example with lifetimes specified
This commit is contained in:
		@@ -6,7 +6,11 @@ fn main() {
 | 
			
		||||
    println!("The longest string is {result}");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
fn longest(a: &str, b: &str) -> &str {
 | 
			
		||||
fn longest<'a, 'b, 'out>(a: &'a str, b: &'b str) -> &'out str
 | 
			
		||||
where
 | 
			
		||||
    'a: 'out,
 | 
			
		||||
    'b: 'out,
 | 
			
		||||
{
 | 
			
		||||
    if a.len() > b.len() {
 | 
			
		||||
        a
 | 
			
		||||
    } else {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user