pub async fn write_into(&self, socket: &mut TcpStream) -> Result<(), std::io::Error> {
        match self {
            Self::Copy { from, objects } => {
                socket.write_u8(COPY_TYPE_ID).await?;
                write_peer_addr(from, socket).await?;
                write_object_id_list(objects, socket).await?;
            }
            Self::Take { from, objects } => {
                socket.write_u8(TAKE_TYPE_ID).await?;
                write_peer_addr(from, socket).await?;
                write_object_id_list(objects, socket).await?;
            }
        }
        Ok(())
    }
// Writes a SYNC peer request into the specified socket.
Writes a SYNC peer request into the specified socket.
Writes a SYNC peer request into the specified socket .
pub async fn write_into(&self, socket: &mut TcpStream) -> Result<(), std::io::Error> {
        match self {
            Self::Copy { from, objects } => {
                socket.write_u8(COPY_TYPE_ID).await?;
                write_peer_addr(from, socket).await?;
                write_object_id_list(objects, socket).await?;
            }
            Self::Take { from, objects } => {
                socket.write_u8(TAKE_TYPE_ID).await?;
                write_peer_addr(from, socket).await?;
                write_object_id_list(objects, socket).await?;
            }
        }
        Ok(())
    }
pub async fn write_into ( & self , socket : & mut TcpStream ) -> Result < ( ) , std :: io :: Error > { match self { Self :: Copy { from , objects } => { socket . write_u8 ( COPY_TYPE_ID ) . await ? ; write_peer_addr ( from , socket ) . await ? ; write_object_id_list ( objects , socket ) . await ? ; } Self :: Take { from , objects } => { socket . write_u8 ( TAKE_TYPE_ID ) . await ? ; write_peer_addr ( from , socket ) . await ? ; write_object_id_list ( objects , socket ) . await ? ; } } Ok ( ( ) ) }
Writes a SYNC peer request into the specified socket.
Writes a SYNC peer request into the specified socket .
&self
socket
&mut TcpStream
&self
socket
&mut TcpStream