Skip to content

Commit

Permalink
minor Exec cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmonstar committed Nov 16, 2023
1 parent 8d292e1 commit 14013f9
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 17 deletions.
6 changes: 3 additions & 3 deletions src/client/legacy/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1285,7 +1285,7 @@ impl Builder {
///
/// # Cargo Feature
///
/// Requires the `runtime` cargo feature to be enabled.
/// Requires the `tokio` cargo feature to be enabled.
#[cfg(feature = "tokio")]
#[cfg(feature = "http2")]
#[cfg_attr(docsrs, doc(cfg(feature = "http2")))]
Expand All @@ -1306,7 +1306,7 @@ impl Builder {
///
/// # Cargo Feature
///
/// Requires the `runtime` cargo feature to be enabled.
/// Requires the `tokio` cargo feature to be enabled.
#[cfg(feature = "tokio")]
#[cfg(feature = "http2")]
#[cfg_attr(docsrs, doc(cfg(feature = "http2")))]
Expand All @@ -1326,7 +1326,7 @@ impl Builder {
///
/// # Cargo Feature
///
/// Requires the `runtime` cargo feature to be enabled.
/// Requires the `tokio` cargo feature to be enabled.
#[cfg(feature = "tokio")]
#[cfg(feature = "http2")]
#[cfg_attr(docsrs, doc(cfg(feature = "http2")))]
Expand Down
14 changes: 1 addition & 13 deletions src/common/exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ pub(crate) type BoxSendFuture = Pin<Box<dyn Future<Output = ()> + Send>>;
// Either the user provides an executor for background tasks, or we use
// `tokio::spawn`.
#[derive(Clone)]
pub enum Exec {
Default,
pub(crate) enum Exec {
Executor(Arc<dyn Executor<BoxSendFuture> + Send + Sync>),
}

Expand All @@ -31,17 +30,6 @@ impl Exec {
F: Future<Output = ()> + Send + 'static,
{
match *self {
Exec::Default => {
#[cfg(feature = "tcp")]
{
tokio::task::spawn(fut);
}
#[cfg(not(feature = "tcp"))]
{
// If no runtime, we need an executor!
panic!("executor must be set")
}
}
Exec::Executor(ref e) => {
e.execute(Box::pin(fut));
}
Expand Down
2 changes: 1 addition & 1 deletion src/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ macro_rules! ready {
}

pub(crate) use ready;
pub mod exec;
pub(crate) mod exec;
#[cfg(feature = "client")]
mod lazy;
pub(crate) mod rewind;
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
pub mod client;
mod common;
pub mod rt;
#[cfg(feature = "server")]
pub mod server;

mod error;

0 comments on commit 14013f9

Please sign in to comment.