async fn run_helper<T: NashProtocolPipeline + Clone>(
        &self,
        request: T,
    ) -> Result<ResponseOrError<<T::ActionType as NashProtocol>::Response>> {
        // First run any dependencies of the request/pipeline
        let before_actions = request.run_before(self.state.clone()).await?;
        if let Some(actions) = before_actions {
            for action in actions {
                self.run(action).await?;
            }
        }
        // Now run the pipeline
        let mut protocol_state = request.init_state(self.state.clone()).await;
        // While pipeline contains more actions for client to take, execute them
        loop {
            if let Some(protocol_request) = request
                .next_step(&protocol_state, self.state.clone())
                .await?
            {
                let protocol_response = self.execute_protocol(protocol_request).await?;
                // If error, end pipeline early and return GraphQL/network error data
                if protocol_response.is_error() {
                    Self::manage_client_error(
                        self.state.clone(),
                        protocol_response.error().unwrap(),
                    )
                    .await;

                    return Ok(ResponseOrError::Error(
                        protocol_response
                            .consume_error()
                            .expect("Destructure error after check. Impossible to fail."),
                    ));
                }
                // Otherwise update the pipeline and continue
                request
                    .process_step(
                        protocol_response
                            .consume_response()
                            .expect("Destructure response after check. Impossible to fail."),
                        &mut protocol_state,
                    )
                    .await;
            } else {
                // If no more actions left, then done
                break;
            }
        }
        // Get things to run after the request/pipeline
        let after_actions = request.run_after(self.state.clone()).await?;
        // Now run anything specified for after the pipeline
        if let Some(actions) = after_actions {
            for action in actions {
                self.run(action).await?;
            }
        }
        // Return the pipeline output
        request.output(protocol_state)
    }
/// Does the main work of running a pipeline via websockets
Does the main work of running a pipeline via websockets
Does the main work of running a pipeline via websockets
async fn run_helper<T: NashProtocolPipeline + Clone>(
        &self,
        request: T,
    ) -> Result<ResponseOrError<<T::ActionType as NashProtocol>::Response>> {
        // First run any dependencies of the request/pipeline
        let before_actions = request.run_before(self.state.clone()).await?;
        if let Some(actions) = before_actions {
            for action in actions {
                self.run(action).await?;
            }
        }
        // Now run the pipeline
        let mut protocol_state = request.init_state(self.state.clone()).await;
        // While pipeline contains more actions for client to take, execute them
        loop {
            if let Some(protocol_request) = request
                .next_step(&protocol_state, self.state.clone())
                .await?
            {
                let protocol_response = self.execute_protocol(protocol_request).await?;
                // If error, end pipeline early and return GraphQL/network error data
                if protocol_response.is_error() {
                    Self::manage_client_error(
                        self.state.clone(),
                        protocol_response.error().unwrap(),
                    )
                    .await;
                    return Ok(ResponseOrError::Error(
                        protocol_response
                            .consume_error()
                            .expect("Destructure error after check. Impossible to fail."),
                    ));
                }
                // Otherwise update the pipeline and continue
                request
                    .process_step(
                        protocol_response
                            .consume_response()
                            .expect("Destructure response after check. Impossible to fail."),
                        &mut protocol_state,
                    )
                    .await;
            } else {
                // If no more actions left, then done
                break;
            }
        }
        // Get things to run after the request/pipeline
        let after_actions = request.run_after(self.state.clone()).await?;
        // Now run anything specified for after the pipeline
        if let Some(actions) = after_actions {
            for action in actions {
                self.run(action).await?;
            }
        }
        // Return the pipeline output
        request.output(protocol_state)
    }
async fn run_helper < T : NashProtocolPipeline + Clone > ( & self , request : T , ) -> Result < ResponseOrError < < T :: ActionType as NashProtocol > :: Response > > { // First run any dependencies of the request/pipeline let before_actions = request . run_before ( self . state . clone ( ) ) . await ? ; if let Some ( actions ) = before_actions { for action in actions { self . run ( action ) . await ? ; } } // Now run the pipeline let mut protocol_state = request . init_state ( self . state . clone ( ) ) . await ; // While pipeline contains more actions for client to take, execute them loop { if let Some ( protocol_request ) = request . next_step ( & protocol_state , self . state . clone ( ) ) . await ? { let protocol_response = self . execute_protocol ( protocol_request ) . await ? ; // If error, end pipeline early and return GraphQL/network error data if protocol_response . is_error ( ) { Self :: manage_client_error ( self . state . clone ( ) , protocol_response . error ( ) . unwrap ( ) , ) . await ; return Ok ( ResponseOrError :: Error ( protocol_response . consume_error ( ) . expect ( " " ) , ) ) ; } // Otherwise update the pipeline and continue request . process_step ( protocol_response . consume_response ( ) . expect ( " " ) , & mut protocol_state , ) . await ; } else { // If no more actions left, then done break ; } } // Get things to run after the request/pipeline let after_actions = request . run_after ( self . state . clone ( ) ) . await ? ; // Now run anything specified for after the pipeline if let Some ( actions ) = after_actions { for action in actions { self . run ( action ) . await ? ; } } // Return the pipeline output request . output ( protocol_state ) }
Does the main work of running a pipeline via websockets
Does the main work of running a pipeline via websockets
&self
request
T