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
{{ message }}
Repository navigation
Consider adding starts_with method for OsStr #49816
When parsing arguments, one often wants to know whether the argument starts with "--" or "-". At the same time, args_os() is more robust approach because it allows specifying all paths OS allows.
However, since there's no starts_with method, this is impossible on Windows and requires OsStrExt trait with converting to byte slice on Unix. An imperfect workaround would be attempting to convert to &str and assume false if conversion fails (hoping argument names are sane - not containing non-ASCII chars).
Similarly, ends_with could be added.
I hope this doesn't need RFC, since it should be a very small and easy change.
Another thing that comes to my mind: arguments like --foo=bar can't be parsed - this requires slicing too.
Activity
clarfonthey commentedon Apr 9, 2018
This is a duplicate of #49802; an RFC was proposed for this and it just has to be implemented. :)
Kixunil commentedon Apr 9, 2018
Weird that I didn't find it using Google. Thanks!
I'm closing in favor of that one.