Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // str is string slice type: &[]
- fn borrow_to_a_friend(str: &str) {
- borrow_to_a_friends_friend(&str.as_bytes());
- }
- fn borrow_to_a_friends_friend(_buf: &[u8]){}
- fn main() {
- // Move temporary to book_title
- let book_title = String::from("Alice in Wonderland");
- // Borrow a string slice reference here
- borrow_to_a_friend(&book_title);
- }
Add Comment
Please, Sign In to add comment