Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. fn main() {
  2. let hello = Some("hello");
  3. let _switcheroo = hello.map(str::to_string); //ok
  4.  
  5. let hello = Some("hello".to_string());
  6. let _switcheroo = hello.map(String::as_str); //not ok
  7. }
  8.  
  9. let hello = Some("hello".to_string());
  10. let _switcheroo = hello.as_ref().map(String::as_str); //ok
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement