async fn transfer<I, O>(mut inbound: I, mut outbound: O) -> Result<()>
where
    I: AsyncRead + AsyncWrite + Unpin,
    O: AsyncRead + AsyncWrite + Unpin,
{
    match tokio::io::copy_bidirectional(&mut inbound, &mut outbound).await {
        Ok(res) => info!("transfer closed ({}, {})", res.0, res.1),
        Err(err) => error!("transfer error: {:?}", err),
    };

    Ok(())
}
/// Copy data between two peers
/// Using 2 different generators, because they could be different structs with same traits.
Copy data between two peers
Using 2 different generators, because they could be different structs with same traits.
Copy data between two peers Using 2 different generators because they could be different structs with same traits .
async fn transfer<I, O>(mut inbound: I, mut outbound: O) -> Result<()>
where
    I: AsyncRead + AsyncWrite + Unpin,
    O: AsyncRead + AsyncWrite + Unpin,
{
    match tokio::io::copy_bidirectional(&mut inbound, &mut outbound).await {
        Ok(res) => info!("transfer closed ({}, {})", res.0, res.1),
        Err(err) => error!("transfer error: {:?}", err),
    };
    Ok(())
}
async fn transfer < I , O > ( mut inbound : I , mut outbound : O ) -> Result < ( ) > where I : AsyncRead + AsyncWrite + Unpin , O : AsyncRead + AsyncWrite + Unpin , { match tokio :: io :: copy_bidirectional ( & mut inbound , & mut outbound ) . await { Ok ( res ) => info ! ( " " res 0 res 1 ) , Err ( err ) => error ! ( " " err ) , } ; Ok ( ( ) ) }
Copy data between two peers
Using 2 different generators, because they could be different structs with same traits.
Copy data between two peers Using 2 different generators because they could be different structs with same traits .
inbound
I
outbound
O
inbound
I
outbound
O