async fn reply_or_cancel<T, F>(mut reply: oneshot::Sender<Result<T, BlockchainStateServiceError>>, fut: F)
where F: Future<Output = Result<T, BlockchainStateServiceError>> {
    futures::pin_mut!(fut);
    let either = future::select(poll_fn(|cx| reply.poll_canceled(cx)), fut).await;
    match either {
        Either::Left((_, _)) => { /* Do nothing */ },
        Either::Right((v, _)) => {
            let _ = reply.send(v);
        },
    }
}
/// Polls both `fut` and the oneshot `poll_canceled` function. If the oneshot is cancelled before `fut` resolves, the
/// `fut` is not polled again and the function exits. Otherwise the result of the future is sent on the oneshot.
// TODO: This is how most if not all replies should be sent in services. Make available in service framework.
Polls both `fut` and the oneshot `poll_canceled` function. If the oneshot is cancelled before `fut` resolves, the
`fut` is not polled again and the function exits. Otherwise the result of the future is sent on the oneshot.
TODO: This is how most if not all replies should be sent in services. Make available in service framework.
Polls both ` fut ` and the oneshot ` poll_canceled ` function . If the oneshot is cancelled before ` fut ` resolves the ` fut ` is not polled again and the function exits . Otherwise the result of the future is sent on the oneshot . TODO : This is how most if not all replies should be sent in services . Make available in service framework .
async fn reply_or_cancel<T, F>(mut reply: oneshot::Sender<Result<T, BlockchainStateServiceError>>, fut: F)
where F: Future<Output = Result<T, BlockchainStateServiceError>> {
    futures::pin_mut!(fut);
    let either = future::select(poll_fn(|cx| reply.poll_canceled(cx)), fut).await;
    match either {
        Either::Left((_, _)) => { /* Do nothing */ },
        Either::Right((v, _)) => {
            let _ = reply.send(v);
        },
    }
}
async fn reply_or_cancel < T , F > ( mut reply : oneshot :: Sender < Result < T , BlockchainStateServiceError > > , fut : F ) where F : Future < Output = Result < T , BlockchainStateServiceError > > { futures :: pin_mut ! ( fut ) ; let either = future :: select ( poll_fn ( | cx | reply . poll_canceled ( cx ) ) , fut ) . await ; match either { Either :: Left ( ( _ , _ ) ) => { /* Do nothing */ } , Either :: Right ( ( v , _ ) ) => { let _ = reply . send ( v ) ; } , } }
Polls both `fut` and the oneshot `poll_canceled` function.
Polls both ` fut ` and the oneshot ` poll_canceled ` function .
reply
oneshot::Sender<Result<T, BlockchainStateServiceError>>
fut
F
reply
oneshot::Sender<Result<T, BlockchainStateServiceError>>
fut
F