about summary refs log tree commit diff
path: root/src/libstd/sys/windows
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-02-04 11:39:27 +0000
committerbors <bors@rust-lang.org>2016-02-04 11:39:27 +0000
commit7b9d6d3bc8730aa565dbb5e285027443696aef0c (patch)
treec1cb0abb2734d46c4c69ebcdd2887ee364563eb6 /src/libstd/sys/windows
parent9c30f127907a46fbd46534fb929dfeeca515ab0f (diff)
parenta414b61f9279b2806ab92ec17cdd19cf57d59e2f (diff)
downloadrust-7b9d6d3bc8730aa565dbb5e285027443696aef0c.tar.gz
rust-7b9d6d3bc8730aa565dbb5e285027443696aef0c.zip
Auto merge of #31069 - sfackler:file-try-clone, r=alexcrichton
I have it set as stable right now under the rationale that it's extending an existing, stable API to another type in the "obvious" way.

r? @alexcrichton

cc @reem
Diffstat (limited to 'src/libstd/sys/windows')
-rw-r--r--src/libstd/sys/windows/fs.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libstd/sys/windows/fs.rs b/src/libstd/sys/windows/fs.rs
index a8b82ef5f29..e965a4a1d54 100644
--- a/src/libstd/sys/windows/fs.rs
+++ b/src/libstd/sys/windows/fs.rs
@@ -338,6 +338,12 @@ impl File {
         Ok(newpos as u64)
     }
 
+    pub fn duplicate(&self) -> io::Result<File> {
+        Ok(File {
+            handle: try!(self.handle.duplicate(0, true, c::DUPLICATE_SAME_ACCESS)),
+        })
+    }
+
     pub fn handle(&self) -> &Handle { &self.handle }
 
     pub fn into_handle(self) -> Handle { self.handle }