Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct Book{
- title: String,
- }
- fn create_book_and_return_it_with_ownership() -> Book{
- let book: Book = Book {title: String::from("The Title")};
- book
- }
- fn main() {
- let book = create_book_and_return_it_with_ownership();
- println!("Book {}", book.title);
- }
Add Comment
Please, Sign In to add comment