pub(crate) fn proto_response<R, M>(r: R) -> (Response<Body>, usize)
where
    M: ProtoProxy<R>,
{
    let buf = M::proxy_encode(r).expect("Could not serialize response");
    let size_bytes = buf.len();

    // Headers borrowed from Spring Framework -- https://bit.ly/32EDqoo -- and Google's Protobuf
    // reference -- https://bit.ly/35Q4yml. Might come in handy for e.g. a browser extension.
    let response = Response::builder()
        .header("Content-Type", "application/x-protobuf")
        .header("X-Protobuf-Schema", "certified_stream_slice.proto")
        .header("X-Protobuf-Message", "xnet.v1.CertifiedStreamSlice")
        .body(buf.into())
        .unwrap();

    (response, size_bytes)
}
/// Serializes the response as Protobuf.
Serializes the response as Protobuf.
Serializes the response as Protobuf .
pub(crate) fn proto_response<R, M>(r: R) -> (Response<Body>, usize)
where
    M: ProtoProxy<R>,
{
    let buf = M::proxy_encode(r).expect("Could not serialize response");
    let size_bytes = buf.len();
    // Headers borrowed from Spring Framework -- https://bit.ly/32EDqoo -- and Google's Protobuf
    // reference -- https://bit.ly/35Q4yml. Might come in handy for e.g. a browser extension.
    let response = Response::builder()
        .header("Content-Type", "application/x-protobuf")
        .header("X-Protobuf-Schema", "certified_stream_slice.proto")
        .header("X-Protobuf-Message", "xnet.v1.CertifiedStreamSlice")
        .body(buf.into())
        .unwrap();
    (response, size_bytes)
}
pub ( crate ) fn proto_response < R , M > ( r : R ) -> ( Response < Body > , usize ) where M : ProtoProxy < R > , { let buf = M :: proxy_encode ( r ) . expect ( " " ) ; let size_bytes = buf . len ( ) ; // Headers borrowed from Spring Framework -- https://bit.ly/32EDqoo -- and Google's Protobuf // reference -- https://bit.ly/35Q4yml. Might come in handy for e.g. a browser extension. let response = Response :: builder ( ) . header ( " " , " " ) . header ( " " , " " ) . header ( " " , " " ) . body ( buf . into ( ) ) . unwrap ( ) ; ( response , size_bytes ) }
Serializes the response as Protobuf.
Serializes the response as Protobuf .
r
R
r
R