Skip to main content

encode_rpc_value

Function encode_rpc_value 

Source
pub async fn encode_rpc_value<C, T>(
    codec: &C,
    headers: &HeaderMap,
    value: &T,
) -> Result<Vec<u8>, CoolError>
where C: HttpTransport, T: Serialize + ?Sized,
Expand description

Encode an arbitrary serializable value back to bytes using the same codec as the request. Used by the macro-generated update dispatch arm to re-encode the typed patch before handing it to the existing update handler as Bytes.

Async because the codec’s encode_response returns an axum::Response whose body has to be buffered out — in practice the codec always produces an in-memory Full<Bytes> body, so this completes in one poll, but we don’t depend on that.