diff options
| author | diogo464 <[email protected]> | 2026-02-12 16:30:05 +0000 |
|---|---|---|
| committer | diogo464 <[email protected]> | 2026-02-12 16:30:05 +0000 |
| commit | f6f4cd8fcb5dd85e62cf7b10624784f8d4bdd71a (patch) | |
| tree | caff3877282abaa3e5ab6adcb26568bb65483cee /urpc-macro/src/lib.rs | |
| parent | f319d7ab5278a3cfb43d38875d81c28cc2dce1e1 (diff) | |
Diffstat (limited to 'urpc-macro/src/lib.rs')
| -rw-r--r-- | urpc-macro/src/lib.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/urpc-macro/src/lib.rs b/urpc-macro/src/lib.rs index 4facc60..9d5ce0e 100644 --- a/urpc-macro/src/lib.rs +++ b/urpc-macro/src/lib.rs | |||
| @@ -130,11 +130,11 @@ fn generate_service_into_service_match_arm(service: &Service, method: &Method) - | |||
| 130 | 130 | ||
| 131 | quote::quote! { | 131 | quote::quote! { |
| 132 | #method_name => { | 132 | #method_name => { |
| 133 | let ((#(#arg_idents),*), _) = | 133 | let (#(#arg_idents),*) = |
| 134 | urpc::internal::bincode::serde::decode_from_slice(&arguments, urpc::internal::bincode::config::standard()).map_err(std::io::Error::other)?; | 134 | urpc::internal::postcard::from_bytes(&arguments).map_err(std::io::Error::other)?; |
| 135 | let ctx = Default::default(); | 135 | let ctx = Default::default(); |
| 136 | let ret = <T as #server_trait>::#method_ident(&self.0, ctx, #(#arg_idents),*).await; | 136 | let ret = <T as #server_trait>::#method_ident(&self.0, ctx, #(#arg_idents),*).await; |
| 137 | let value = urpc::internal::bincode::serde::encode_to_vec(&ret, urpc::internal::bincode::config::standard()).map_err(std::io::Error::other)?; | 137 | let value = urpc::internal::postcard::to_stdvec(&ret).map_err(std::io::Error::other)?; |
| 138 | Ok(From::from(value)) | 138 | Ok(From::from(value)) |
| 139 | } | 139 | } |
| 140 | } | 140 | } |
| @@ -229,7 +229,7 @@ fn generate_service_client_method(service: &Service, method: &Method) -> TokenSt | |||
| 229 | let service = String::from(#service_name); | 229 | let service = String::from(#service_name); |
| 230 | let method = String::from(#method_string); | 230 | let method = String::from(#method_string); |
| 231 | let arguments = (#(#method_arg_idents),*); | 231 | let arguments = (#(#method_arg_idents),*); |
| 232 | let arguments = match urpc::internal::bincode::serde::encode_to_vec(&arguments, urpc::internal::bincode::config::standard()) { | 232 | let arguments = match urpc::internal::postcard::to_stdvec(&arguments) { |
| 233 | Ok(arguments) => From::from(arguments), | 233 | Ok(arguments) => From::from(arguments), |
| 234 | Err(err) => return Err(urpc::protocol::RpcError::Transport(std::io::Error::other(err))), | 234 | Err(err) => return Err(urpc::protocol::RpcError::Transport(std::io::Error::other(err))), |
| 235 | }; | 235 | }; |
| @@ -237,8 +237,8 @@ fn generate_service_client_method(service: &Service, method: &Method) -> TokenSt | |||
| 237 | Ok(response) => response, | 237 | Ok(response) => response, |
| 238 | Err(err) => return Err(urpc::protocol::RpcError::Transport(err)), | 238 | Err(err) => return Err(urpc::protocol::RpcError::Transport(err)), |
| 239 | }; | 239 | }; |
| 240 | match urpc::internal::bincode::serde::decode_from_slice::<std::result::Result<#method_return_type, #service_error>, _>(&response, urpc::internal::bincode::config::standard()) { | 240 | match urpc::internal::postcard::from_bytes::<std::result::Result<#method_return_type, #service_error>>(&response) { |
| 241 | Ok((result, _)) => result.map_err(urpc::protocol::RpcError::Remote), | 241 | Ok(result) => result.map_err(urpc::protocol::RpcError::Remote), |
| 242 | Err(err) => Err(urpc::protocol::RpcError::Transport(std::io::Error::other(err))), | 242 | Err(err) => Err(urpc::protocol::RpcError::Transport(std::io::Error::other(err))), |
| 243 | } | 243 | } |
| 244 | } | 244 | } |
