Open
Description
In the "Rationale and alternatives" section of RFC 3348, it mentions a hypothetical FromStringLiteral
. While I like the idea, it couldn't be as simple as a From<&'static str>
/TryFrom<&'static str>
: error messages would need at least a character offset + string message to be more useful than just "hey, this string contains a problem character". Also, &CStr
s are really more like byte string literals, and that offset would have to be a byte offset, not a char
offset, too.
This probably could justify the existence of such a trait, though. C string literals in particular wouldn't push the boundaries much, but I could see other things like regular expressions benefitting a ton from it.