summaryrefslogtreecommitdiffstats
path: root/third_party/rust/tokio/src/doc
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/rust/tokio/src/doc')
-rw-r--r--third_party/rust/tokio/src/doc/mod.rs23
-rw-r--r--third_party/rust/tokio/src/doc/os.rs65
2 files changed, 88 insertions, 0 deletions
diff --git a/third_party/rust/tokio/src/doc/mod.rs b/third_party/rust/tokio/src/doc/mod.rs
new file mode 100644
index 0000000000..7992fc6bc6
--- /dev/null
+++ b/third_party/rust/tokio/src/doc/mod.rs
@@ -0,0 +1,23 @@
+//! Types which are documented locally in the Tokio crate, but does not actually
+//! live here.
+//!
+//! **Note** this module is only visible on docs.rs, you cannot use it directly
+//! in your own code.
+
+/// The name of a type which is not defined here.
+///
+/// This is typically used as an alias for another type, like so:
+///
+/// ```rust,ignore
+/// /// See [some::other::location](https://example.com).
+/// type DEFINED_ELSEWHERE = crate::doc::NotDefinedHere;
+/// ```
+///
+/// This type is uninhabitable like the [`never` type] to ensure that no one
+/// will ever accidentally use it.
+///
+/// [`never` type]: https://doc.rust-lang.org/std/primitive.never.html
+#[derive(Debug)]
+pub enum NotDefinedHere {}
+
+pub mod os;
diff --git a/third_party/rust/tokio/src/doc/os.rs b/third_party/rust/tokio/src/doc/os.rs
new file mode 100644
index 0000000000..9404d4491f
--- /dev/null
+++ b/third_party/rust/tokio/src/doc/os.rs
@@ -0,0 +1,65 @@
+//! See [std::os](https://doc.rust-lang.org/std/os/index.html).
+
+/// Platform-specific extensions to `std` for Windows.
+///
+/// See [std::os::windows](https://doc.rust-lang.org/std/os/windows/index.html).
+pub mod windows {
+ /// Windows-specific extensions to general I/O primitives.
+ ///
+ /// See [std::os::windows::io](https://doc.rust-lang.org/std/os/windows/io/index.html).
+ pub mod io {
+ /// See [std::os::windows::io::RawHandle](https://doc.rust-lang.org/std/os/windows/io/type.RawHandle.html)
+ pub type RawHandle = crate::doc::NotDefinedHere;
+
+ /// See [std::os::windows::io::AsRawHandle](https://doc.rust-lang.org/std/os/windows/io/trait.AsRawHandle.html)
+ pub trait AsRawHandle {
+ /// See [std::os::windows::io::AsRawHandle::as_raw_handle](https://doc.rust-lang.org/std/os/windows/io/trait.AsRawHandle.html#tymethod.as_raw_handle)
+ fn as_raw_handle(&self) -> RawHandle;
+ }
+
+ /// See [std::os::windows::io::FromRawHandle](https://doc.rust-lang.org/std/os/windows/io/trait.FromRawHandle.html)
+ pub trait FromRawHandle {
+ /// See [std::os::windows::io::FromRawHandle::from_raw_handle](https://doc.rust-lang.org/std/os/windows/io/trait.FromRawHandle.html#tymethod.from_raw_handle)
+ unsafe fn from_raw_handle(handle: RawHandle) -> Self;
+ }
+
+ /// See [std::os::windows::io::RawSocket](https://doc.rust-lang.org/std/os/windows/io/type.RawSocket.html)
+ pub type RawSocket = crate::doc::NotDefinedHere;
+
+ /// See [std::os::windows::io::AsRawSocket](https://doc.rust-lang.org/std/os/windows/io/trait.AsRawSocket.html)
+ pub trait AsRawSocket {
+ /// See [std::os::windows::io::AsRawSocket::as_raw_socket](https://doc.rust-lang.org/std/os/windows/io/trait.AsRawSocket.html#tymethod.as_raw_socket)
+ fn as_raw_socket(&self) -> RawSocket;
+ }
+
+ /// See [std::os::windows::io::FromRawSocket](https://doc.rust-lang.org/std/os/windows/io/trait.FromRawSocket.html)
+ pub trait FromRawSocket {
+ /// See [std::os::windows::io::FromRawSocket::from_raw_socket](https://doc.rust-lang.org/std/os/windows/io/trait.FromRawSocket.html#tymethod.from_raw_socket)
+ unsafe fn from_raw_socket(sock: RawSocket) -> Self;
+ }
+
+ /// See [std::os::windows::io::IntoRawSocket](https://doc.rust-lang.org/std/os/windows/io/trait.IntoRawSocket.html)
+ pub trait IntoRawSocket {
+ /// See [std::os::windows::io::IntoRawSocket::into_raw_socket](https://doc.rust-lang.org/std/os/windows/io/trait.IntoRawSocket.html#tymethod.into_raw_socket)
+ fn into_raw_socket(self) -> RawSocket;
+ }
+
+ /// See [std::os::windows::io::BorrowedHandle](https://doc.rust-lang.org/std/os/windows/io/struct.BorrowedHandle.html)
+ pub type BorrowedHandle<'handle> = crate::doc::NotDefinedHere;
+
+ /// See [std::os::windows::io::AsHandle](https://doc.rust-lang.org/std/os/windows/io/trait.AsHandle.html)
+ pub trait AsHandle {
+ /// See [std::os::windows::io::AsHandle::as_handle](https://doc.rust-lang.org/std/os/windows/io/trait.AsHandle.html#tymethod.as_handle)
+ fn as_handle(&self) -> BorrowedHandle<'_>;
+ }
+
+ /// See [std::os::windows::io::BorrowedSocket](https://doc.rust-lang.org/std/os/windows/io/struct.BorrowedSocket.html)
+ pub type BorrowedSocket<'socket> = crate::doc::NotDefinedHere;
+
+ /// See [std::os::windows::io::AsSocket](https://doc.rust-lang.org/std/os/windows/io/trait.AsSocket.html)
+ pub trait AsSocket {
+ /// See [std::os::windows::io::AsSocket::as_socket](https://doc.rust-lang.org/std/os/windows/io/trait.AsSocket.html#tymethod.as_socket)
+ fn as_socket(&self) -> BorrowedSocket<'_>;
+ }
+ }
+}