async fn listen_for_completion(
        mut listener: CaseListenerRequestStream,
    ) -> Result<Option<TestResult>, anyhow::Error> {
        if let Some(request) = listener.try_next().await.context("waiting for listener")? {
            let Finished { result, control_handle: _ } = request;
            let result = match result.status {
                Some(status) => match status {
                    fidl_fuchsia_test::Status::Passed => TestResult::Passed,
                    fidl_fuchsia_test::Status::Failed => TestResult::Failed,
                    fidl_fuchsia_test::Status::Skipped => TestResult::Skipped,
                },
                // This will happen when test protocol is not properly implemented
                // by the test and it forgets to set the result.
                None => TestResult::Error,
            };
            Ok(Some(result))
        } else {
            Ok(None)
        }
    }
/// Listen for test completion on the given |listener|. Returns None if the channel is closed
/// before a test completion event.
Listen for test completion on the given |listener|. Returns None if the channel is closed
before a test completion event.
Listen for test completion on the given |listener| . Returns None if the channel is closed before a test completion event .
async fn listen_for_completion(
        mut listener: CaseListenerRequestStream,
    ) -> Result<Option<TestResult>, anyhow::Error> {
        if let Some(request) = listener.try_next().await.context("waiting for listener")? {
            let Finished { result, control_handle: _ } = request;
            let result = match result.status {
                Some(status) => match status {
                    fidl_fuchsia_test::Status::Passed => TestResult::Passed,
                    fidl_fuchsia_test::Status::Failed => TestResult::Failed,
                    fidl_fuchsia_test::Status::Skipped => TestResult::Skipped,
                },
                // This will happen when test protocol is not properly implemented
                // by the test and it forgets to set the result.
                None => TestResult::Error,
            };
            Ok(Some(result))
        } else {
            Ok(None)
        }
    }
async fn listen_for_completion ( mut listener : CaseListenerRequestStream , ) -> Result < Option < TestResult > , anyhow :: Error > { if let Some ( request ) = listener . try_next ( ) . await . context ( " " ) ? { let Finished { result , control_handle : _ } = request ; let result = match result . status { Some ( status ) => match status { fidl_fuchsia_test :: Status :: Passed => TestResult :: Passed , fidl_fuchsia_test :: Status :: Failed => TestResult :: Failed , fidl_fuchsia_test :: Status :: Skipped => TestResult :: Skipped , } , // This will happen when test protocol is not properly implemented // by the test and it forgets to set the result. None => TestResult :: Error , } ; Ok ( Some ( result ) ) } else { Ok ( None ) } }
Listen for test completion on the given |listener|.
Listen for test completion on the given |listener| .
listener
CaseListenerRequestStream
listener
CaseListenerRequestStream