pub fn try_evaluate<R: Send + 'static, T: Task<R> + 'static>(
        &self,
        task: T,
    ) -> Result<JoinHandle<R>, crossbeam_channel::SendError<Job>> {
        let (sender, receiver) = oneshot::channel::<R>();
        let join_handle = JoinHandle { receiver };
        let job = || {
            let result = task.run();
            // if the receiver was dropped that means the caller was not interested in the result
            let _ignored_result = sender.send(result);
        };

        let execute_attempt = self.try_execute_task(Box::new(job));
        execute_attempt.map(|_| join_handle)
    }
/// Send a new task to the worker threads and return a [`JoinHandle`](struct.JoinHandle.html) that may be used to await
/// the result. This function is responsible for sending the message through the channel and creating new
/// workers if needed. If the current worker count is lower than the core pool size this function will always
/// create a new worker. If the current worker count is equal to or greater than the core pool size this
/// function only creates a new worker if the worker count is below the max pool size and there are no idle
/// threads.
///
/// When attempting to increment the total worker count before creating a worker fails due to the
/// counter reaching the provided limit (core_size when attempting to create core thread, else
/// max_size) after being incremented by another thread, the pool tries to create
/// a non-core worker instead (if previously trying to create a core worker and no idle
/// worker exists) or sends the task to the channel instead. If incrementing the counter succeeded,
/// either because the current value of the counter matched the expected value or because the
/// last observed value was still below the limit, the worker starts with the provided task as
/// initial task and spawns its thread.
///
/// # Errors
///
/// This function might return `crossbeam_channel::SendError` if the sender was dropped unexpectedly.
Send a new task to the worker threads and return a [`JoinHandle`](struct.JoinHandle.html) that may be used to await
the result. This function is responsible for sending the message through the channel and creating new
workers if needed. If the current worker count is lower than the core pool size this function will always
create a new worker. If the current worker count is equal to or greater than the core pool size this
function only creates a new worker if the worker count is below the max pool size and there are no idle
threads.

When attempting to increment the total worker count before creating a worker fails due to the
counter reaching the provided limit (core_size when attempting to create core thread, else
max_size) after being incremented by another thread, the pool tries to create
a non-core worker instead (if previously trying to create a core worker and no idle
worker exists) or sends the task to the channel instead. If incrementing the counter succeeded,
either because the current value of the counter matched the expected value or because the
last observed value was still below the limit, the worker starts with the provided task as
initial task and spawns its thread.
Send a new task to the worker threads and return a [ ` JoinHandle ` ] ( struct . JoinHandle . html ) that may be used to await the result . This function is responsible for sending the message through the channel and creating new workers if needed . If the current worker count is lower than the core pool size this function will always create a new worker . If the current worker count is equal to or greater than the core pool size this function only creates a new worker if the worker count is below the max pool size and there are no idle threads . When attempting to increment the total worker count before creating a worker fails due to the counter reaching the provided limit ( core_size when attempting to create core thread else max_size ) after being incremented by another thread the pool tries to create a non - core worker instead ( if previously trying to create a core worker and no idle worker exists ) or sends the task to the channel instead . If incrementing the counter succeeded either because the current value of the counter matched the expected value or because the last observed value was still below the limit the worker starts with the provided task as initial task and spawns its thread .
pub fn try_evaluate<R: Send + 'static, T: Task<R> + 'static>(
        &self,
        task: T,
    ) -> Result<JoinHandle<R>, crossbeam_channel::SendError<Job>> {
        let (sender, receiver) = oneshot::channel::<R>();
        let join_handle = JoinHandle { receiver };
        let job = || {
            let result = task.run();
            // if the receiver was dropped that means the caller was not interested in the result
            let _ignored_result = sender.send(result);
        };
        let execute_attempt = self.try_execute_task(Box::new(job));
        execute_attempt.map(|_| join_handle)
    }
pub fn try_evaluate < R : Send + ' static , T : Task < R > + ' static > ( & self , task : T , ) -> Result < JoinHandle < R > , crossbeam_channel :: SendError < Job > > { let ( sender , receiver ) = oneshot :: channel :: < R > ( ) ; let join_handle = JoinHandle { receiver } ; let job = | | { let result = task . run ( ) ; // if the receiver was dropped that means the caller was not interested in the result let _ignored_result = sender . send ( result ) ; } ; let execute_attempt = self . try_execute_task ( Box :: new ( job ) ) ; execute_attempt . map ( | _ | join_handle ) }
Send a new task to the worker threads and return a [`JoinHandle`](struct.JoinHandle.html) that may be used to await
the result.
Send a new task to the worker threads and return a [ ` JoinHandle ` ] ( struct . JoinHandle . html ) that may be used to await the result .
&self
task
T
&self
task
T
errors
This function might return `crossbeam_channel::SendError` if the sender was dropped unexpectedly.
This function might return ` crossbeam_channel :: SendError ` if the sender was dropped unexpectedly .