about summary refs log tree commit diff
path: root/src/libstd/process.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstd/process.rs')
-rw-r--r--src/libstd/process.rs15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/libstd/process.rs b/src/libstd/process.rs
index 1b1f2291826..d4dbbec1fee 100644
--- a/src/libstd/process.rs
+++ b/src/libstd/process.rs
@@ -345,7 +345,9 @@ impl Command {
     ///         .expect("ls command failed to start");
     /// ```
     #[stable(feature = "process", since = "1.0.0")]
-    pub fn args<S: AsRef<OsStr>>(&mut self, args: &[S]) -> &mut Command {
+    pub fn args<I, S>(&mut self, args: I) -> &mut Command
+        where I: IntoIterator<Item=S>, S: AsRef<OsStr>
+    {
         for arg in args {
             self.arg(arg.as_ref());
         }
@@ -385,8 +387,9 @@ impl Command {
     /// ```no_run
     /// use std::process::{Command, Stdio};
     /// use std::env;
+    /// use std::collections::HashMap;
     ///
-    /// let filtered_env : Vec<(String, String)> =
+    /// let filtered_env : HashMap<String, String> =
     ///     env::vars().filter(|&(ref k, _)|
     ///         k == "TERM" || k == "TZ" || k == "LANG" || k == "PATH"
     ///     ).collect();
@@ -399,11 +402,11 @@ impl Command {
     ///         .spawn()
     ///         .expect("printenv failed to start");
     /// ```
-    #[stable(feature = "command_envs", since = "1.16.0")]
-    pub fn envs<K, V>(&mut self, vars: &[(K, V)]) -> &mut Command
-        where K: AsRef<OsStr>, V: AsRef<OsStr>
+    #[unstable(feature = "command_envs", issue = "38526")]
+    pub fn envs<I, K, V>(&mut self, vars: I) -> &mut Command
+        where I: IntoIterator<Item=(K, V)>, K: AsRef<OsStr>, V: AsRef<OsStr>
     {
-        for &(ref key, ref val) in vars {
+        for (ref key, ref val) in vars {
             self.inner.env(key.as_ref(), val.as_ref());
         }
         self