pub struct ThreadPool<E>where
    E: Element,
{ /* private fields */ }
Expand description

This struct represents a pool of threads that can target a particular type of resource (a resource being a struct that implements Element)

In order to allow for distribution over multiple threads each resource must have an id that allows for routing to a particular thread.

It is necessary when request are made

Implementations

This function creates a new ThreadPool

Internally it creates a collection of threads. It has the ability to communicate with the threads via a vec of channels (there is one channel for each spawned thread)

The number of threads is determined by the passed in thread_pool_size

This function sends a request to a worker thread and receives a response back

The request is received as a vec and the responses are received back in a vec

This function requests that the thread pool shutdowns It sends the shutdown message to each of it’s contained PoolThreads The sending of this message should cause the message loop to exit and the thread to end

This function returns the number of threads in the thread pool

Trait Implementations

Formats the value using the given formatter. Read more

implement drop to shutdown all of the thread pools threads

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more