pub fn try_send<F>(&self, f: F) -> Result<(), SendError>
    where
        F: FnOnce(TaskContext) -> NeonResult<()> + Send + 'static,
    {
        let callback = Box::new(move |env| {
            let env = unsafe { std::mem::transmute(env) };

            // Note: It is sufficient to use `TaskContext`'s `InheritedHandleScope` because
            // N-API creates a `HandleScope` before calling the callback.
            TaskContext::with_context(env, move |cx| {
                let _ = f(cx);
            });
        });

        self.state.tsfn.call(callback, None).map_err(|_| SendError)
    }
/// Schedules a closure to execute on the JavaScript thread that created this Channel
/// Returns an `Error` if the task could not be scheduled.
///
/// See [`SendError`] for additional details on failure causes.
Schedules a closure to execute on the JavaScript thread that created this Channel
Returns an `Error` if the task could not be scheduled.

See [`SendError`] for additional details on failure causes.
Schedules a closure to execute on the JavaScript thread that created this Channel Returns an ` Error ` if the task could not be scheduled . See [ ` SendError ` ] for additional details on failure causes .
pub fn try_send<F>(&self, f: F) -> Result<(), SendError>
    where
        F: FnOnce(TaskContext) -> NeonResult<()> + Send + 'static,
    {
        let callback = Box::new(move |env| {
            let env = unsafe { std::mem::transmute(env) };
            // Note: It is sufficient to use `TaskContext`'s `InheritedHandleScope` because
            // N-API creates a `HandleScope` before calling the callback.
            TaskContext::with_context(env, move |cx| {
                let _ = f(cx);
            });
        });
        self.state.tsfn.call(callback, None).map_err(|_| SendError)
    }
pub fn try_send < F > ( & self , f : F ) -> Result < ( ) , SendError > where F : FnOnce ( TaskContext ) -> NeonResult < ( ) > + Send + ' static , { let callback = Box :: new ( move | env | { let env = unsafe { std :: mem :: transmute ( env ) } ; // Note: It is sufficient to use `TaskContext`'s `InheritedHandleScope` because // N-API creates a `HandleScope` before calling the callback. TaskContext :: with_context ( env , move | cx | { let _ = f ( cx ) ; } ) ; } ) ; self . state . tsfn . call ( callback , None ) . map_err ( | _ | SendError ) }
Schedules a closure to execute on the JavaScript thread that created this Channel
Returns an `Error` if the task could not be scheduled.
Schedules a closure to execute on the JavaScript thread that created this Channel Returns an ` Error ` if the task could not be scheduled .
&self
f
F