From 95446cc338f8055539dd3503c482d649f42a531c Mon Sep 17 00:00:00 2001 From: Sean McArthur Date: Fri, 16 Nov 2018 15:33:34 -0800 Subject: [PATCH] feat(client): add client::conn::Builder::executor method --- src/client/conn.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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