summaryrefslogtreecommitdiffstats
path: root/tokio/tests/support
diff options
context:
space:
mode:
authorCarl Lerche <me@carllerche.com>2019-11-26 16:00:26 -0800
committerGitHub <noreply@github.com>2019-11-26 16:00:26 -0800
commitc146f48f0b4f1fbecb1bed3d5a32222506d50704 (patch)
treefaea0baa1839c87666f19d9d6f1c064515172e64 /tokio/tests/support
parentebf5f37989fd8cc901a771afbe73fecc7b216325 (diff)
fs: impl AsRawFd / AsRawHandle for File (#1827)
This provides the ability to get the raw OS handle for a `File`. The `Into*` variant cannot be provided as `File` needs to maintain ownership of the `File`. The actual handle may have been moved to a background thread.
Diffstat (limited to 'tokio/tests/support')
-rw-r--r--tokio/tests/support/mock_file.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/tokio/tests/support/mock_file.rs b/tokio/tests/support/mock_file.rs
index 7f3beee8..44aa7b3f 100644
--- a/tokio/tests/support/mock_file.rs
+++ b/tokio/tests/support/mock_file.rs
@@ -263,3 +263,17 @@ impl fmt::Debug for File {
fmt.debug_struct("mock::File").finish()
}
}
+
+#[cfg(unix)]
+impl std::os::unix::io::AsRawFd for File {
+ fn as_raw_fd(&self) -> std::os::unix::io::RawFd {
+ unimplemented!();
+ }
+}
+
+#[cfg(windows)]
+impl std::os::windows::io::AsRawHandle for File {
+ fn as_raw_handle(&self) -> std::os::windows::io::RawHandle {
+ unimplemented!();
+ }
+}