pub async fn write_into(&self, socket: &mut TcpStream) -> Result<(), std::io::Error> {
        match self {
            Request::Sync(peer_requests) => {
                socket.write_u8(SYNC_TYPE_ID).await?;
                socket.write_u16_le(peer_requests.len() as u16).await?;
                for peer_request in peer_requests.iter() {
                    peer_request.write_into(socket).await?;
                }
            }
            Request::Copy(object_ids) => {
                socket.write_u8(COPY_TYPE_ID).await?;
                write_object_id_list(object_ids, socket).await?;
            }
            Request::Take(object_ids) => {
                socket.write_u8(TAKE_TYPE_ID).await?;
                write_object_id_list(object_ids, socket).await?;
            }
        }
        Ok(())
    }
/// Writes this request into the socket.
Writes this request into the socket.
Writes this request into the socket .
pub async fn write_into(&self, socket: &mut TcpStream) -> Result<(), std::io::Error> {
        match self {
            Request::Sync(peer_requests) => {
                socket.write_u8(SYNC_TYPE_ID).await?;
                socket.write_u16_le(peer_requests.len() as u16).await?;
                for peer_request in peer_requests.iter() {
                    peer_request.write_into(socket).await?;
                }
            }
            Request::Copy(object_ids) => {
                socket.write_u8(COPY_TYPE_ID).await?;
                write_object_id_list(object_ids, socket).await?;
            }
            Request::Take(object_ids) => {
                socket.write_u8(TAKE_TYPE_ID).await?;
                write_object_id_list(object_ids, socket).await?;
            }
        }
        Ok(())
    }
pub async fn write_into ( & self , socket : & mut TcpStream ) -> Result < ( ) , std :: io :: Error > { match self { Request :: Sync ( peer_requests ) => { socket . write_u8 ( SYNC_TYPE_ID ) . await ? ; socket . write_u16_le ( peer_requests . len ( ) as u16 ) . await ? ; for peer_request in peer_requests . iter ( ) { peer_request . write_into ( socket ) . await ? ; } } Request :: Copy ( object_ids ) => { socket . write_u8 ( COPY_TYPE_ID ) . await ? ; write_object_id_list ( object_ids , socket ) . await ? ; } Request :: Take ( object_ids ) => { socket . write_u8 ( TAKE_TYPE_ID ) . await ? ; write_object_id_list ( object_ids , socket ) . await ? ; } } Ok ( ( ) ) }
Writes this request into the socket.
Writes this request into the socket .
&self
socket
&mut TcpStream
&self
socket
&mut TcpStream