Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minor Exec cleanup #54

Merged
merged 1 commit into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;