workerbee 0.1.0

A simple, fast, and lightweight task runner for Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/// Worker shutdown controller.
use tokio::sync::oneshot;

/// Dropping the dropper will cause runtime to shutdown.
#[derive(Debug)]
pub struct Dropper {
    pub(crate) close: Option<oneshot::Sender<()>>,
}

impl Drop for Dropper {
    fn drop(&mut self) {
        // Send a signal to say i am dropping.
        self.close.take().map(|v| v.send(()));
    }
}