1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use crate::{pool_item::PoolItem, ThreadPool};

impl<P> Drop for ThreadPool<P>
where
    P: PoolItem,
{
    /// implement drop to shutdown all of the thread pools threads
    fn drop(&mut self) {
        self.shutdown();
    }
}

#[cfg(test)]
mod tests {
    use crate::{samples::*, ThreadPool};

    #[test]
    fn one_thread_drop_clean_shutdown_as_expected() {
        let target = ThreadPool::<Randoms>::new(1);

        drop(target);
    }
}