summaryrefslogtreecommitdiff
path: root/vendor/hyper/src/rt/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/hyper/src/rt/mod.rs')
-rw-r--r--vendor/hyper/src/rt/mod.rs42
1 files changed, 42 insertions, 0 deletions
diff --git a/vendor/hyper/src/rt/mod.rs b/vendor/hyper/src/rt/mod.rs
new file mode 100644
index 00000000..de67c3fc
--- /dev/null
+++ b/vendor/hyper/src/rt/mod.rs
@@ -0,0 +1,42 @@
+//! Runtime components
+//!
+//! The traits and types within this module are used to allow plugging in
+//! runtime types. These include:
+//!
+//! - Executors
+//! - Timers
+//! - IO transports
+
+pub mod bounds;
+mod io;
+mod timer;
+
+pub use self::io::{Read, ReadBuf, ReadBufCursor, Write};
+pub use self::timer::{Sleep, Timer};
+
+/// An executor of futures.
+///
+/// This trait allows Hyper to abstract over async runtimes. Implement this trait for your own type.
+///
+/// # Example
+///
+/// ```
+/// # use hyper::rt::Executor;
+/// # use std::future::Future;
+/// #[derive(Clone)]
+/// struct TokioExecutor;
+///
+/// impl<F> Executor<F> for TokioExecutor
+/// where
+/// F: Future + Send + 'static,
+/// F::Output: Send + 'static,
+/// {
+/// fn execute(&self, future: F) {
+/// tokio::spawn(future);
+/// }
+/// }
+/// ```
+pub trait Executor<Fut> {
+ /// Place the future into the executor to be run.
+ fn execute(&self, fut: Fut);
+}