2 ms·
> * String returns str. Typed that out too fast, yes, that's my problem. * String is one thing but String.deref() is another. But * is the dereference operator
by ComputerGuru 9y ago
> * String returns str.
Typed that out too fast, yes, that's my problem. * String is one thing but String.deref() is another. But * is the dereference operator. Operator overloading ftw ;)
> What you're looking for is TryFrom/TryInto which are still not done 2 years into the RFC: https://github.com/sfackler/rfcs/blob/try-from/text/0000-try.. https://github.com/sfackler/rfcs/blob/try-from/text/0000-try....
Sorry, yes, I actually opened an issue with my suggestions regarding that one with particular focus on the fallible vs infallible nature: https://github.com/rust-lang/rfcs/issues/2143 https://github.com/rust-lang/rfcs/issues/2143
- masklinn 9y ago> Typed that out too fast, yes, that's my problem. * String is one thing but String.deref() is another. But * is the dereference operator. They're the same thing, Deref::deref() is just the operation which underlies the dereferencing operator. Either way I don't see what's problematic about a string buffer deref'ing to a string.