pub fn paired_future_callback<T>() -> (Box<dyn FnOnce(T) + Send>, futures_oneshot::Receiver<T>)
where
    T: Send + 'static,
{
    let (tx, future) = futures_oneshot::channel::<T>();
    let callback = Box::new(move |result| {
        let r = tx.send(result);
        if r.is_err() {
            warn!("paired_future_callback: Failed to send result to the future rx, discarded.");
        }
    });
    (callback, future)
}
/// Generates a paired future and callback so that when callback is being called, its result
/// is automatically passed as a future result.
Generates a paired future and callback so that when callback is being called, its result
is automatically passed as a future result.
Generates a paired future and callback so that when callback is being called its result is automatically passed as a future result .
pub fn paired_future_callback<T>() -> (Box<dyn FnOnce(T) + Send>, futures_oneshot::Receiver<T>)
where
    T: Send + 'static,
{
    let (tx, future) = futures_oneshot::channel::<T>();
    let callback = Box::new(move |result| {
        let r = tx.send(result);
        if r.is_err() {
            warn!("paired_future_callback: Failed to send result to the future rx, discarded.");
        }
    });
    (callback, future)
}
pub fn paired_future_callback < T > ( ) -> ( Box < dyn FnOnce ( T ) + Send > , futures_oneshot :: Receiver < T > ) where T : Send + ' static , { let ( tx , future ) = futures_oneshot :: channel :: < T > ( ) ; let callback = Box :: new ( move | result | { let r = tx . send ( result ) ; if r . is_err ( ) { warn ! ( " " ) ; } } ) ; ( callback , future ) }
Generates a paired future and callback so that when callback is being called, its result
is automatically passed as a future result.
Generates a paired future and callback so that when callback is being called its result is automatically passed as a future result .