pub async fn process<R: AsyncRead + Unpin + Send + Sync, W: AsyncWrite + Unpin>(
        input: R,
        output: W,
    ) -> Result<(), Box<dyn Error>> {
        let mut this = Self::new();

        // use "flexible" to allow empty input fields for disputes, resolves, and chargebacks
        let input = csv_async::AsyncReaderBuilder::new()
            .flexible(true)
            .create_deserializer(input);
        let mut rows = input.into_deserialize::<InputRow>();
        let mut history = HashMap::new();

        // Assume every row is chronologically sequential as specified
        while let Some(result) = rows.next().await {
            let row = result?;
            this.process_single_transaction(row, &mut history)?;
        }

        // output to desired output stream
        let mut output = csv_async::AsyncSerializer::from_writer(output);
        for (_, row) in this.clients {
            output.serialize(row).await?;
        }

        Ok(output.flush().await?)
    }
/// Fully processes the input source, outputting the contents to the desired output
Fully processes the input source, outputting the contents to the desired output
Fully processes the input source outputting the contents to the desired output
pub async fn process<R: AsyncRead + Unpin + Send + Sync, W: AsyncWrite + Unpin>(
        input: R,
        output: W,
    ) -> Result<(), Box<dyn Error>> {
        let mut this = Self::new();
        // use "flexible" to allow empty input fields for disputes, resolves, and chargebacks
        let input = csv_async::AsyncReaderBuilder::new()
            .flexible(true)
            .create_deserializer(input);
        let mut rows = input.into_deserialize::<InputRow>();
        let mut history = HashMap::new();
        // Assume every row is chronologically sequential as specified
        while let Some(result) = rows.next().await {
            let row = result?;
            this.process_single_transaction(row, &mut history)?;
        }
        // output to desired output stream
        let mut output = csv_async::AsyncSerializer::from_writer(output);
        for (_, row) in this.clients {
            output.serialize(row).await?;
        }
        Ok(output.flush().await?)
    }
pub async fn process < R : AsyncRead + Unpin + Send + Sync , W : AsyncWrite + Unpin > ( input : R , output : W , ) -> Result < ( ) , Box < dyn Error > > { let mut this = Self :: new ( ) ; // use "flexible" to allow empty input fields for disputes, resolves, and chargebacks let input = csv_async :: AsyncReaderBuilder :: new ( ) . flexible ( true ) . create_deserializer ( input ) ; let mut rows = input . into_deserialize :: < InputRow > ( ) ; let mut history = HashMap :: new ( ) ; // Assume every row is chronologically sequential as specified while let Some ( result ) = rows . next ( ) . await { let row = result ? ; this . process_single_transaction ( row , & mut history ) ? ; } // output to desired output stream let mut output = csv_async :: AsyncSerializer :: from_writer ( output ) ; for ( _ , row ) in this . clients { output . serialize ( row ) . await ? ; } Ok ( output . flush ( ) . await ? ) }
Fully processes the input source, outputting the contents to the desired output
Fully processes the input source outputting the contents to the desired output
input
R
output
W