Guest User

Untitled

a guest
May 24th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. // str is string slice type: &[]
  2. fn borrow_to_a_friend(str: &str) {
  3. borrow_to_a_friends_friend(&str.as_bytes());
  4. }
  5.  
  6. fn borrow_to_a_friends_friend(_buf: &[u8]){}
  7.  
  8. fn main() {
  9. // Move temporary to book_title
  10. let book_title = String::from("Alice in Wonderland");
  11.  
  12. // Borrow a string slice reference here
  13. borrow_to_a_friend(&book_title);
  14. }
Add Comment
Please, Sign In to add comment