pub fn decode<T: DeserializeOwned>(
    buf: &[u8],
    cbor_dec: &CborDecodeFn<T>
) -> RpcResult<T>