String gets all relevant str methods from Deref; it has some additional methods, but it should largely be shared.
> Why can't they be compared for equality,
Hm? They both compare just fine with ==.
String gets all relevant str methods from Deref; it has some additional methods, but it should largely be shared.
> Why can't they be compared for equality,
Hm? They both compare just fine with ==.
I get why that's different, but it would be great if the type system could figure that out, so that the literal Some("foo") could be an Option<String> if necessary. Maybe I'm still being spoiled by Haskell's OverloadedStrings.
foo() -> Option<String>
foo().as_ref() == Some("str")But yeah, it would be nice if Rust had better ergonomics regarding coercing the insides of wrapper types. Though I'm not sure how exactly that would work.
There are pretty rough type inference issues preventing this impl from existing. Too many people are doing `opt == None` & the compiler would no longer be able to infer the type of None. (You should not be one of them, just call `is_none()` instead)
I'd like to see this impl some day but its not clear how to make it happen.
Maybe you were running into something else?