Skip to content

Commit

Permalink
avoid Fn* supertraits on Parallel* as they slightly impact type infer…
Browse files Browse the repository at this point in the history
…ence
  • Loading branch information
alecmocatta committed Jul 14, 2020
1 parent ec1e9b8 commit 001b75d
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 8 deletions.
6 changes: 3 additions & 3 deletions amadeus-core/src/par_pipe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ pub trait PipeTask<Source> {
}

macro_rules! pipe {
($pipe:ident $sink:ident $from_sink:ident $send:ident $assert_pipe:ident $assert_sink:ident) => {
#[cfg_attr(not(feature = "doc"), serde_closure::generalize)]
($pipe:ident $sink:ident $from_sink:ident $send:ident $assert_pipe:ident $assert_sink:ident $($meta:meta)*) => {
$(#[$meta])*
#[must_use]
pub trait $pipe<Source> {
type Item;
Expand Down Expand Up @@ -285,4 +285,4 @@ macro_rules! pipe {
}

pipe!(ParallelPipe ParallelSink FromParallelStream Send assert_parallel_pipe assert_parallel_sink);
pipe!(DistributedPipe DistributedSink FromDistributedStream ProcessSend assert_distributed_pipe assert_distributed_sink);
pipe!(DistributedPipe DistributedSink FromDistributedStream ProcessSend assert_distributed_pipe assert_distributed_sink cfg_attr(not(feature = "doc"), serde_closure::generalize));
1 change: 0 additions & 1 deletion amadeus-core/src/par_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,6 @@ pub(crate) fn assert_distributed_stream<T, I: DistributedStream<Item = T>>(i: I)
}

#[async_trait(?Send)]
#[cfg_attr(not(feature = "doc"), serde_closure::generalize)]
#[must_use]
pub trait ParallelStream {
type Item;
Expand Down
2 changes: 0 additions & 2 deletions amadeus-core/src/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ pub trait ProcessPool: Clone + Send + Sync + RefUnwindSafe + UnwindSafe + Unpin
T: ProcessSend + 'static;
}

#[cfg_attr(not(feature = "doc"), serde_closure::generalize)]
pub trait ThreadPool: Clone + Send + Sync + RefUnwindSafe + UnwindSafe + Unpin {
fn threads(&self) -> usize;
fn spawn<F, Fut, T>(&self, work: F) -> BoxFuture<'static, Result<T>>
Expand Down Expand Up @@ -51,7 +50,6 @@ where
}
}

#[cfg_attr(not(feature = "doc"), serde_closure::generalize)]
impl<P: ?Sized> ThreadPool for &P
where
P: ThreadPool,
Expand Down
1 change: 0 additions & 1 deletion src/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ impl ProcessPoolTrait for ThreadPool {
}
}

#[cfg_attr(not(feature = "doc"), serde_closure::generalize)]
impl ThreadPoolTrait for ThreadPool {
fn threads(&self) -> usize {
ThreadPool::threads(self)
Expand Down
1 change: 0 additions & 1 deletion src/pool/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ struct ThreadPoolInner {

#[derive(Debug)]
pub struct ThreadPool(Arc<ThreadPoolInner>);
#[cfg_attr(not(feature = "doc"), serde_closure::generalize)]
impl ThreadPool {
pub fn new(tasks_per_core: Option<usize>) -> io::Result<Self> {
let logical_cores = num_cpus::get();
Expand Down

0 comments on commit 001b75d

Please sign in to comment.