pub async fn pipeline(&mut self, messages: Vec<Message>) -> CommunicationResult<Vec<Message>> {
        // This Vec is too small if we're expecting some RECORD messages, so there's no "good" size
        let mut responses = Vec::with_capacity(messages.len());

        for message in &messages {
            #[cfg(test)]
            println!(">>> {:?}", message);

            let chunks = message.clone().into_chunks().map_err(ProtocolError::from)?;

            for chunk in chunks {
                self.stream.write_all(&chunk).await?;
            }

            // Immediate state changes
            match message {
                Message::Reset => self.server_state = Interrupted,
                Message::Goodbye => self.server_state = Disconnected,
                _ => {}
            }
        }
        self.stream.flush().await?;
        self.sent_queue.extend(messages);

        while !self.sent_queue.is_empty() {
            responses.push(self.read_message().await?);
        }
        Ok(responses)
    }
/// Send multiple messages to the server without waiting for a response. Returns a [`Vec`]
/// containing the server's response messages for each of the sent messages, in the order they
/// were provided.
///
/// # Description
/// The client is not required to wait for a response before sending more messages.  Sending
/// multiple messages together like this is called _pipelining_. For performance reasons, it is
/// recommended that clients use pipelining wherever possible. Using pipelining, multiple
/// messages can be transmitted together in the same network package, significantly reducing
/// latency and increasing throughput.
///
/// A common technique is to buffer outgoing messages on the client until the last possible
/// moment, such as when a commit is issued or a result is read by the application, and then
/// sending all messages in the buffer together.
///
/// # Failure Handling
/// Because the protocol leverages pipelining, the client and the server need to agree on what
/// happens when a failure occurs, otherwise messages that were sent assuming no failure would
/// occur might have unintended effects.
///
/// When requests fail on the server, the server will send the client a
/// [`FAILURE`](Message::Failure) message. The client must clear the failure state by sending
/// a [`RESET`](Message::Reset) (Bolt v3+) or [`ACK_FAILURE`](Message::AckFailure) (Bolt v1 -
/// v2) message to the server. Until the server receives the `RESET`/`ACK_FAILURE` message, it
/// will send an [`IGNORED`](Message::Ignored) message in response to any other message from
/// the client, including messages that were sent in a pipeline.
Send multiple messages to the server without waiting for a response. Returns a [`Vec`]
containing the server's response messages for each of the sent messages, in the order they
were provided.
Send multiple messages to the server without waiting for a response . Returns a [ ` Vec ` ] containing the server ' s response messages for each of the sent messages in the order they were provided .
pub async fn pipeline(&mut self, messages: Vec<Message>) -> CommunicationResult<Vec<Message>> {
        // This Vec is too small if we're expecting some RECORD messages, so there's no "good" size
        let mut responses = Vec::with_capacity(messages.len());
        for message in &messages {
            #[cfg(test)]
            println!(">>> {:?}", message);
            let chunks = message.clone().into_chunks().map_err(ProtocolError::from)?;
            for chunk in chunks {
                self.stream.write_all(&chunk).await?;
            }
            // Immediate state changes
            match message {
                Message::Reset => self.server_state = Interrupted,
                Message::Goodbye => self.server_state = Disconnected,
                _ => {}
            }
        }
        self.stream.flush().await?;
        self.sent_queue.extend(messages);
        while !self.sent_queue.is_empty() {
            responses.push(self.read_message().await?);
        }
        Ok(responses)
    }
pub async fn pipeline ( & mut self , messages : Vec < Message > ) -> CommunicationResult < Vec < Message > > { // This Vec is too small if we're expecting some RECORD messages, so there's no "good" size let mut responses = Vec :: with_capacity ( messages . len ( ) ) ; for message in & messages { # [ cfg ( test ) ] println ! ( " " message ) ; let chunks = message . clone ( ) . into_chunks ( ) . map_err ( ProtocolError :: from ) ? ; for chunk in chunks { self . stream . write_all ( & chunk ) . await ? ; } // Immediate state changes match message { Message :: Reset => self . server_state = Interrupted , Message :: Goodbye => self . server_state = Disconnected , _ => { } } } self . stream . flush ( ) . await ? ; self . sent_queue . extend ( messages ) ; while ! self . sent_queue . is_empty ( ) { responses . push ( self . read_message ( ) . await ? ) ; } Ok ( responses ) }
Send multiple messages to the server without waiting for a response.
Send multiple messages to the server without waiting for a response .
&mut self
messages
Vec<Message>
description
The client is not required to wait for a response before sending more messages.  Sending
multiple messages together like this is called _pipelining_. For performance reasons, it is
recommended that clients use pipelining wherever possible. Using pipelining, multiple
messages can be transmitted together in the same network package, significantly reducing
latency and increasing throughput.

A common technique is to buffer outgoing messages on the client until the last possible
moment, such as when a commit is issued or a result is read by the application, and then
sending all messages in the buffer together.
The client is not required to wait for a response before sending more messages . Sending multiple messages together like this is called _pipelining_ . For performance reasons it is recommended that clients use pipelining wherever possible . Using pipelining multiple messages can be transmitted together in the same network package significantly reducing latency and increasing throughput . A common technique is to buffer outgoing messages on the client until the last possible moment such as when a commit is issued or a result is read by the application and then sending all messages in the buffer together .
failure handling
Because the protocol leverages pipelining, the client and the server need to agree on what
happens when a failure occurs, otherwise messages that were sent assuming no failure would
occur might have unintended effects.

When requests fail on the server, the server will send the client a
[`FAILURE`](Message::Failure) message. The client must clear the failure state by sending
a [`RESET`](Message::Reset) (Bolt v3+) or [`ACK_FAILURE`](Message::AckFailure) (Bolt v1
v2) message to the server. Until the server receives the `RESET`/`ACK_FAILURE` message, it
will send an [`IGNORED`](Message::Ignored) message in response to any other message from
the client, including messages that were sent in a pipeline.
Because the protocol leverages pipelining the client and the server need to agree on what happens when a failure occurs otherwise messages that were sent assuming no failure would occur might have unintended effects . When requests fail on the server the server will send the client a [ ` FAILURE ` ] ( Message :: Failure ) message . The client must clear the failure state by sending a [ ` RESET ` ] ( Message :: Reset ) ( Bolt v3 + ) or [ ` ACK_FAILURE ` ] ( Message :: AckFailure ) ( Bolt v1 v2 ) message to the server . Until the server receives the ` RESET ` / ` ACK_FAILURE ` message it will send an [ ` IGNORED ` ] ( Message :: Ignored ) message in response to any other message from the client including messages that were sent in a pipeline .