feat(client): add client::conn::Builder::executor method

This commit is contained in:
Sean McArthur
2018-11-16 15:33:34 -08:00
parent 30870029b9
commit 95446cc338

View File

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