Split tokio-threadpool lib.rs into files (#233)

* Builder -> src/builder.rs
* Callback -> src/callback.rs
* Config -> src/config.rs
* Futures2Wake -> src/futures2_wake.rs
* Inner -> src/inner.rs
* Notifier-> src/notifier.rs
* Sender -> src/sender.rs
* Shutdown -> src/shutdown.rs
* ShutdownTask -> src/shutdown_task.rs
* SleepStack -> src/sleep_stack.rs
* State -> src/state.rs
* ThreadPool -> src/thread_pool.rs
* Worker -> src/worker.rs
* WorkerEntry -> src/worker_entry.rs
* WorkerState -> src/worker_state.rs
This commit is contained in:
Roman
2018-03-27 15:56:21 -07:00
committed by Carl Lerche
parent a612736f54
commit ad189826f4
17 changed files with 2374 additions and 2257 deletions
+29
View File
@@ -0,0 +1,29 @@
use worker::Worker;
use std::fmt;
use std::sync::Arc;
use tokio_executor::Enter;
#[derive(Clone)]
pub(crate) struct Callback {
f: Arc<Fn(&Worker, &mut Enter) + Send + Sync>,
}
impl Callback {
pub fn new<F>(f: F) -> Self
where F: Fn(&Worker, &mut Enter) + Send + Sync + 'static
{
Callback { f: Arc::new(f) }
}
pub fn call(&self, worker: &Worker, enter: &mut Enter) {
(self.f)(worker, enter)
}
}
impl fmt::Debug for Callback {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
write!(fmt, "Fn")
}
}