Take IntoIterator<AsRef<str>> to be more flexible on input

This commit is contained in:
Félix Saparelli 2021-08-24 20:14:01 +12:00
parent 05afb141b6
commit 33f8b60e46
No known key found for this signature in database
GPG Key ID: B948C4BAE44FC474
1 changed files with 6 additions and 2 deletions

View File

@ -66,8 +66,12 @@ impl RuntimeConfig {
}
/// Set the command to run on action.
pub fn command<'cmd>(&mut self, command: impl IntoIterator<Item = &'cmd str>) -> &mut Self {
self.action.command = command.into_iter().map(|c| c.to_owned()).collect();
pub fn command<I, S>(&mut self, command: I) -> &mut Self
where
I: IntoIterator<Item = S>,
S: AsRef<str>,
{
self.action.command = command.into_iter().map(|c| c.as_ref().to_owned()).collect();
self
}