Skip to content

Instantly share code, notes, and snippets.

@kscz
Created April 5, 2016 01:35
Show Gist options
  • Save kscz/dd50d62a1120440b86d84cd4ff28b18f to your computer and use it in GitHub Desktop.
Save kscz/dd50d62a1120440b86d84cd4ff28b18f to your computer and use it in GitHub Desktop.
fn main() {
let x = String::from("What is love?");
let y = String::from("Baby don't hurt me,");
let ref_y = print_first_return_second(&x, &y);
print!("{}", y);
print!("{}", ref_y);
println!(" no more!");
}
fn print_first_return_second<'a, 'b>(print_me: &'a str, return_me: &'b str) -> &'b str {
println!("{}", print_me);
&return_me[4..]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment