You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After #1057 is merged then it possible for the server implementation to add custom return types which isn't necessarily Result<T, E> i.e, it could a type that just implements IntoResponse. While this is a nice improvement for the server, it doesn't work for the clients as the responses could fail a bunch of reasons such as I/O, decoding errors and similar hence there are two client traits that returns Result<T, Error>.
Thus, currently Result<T, E> only works when both the client and server attributes are enabled at an API.
For example the following won't compile:
For example we could try to parse the return type if it's not a result type and generate:
asyncfnmethod1(&self) -> Result<Custom,Error>;
This leads to question whether grouping the server and client is such a good idea since there are basically to much magic happens in the proc macro.
Thus, it might be better split them up but I still very much like the idea that an API can be shared by a server/client to avoid duplicated all things.
The text was updated successfully, but these errors were encountered:
niklasad1
changed the title
proc macros: IntoResponse for client API
proc macros: client API does only work Result<T, E and can't be used with custom return types
Apr 4, 2023
After #1057 is merged then it possible for the server implementation to add custom return types which isn't necessarily
Result<T, E>
i.e, it could a type that just implementsIntoResponse
. While this is a nice improvement for the server, it doesn't work for the clients as the responses could fail a bunch of reasons such as I/O, decoding errors and similar hence there are two client traits that returnsResult<T, Error>
.Thus, currently
Result<T, E>
only works when both the client and server attributes are enabled at an API.For example the following won't compile:
For example we could try to parse the return type if it's not a result type and generate:
This leads to question whether grouping the server and client is such a good idea since there are basically to much magic happens in the proc macro.
Thus, it might be better split them up but I still very much like the idea that an API can be shared by a server/client to avoid duplicated all things.
The text was updated successfully, but these errors were encountered: