pub async fn read_from(socket: &mut TcpStream) -> crate::Result<Self> {
        let request_type = socket.read_u8().await?;
        match request_type {
            COPY_TYPE_ID => {
                let from = read_socket_addr(socket).await?;
                let objects = read_object_id_list(socket).await?;
                Ok(PeerRequest::Copy { from, objects })
            }
            TAKE_TYPE_ID => {
                let from = read_socket_addr(socket).await?;
                let objects = read_object_id_list(socket).await?;
                Ok(PeerRequest::Take { from, objects })
            }
            _ => Err(RequestError::InvalidPeerRequestType(request_type).into()),
        }
    }
/// Reads a SYNC peer request from the specified socket.
Reads a SYNC peer request from the specified socket.
Reads a SYNC peer request from the specified socket .
pub async fn read_from(socket: &mut TcpStream) -> crate::Result<Self> {
        let request_type = socket.read_u8().await?;
        match request_type {
            COPY_TYPE_ID => {
                let from = read_socket_addr(socket).await?;
                let objects = read_object_id_list(socket).await?;
                Ok(PeerRequest::Copy { from, objects })
            }
            TAKE_TYPE_ID => {
                let from = read_socket_addr(socket).await?;
                let objects = read_object_id_list(socket).await?;
                Ok(PeerRequest::Take { from, objects })
            }
            _ => Err(RequestError::InvalidPeerRequestType(request_type).into()),
        }
    }
pub async fn read_from ( socket : & mut TcpStream ) -> crate :: Result < Self > { let request_type = socket . read_u8 ( ) . await ? ; match request_type { COPY_TYPE_ID => { let from = read_socket_addr ( socket ) . await ? ; let objects = read_object_id_list ( socket ) . await ? ; Ok ( PeerRequest :: Copy { from , objects } ) } TAKE_TYPE_ID => { let from = read_socket_addr ( socket ) . await ? ; let objects = read_object_id_list ( socket ) . await ? ; Ok ( PeerRequest :: Take { from , objects } ) } _ => Err ( RequestError :: InvalidPeerRequestType ( request_type ) . into ( ) ) , } }
Reads a SYNC peer request from the specified socket.
Reads a SYNC peer request from the specified socket .
socket
&mut TcpStream
socket
&mut TcpStream