summary refs log tree commit diff
path: root/src/libstd/process.rs
diff options
context:
space:
mode:
authorAaron Turon <aturon@mozilla.com>2015-03-18 09:14:54 -0700
committerAaron Turon <aturon@mozilla.com>2015-03-23 15:01:45 -0700
commit8389253df0431e58bfe0a8e0e3949d58ebe7400f (patch)
tree816e989b62f4c6b9fb6dc8ea199fe3c2538d2a80 /src/libstd/process.rs
parentb0aad7dd4fad8d7e2e2f877a511a637258949597 (diff)
downloadrust-8389253df0431e58bfe0a8e0e3949d58ebe7400f.tar.gz
rust-8389253df0431e58bfe0a8e0e3949d58ebe7400f.zip
Add generic conversion traits
This commit:

* Introduces `std::convert`, providing an implementation of
RFC 529.

* Deprecates the `AsPath`, `AsOsStr`, and `IntoBytes` traits, all
in favor of the corresponding generic conversion traits.

  Consequently, various IO APIs now take `AsRef<Path>` rather than
`AsPath`, and so on. Since the types provided by `std` implement both
traits, this should cause relatively little breakage.

* Deprecates many `from_foo` constructors in favor of `from`.

* Changes `PathBuf::new` to take no argument (creating an empty buffer,
  as per convention). The previous behavior is now available as
  `PathBuf::from`.

* De-stabilizes `IntoCow`. It's not clear whether we need this separate trait.

Closes #22751
Closes #14433

[breaking-change]
Diffstat (limited to 'src/libstd/process.rs')
-rw-r--r--src/libstd/process.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libstd/process.rs b/src/libstd/process.rs
index 6b09636c1df..d11c3d22144 100644
--- a/src/libstd/process.rs
+++ b/src/libstd/process.rs
@@ -19,8 +19,8 @@ use io::prelude::*;
 use ffi::AsOsStr;
 use fmt;
 use io::{self, Error, ErrorKind};
-use path::AsPath;
 use libc;
+use path;
 use sync::mpsc::{channel, Receiver};
 use sys::pipe2::{self, AnonPipe};
 use sys::process2::Process as ProcessImp;
@@ -198,8 +198,8 @@ impl Command {
 
     /// Set the working directory for the child process.
     #[stable(feature = "process", since = "1.0.0")]
-    pub fn current_dir<P: AsPath>(&mut self, dir: P) -> &mut Command {
-        self.inner.cwd(dir.as_path().as_os_str());
+    pub fn current_dir<P: AsRef<path::Path>>(&mut self, dir: P) -> &mut Command {
+        self.inner.cwd(dir.as_ref().as_os_str());
         self
     }