diff --git a/src/client/conn.rs b/src/client/conn.rs index 3d0f15a74e..fcc24407f3 100644 --- a/src/client/conn.rs +++ b/src/client/conn.rs @@ -10,10 +10,11 @@ use std::fmt; use std::marker::PhantomData; use std::mem; +use std::sync::Arc; use bytes::Bytes; use futures::{Async, Future, Poll}; -use futures::future::{self, Either}; +use futures::future::{self, Either, Executor}; use tokio_io::{AsyncRead, AsyncWrite}; use body::Payload; @@ -441,6 +442,15 @@ impl Builder { self } + /// Provide an executor to execute background HTTP2 tasks. + pub fn executor(&mut self, exec: E) -> &mut Builder + where + E: Executor + Send>> + Send + Sync + 'static, + { + self.exec = Exec::Executor(Arc::new(exec)); + self + } + pub(super) fn h1_writev(&mut self, enabled: bool) -> &mut Builder { self.h1_writev = enabled; self