- Notifications
You must be signed in to change notification settings - Fork88
Open
Description
Current the function is defined as:
fnfrom_args(command_name:&[&str],args:&[&str]) ->Result<Self,EarlyExit>;
This could be changed to:
fnfrom_args<T,U>(command_name:&[T],args:&[U]) ->Result<Self,EarlyExit>whereT:AsRef<str>,U:AsRef<str>;
I think this is backward-incompatible because of type deductions that could now fail.
FromArgs::redact_arg_values
should also be updated if this is done.
Why ?
Current when getting arguments fromstd::env::args_os()
, severalcollect
s and transformations are necessary to go fromIterator<Item = OsStr>
to&[&str]
, which is a little sad.
OsStr
toString
(to_string_lossy
,to_string + unwrap
)- Collect to a vec of
String
- Iter,
as_str
- Collect to a vec of
&str
With the change proposed in this issue, steps 3 and 4 would become unnecessary
Metadata
Metadata
Assignees
Labels
No labels