Struct email::thread_pool::ThreadPool
source · pub struct ThreadPool<C: ThreadPoolContext> {
tx: UnboundedSender<ThreadPoolTask<C>>,
rx: Arc<Mutex<UnboundedReceiver<ThreadPoolTask<C>>>>,
threads: Vec<JoinHandle<Result<()>>>,
}
Expand description
The thread pool.
Fields§
§tx: UnboundedSender<ThreadPoolTask<C>>
Channel used by the pool.
This channel is used to send tasks to threads.
rx: Arc<Mutex<UnboundedReceiver<ThreadPoolTask<C>>>>
Channel used by threads.
Only one thread can receive a task at a time. When a thread receives a task, it releases the lock and a new thread can receive the next task.
threads: Vec<JoinHandle<Result<()>>>
The list of threads spawned by the pool.
Implementations§
source§impl<C> ThreadPool<C>where
C: ThreadPoolContext + 'static,
impl<C> ThreadPool<C>where
C: ThreadPoolContext + 'static,
Auto Trait Implementations§
impl<C> Freeze for ThreadPool<C>
impl<C> !RefUnwindSafe for ThreadPool<C>
impl<C> Send for ThreadPool<C>
impl<C> Sync for ThreadPool<C>
impl<C> Unpin for ThreadPool<C>
impl<C> !UnwindSafe for ThreadPool<C>
Blanket Implementations§
source§impl<Src, Scheme> ApproxFrom<Src, Scheme> for Srcwhere
Scheme: ApproxScheme,
impl<Src, Scheme> ApproxFrom<Src, Scheme> for Srcwhere
Scheme: ApproxScheme,
source§fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
Convert the given value into an approximately equivalent representation.
source§impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Srcwhere
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Srcwhere
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
§type Err = <Dst as ApproxFrom<Src, Scheme>>::Err
type Err = <Dst as ApproxFrom<Src, Scheme>>::Err
The error type produced by a failed conversion.
source§fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
Convert the subject into an approximately equivalent representation.
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T, Dst> ConvAsUtil<Dst> for T
impl<T, Dst> ConvAsUtil<Dst> for T
source§impl<T> ConvUtil for T
impl<T> ConvUtil for T
source§fn approx_as<Dst>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst>,
fn approx_as<Dst>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst>,
Approximate the subject to a given type with the default scheme.
source§fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>
fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>
Approximate the subject to a given type with a specific scheme.