You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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, &CStrs 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.
The text was updated successfully, but these errors were encountered:
Would you mind updating the title to something that describes the desired action/behavior? It doesn't make much sense to be describing a problem with behavior if that behavior doesn't exist at all 🙂
And if #105723 is stabilized and closed, this will be the only place tracking that idea
Initial comment
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 aFrom<&'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 achar
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.
The text was updated successfully, but these errors were encountered: