/// Creates a new VRP response.
///
/// The response will be sent to the socket `sock`. The list will be the
/// current list from `origins`. It will be formatted in `format`.
Creates a new VRP response.
The response will be sent to the socket `sock`. The list will be the
current list from `origins`. It will be formatted in `format`.
Creates a new VRP response . The response will be sent to the socket ` sock ` . The list will be the current list from ` origins ` . It will be formatted in ` format ` .
pub fn response(
        sock: TcpStream,
        origins: OriginsHistory,
        format: OutputFormat
    ) -> Response {
        // We’ll start out with the HTTP header which we can assemble
        // already. For the length, we have our magical `GetLength` type.
        let origins = origins.current();
        let header = format!("\
            HTTP/1.1 200 OK\r\n\
            Content-Type: text/plain;charset=utf-8\r\n\
            Content-Length: {}\r\n\
            \r\n",
            GetLength::get(|w| format.output(&origins, w).unwrap())
        ).into_bytes();
        Response::Vrp(VrpResponse {
            write: write_all(sock, header),
            origins,
            next_id: 0,
            format
        })
    }
pub fn response ( sock : TcpStream , origins : OriginsHistory , format : OutputFormat ) -> Response { // We’ll start out with the HTTP header which we can assemble // already. For the length, we have our magical `GetLength` type. let origins = origins . current ( ) ; let header = format ! ( " \
 \r \n \
 \r \n \
 \r \n \
 \r \n " GetLength get ( w format output ( origins w ) unwrap ( ) ) ) . into_bytes ( ) ; Response :: Vrp ( VrpResponse { write : write_all ( sock , header ) , origins , next_id : 0 , format } ) }
Creates a new VRP response.
Creates a new VRP response .
sock
TcpStream
origins
OriginsHistory
format
OutputFormat