Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fn main() {
- let hello = Some("hello");
- let _switcheroo = hello.map(str::to_string); //ok
- let hello = Some("hello".to_string());
- let _switcheroo = hello.map(String::as_str); //not ok
- }
- let hello = Some("hello".to_string());
- let _switcheroo = hello.as_ref().map(String::as_str); //ok
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement